The implemented cluster.
Readonly
eventsAccess the behavior's events.
Supported features as a flag object.
Protected
internalAccess the behavior's state.
Static
Readonly
clusterBase cluster state include all attribute values but may be extended by subclasses.
Static
Readonly
defaultsStatic
Optional
Readonly
dependenciesStatic
Readonly
earlyStatic
Readonly
EventsStatic
Readonly
idThe behavior ID for ClusterBehaviors is the name of the cluster.
Static
Readonly
InterfaceStatic
Readonly
nameStatic
Optional
Readonly
schemaStatic
Readonly
supervisorStatic
supportsDoes this behavior support functionality of a specific implementation?
Release resources. This is the public API for releasing application resources held by behaviors in internal state.
Execute logic with elevated privileges.
The provided function executes with privileges escalated to offline mode. This is not commonly necessary.
Elevated logic effectively ignores ACLs so should be used with care.
Note that interactions with the behavior will remain elevated until the synchronous completion of this call. You should only elevate privileges for synchronous logic.
the elevated logic
Protected
callbackCreate a generic callback function that has the same properties as a Reactor.
Like a reactor, the callback's "this" will be bound to an active Behavior instance. Because of this: The reactor MUST be a real JS function - arrow functions will not work!
Protected
executeProtected
Calibrate the device. The default implementation takes no action. Override to implement calibration if necessary.
Move the WindowCovering to a specific tilt value. The method calls the handleMovement method to actually move the device to the defined position.
Move the WindowCovering to a specific lift value. The default implementation calculates the % value for the target position. The method calls the handleMovement method to actually move the device to the defined position.
Move the WindowCovering to a specific tilt value. The method calls the handleMovement method to actually move the device to the defined position.
Move the WindowCovering to a specific tilt value. The default implementation calculates the % value for the target position. The method calls the handleMovement method to actually move the device to the defined position.
Protected
handleProtected
Perform actual "movement". Override to initiate movement of your device.
The default implementation logs and immediately updates current position to the target positions. This is
probably not desirable for a real device so do not invoke super.handleMovement()
from your implementation.
Which element should move, Lift or Tilt
If the motor is configured reversed
The direction of the movement (Open, Close, DefinedByPosition)
Optional
targetPercent100ths: numberOptionally the target position in percent 100ths. It depends on the used feature set of the cluster if this is provided or not.
Protected
handleProtected
Stop device movement. Sets the target position to the current position and updates operational state. Override to implement the actual stop movement logic.
If you update the current positions you can include the default logic via "super.handleStopMovement()".
Behaviors are ephemeral and should not perform initialization in their constructor. They can override this method instead.
This method may be synchronous or asyncronous. If asynchronous, the behavior will not be available for external use until initialization completes.
Protected
reactInstall a Reactor.
Important: The reactor MUST be a real JS function - arrow functions will not work!
Stop any movement of the WindowCovering. The method calls the handleStopMovement method to actually stop the movement of the device.
Static
alterStatic
enableStatic
forStatic
setStatic
with
This is the default server implementation of WindowCoveringBehavior.
This implementation includes all features of WindowCovering.Cluster and implements all mandatory commands. You should use WindowCoveringServer.with to specialize the class for the features your implementation supports.
If you enable position awareness (positionAware* features), the default logic automatically syncs current positions and operational state when the currentPositionPercent100ths attributes change. You should update currentPositionPercent100ths with the actual position from your device. This updates other attributes automatically.
When targetPosition*Percent100ths attributes change, operational state updates bases on the current and target values.
If you do not override handleMovement the default implementation updates current position to the target position immediately.
In addition to Matter attributes, WindowCoveringServerLogic.State includes the following configuration properties:
supportsCalibration (default false): Set to true if the device supports calibration. You must implement WindowCoveringServerLogic.executeCalibration to perform actual calibration.
supportsMaintenanceMode (default true): Set to false if the device has no maintenance mode
When developing for specific hardware you should extend WindowCoveringServer and implement the following methods to map movement to your device. The default implementation maps Matter commands to these methods. The benefit of this structure is that basic data validations and option checks are already done and you can focus on the actual hardware interaction:
WindowCoveringServerLogic.handleMovement Logic to actually move the device. Via Parameters the movement type (Lift/Tilt), direction, target percentage and information if motor is configured reversed are provided. When the device moves the current Positions (if supported by the device) are updated with the movement. The operational state is automatically updated by the default implementation based on current and target values of the cluster state.
WindowCoveringServerLogic.handleStopMovement Logic to stop any movement of the device. You can use the super.handleStopMovement() to set the target positions to the current positions or do this yourself.
WindowCoveringServerLogic.executeCalibration If supported, override this method to implement the calibration process. The default implementation returns an error to indicate calibration is unsupported. If unsupported you should also add a Changing event handler to the mode attribute to ensure calibration mode is not set (needs to throw an ConstraintError).
IMPORTANT NOTE:
This default implementation could have pitfalls when the calibration process and/or movement is handled via long running promises. There could be edge cases not correctly handled by the current implementation when it comes to long running movements or calibration processes - especially when these processes are long running async JS operations.
A movement coming in while another movement is still running is assumed to be handled by the device. It is not handled here. If this causes you trouble please provide feedback and we can discuss how to improve the default implementation.