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.
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.
callback<A, R>(reactor, options?): ((...args: A) => undefined | R)
Create 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!
Move the WindowCovering down or close. For position aware devices the target position is set to 100%. The method
calls the handleMovement method to actually move the device.
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 default implementation calculates the % value for the target
position. The method calls the handleMovement method to actually move the device to the defined position.
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.
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()".
Move the WindowCovering up or open. For position aware devices the target position is set to 0%. The method calls
the handleMovement method to actually move the device.
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.