Window Covering - WizBangCrash/esp-homekit-devices GitHub Wiki
A HomeKit Window Covering accessory.
Type | Device Type |
---|---|
45 | Window Covering |
Window Covering was introduced in firmware version 0.9.0
The following configuration is available for window coverings:
Section | Key | Description |
---|---|---|
Actions | "0", "1" etc. | The actions performed by the accessory |
Digital Inputs | "b" | GPIOs that invoke specific actions |
State & Status Inputs | "f[n]" & "g[n]" | Inputs that manage accessory state |
Wildcard Actions | "y[n]" | Perform an action when an accessory reaches a target value |
Accessory Notifications | "m" | Notifications to send to another accessory |
Covering Type | "w" | Type of covering |
Opening Time | "o" | Time for accessory to completely open |
Closing Time | "c" | Time for accessory to completely close |
Correction Value | "f" | Non-linear correction value for |
Window Covering Example
{
"c": { "l": 0, "b": [{ "g": 2, "p": 0, "t": 5 }] },
"a": [{
"t": 45,
"o": 18,
"c": 14,
"f": 70,
"0": { "r": [{ "g": 15, "v": 1 }, { "g": 4 }] },
"1": { "r": [{ "g": 15 }, { "g": 4, "v": 1 }] },
"2": { "r": [{ "g": 15 }, { "g": 4 }] },
"3": { "r": [{ "g": 15, "i": 1 }, { "g": 4 }] },
"4": { "r": [{ "g": 15 }, { "g": 4, "i": 1 }] },
"f0": [{ "g": 5, "p": 0 }],
"f1": [{ "g": 13, "p": 0 }],
"f2": [{ "g": 5, "t": 0 }, { "g": 13, "t": 0 }]
}]
}
The above example defines a Shelly 2.5 Window Covering driver with
external switches and a status LED "c": { "l": 0, "b": [{ "g": 2, "p": 0, "t": 5 }] }
.
The opening time is defined as 18 seconds "o": 18
.
The closing time is defined as 14 seconds "c": 14
.
A non-linear correction of 70% has also been set "f": 70
.
Actions
A window covering has a number of actions as documented below:
Key | Action | Description |
---|---|---|
"0" | Close, from stop | Close the window covering from the stopped state |
"1" | Open, from stop | Open the window covering from the stopped state |
"2" | Stop | Stop the window covering opening or closing |
"3" | Close, from opening | Action a close while window covering is opening |
"4" | Open, from closing | Action an open while window covering is closing |
"5" | Stop, from closing | Stop the window covering while it is closing |
"6" | Stop, from opening | Stop the window covering while it is opening |
"7" | Obstruction removed | |
"8" | Obstruction detected |
The Digital Outputs
"r": [{}]
for each should be configured to attain the desired state.
Covering Type
The covering type is defined by the "w"
key contained within the
accessory object.
Key | Value | Description |
---|---|---|
"w" | 0 | Window covering (default) e.g. a roller blind |
1 | Window e.g. a motorized window | |
2 | Door e.g. a motorized door |
This option specifies the type of covering. Refer to the HomeKit specifications to see details on the differences between these device types.
Opening Time
Opening time is defined by the "o"
key contained within the
accessory object.
Key | Value | Description |
---|---|---|
"o" | 15 | Accessory opening time (default) |
1 - 65535 | Integer value specifying number of seconds |
This option specifies the time the accessory takes to open completely. It is an integer (no decimals).
Closing Time
Closing time is defined by the "c"
key contained within the
accessory object.
Key | Value | Description |
---|---|---|
"c" | 15 | Accessory closing time (default) |
1 - 65535 | Integer value specifying number of seconds |
This option specifies the time the accessory takes to close completely. It is an integer (no decimals).
Correction Value
Correction value is defined by the "f"
key contained within the
accessory object.
Key | Value | Description |
---|---|---|
"f" | 0 | Non-linear correction value (_default) |
0 - 100 | Percentage value |
Some window coverings may require a correction factor to determine their real position with respect to open or closing state. This may be due to the it being a roller shutter for instance. Where the amount the covering opens accelerates as it opens due to the drum of the shutter.
You can modify how the position of the shutter is calculated by providing a non-linear correction value.
When a correction value is provided the position of the accessory is calculated as follows:
realPosition = coverPosition / (1 + ((100 - coverPosition) * correctionValue * 0.0002))
This option specifies a percentage. It is an integer between 0 and 100.
Accessory Notifications
The list of notifications "m"
supported by a window covering are as follows:
Value | Notification |
---|---|
-2 | Obstruction removed |
-1 | Obstruction detected |
0 - 100 | Set window covering to specified open percentage |
101 | It will stop the window covering opening or closing |
See the general Accessory Notifications section for details of how to configure these notifications.
Digital Inputs
Digital Inputs "b"
are supported by this accessory.
See Digital Inputs for details on how to define this mandatory option.
State and Status Inputs
State inputs "f[n]"
& Status Inputs "g[n]"
are supported by this accessory.
The supported list is:
Key | Required State |
---|---|
"f0" | Close window covering |
"f1" | Open window covering |
"f2" | Stop window covering opening or closing |
"f3" | Toggle between closing and stop |
"f4" | Toggle between opening and stop |
"f5" | Indicates that there is no obstruction |
"f6" | Indicates that there is an obstruction |
Refer to State Inputs for more detail and examples.
Wildcard Actions
Wildcard Actions "y[n]"
are supported by this accessory.
The supported list is:
Key | Action |
---|---|
"y0" | Trigger action when accessory reaches a specific position |
The position of the window covering is expressed as a percentage
e.g. {"y0":[{"v": 20, "0"{...}}]}
Refer to Wildcard Actions for more detail.