Fan - WizBangCrash/esp-homekit-devices GitHub Wiki
A fan accessory
This accessory was implemented in firmware version 1.7.0
Type | Device Type |
---|---|
65 | Fan |
The following configuration is available for fans:
Section | Key | Description |
---|---|---|
Actions | "0", "1" etc. | The actions performed by the accessory |
Digital Inputs | "b" | GPIOs that invoke specific actions |
Inching Time | "i" | Time period before returning accessory to previous state |
State & Status Inputs | "f[n]" & "g[n]" | Inputs that manage accessory state |
ICMP Ping Inputs | "q[n]" & "p[n]" | Ping 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 |
Initial State | "s" | State a switch accessory enters on boot |
Speed Step | "e" | Change in speed for each speed increment action |
Actions on Boot | "xa" | Enable / Disable execution of accessory actions on boot |
Example
{
"c":{"l":13,"b":[{"g":0,"t":5}]},
"a":[{
"t":65,
"e":3,
"0":{"r":[{"g":15},{"g":12},{"g":14}]},
"y0":[
{"v":1, "0":{"r":[{"g":15,"v":1,"i":0.5},{"g":12},{"g":14,"i":0.6}]} },
{"v":2, "0":{"r":[{"g":15,"v":1,"i":0.5},{"g":12,"i":0.6},{"g":14,"i":0.6}]} },
{"v":3, "0":{"r":[{"g":15,"v":1},{"g":4},{"g":14}]} }
]
},{
"t":1,
"1":{"r":[{"g":9}]},
"0":{"r":[{"g":9,"v":1}]},
"b":[{"g":0}]
}
]
}
This is an example of a Sonoff iFan03 ("t":65
).
The fan speed is controlled using GPIOs 15, 12 & 14.
The button is connected to GPIO 0 and the on/off relay is connected to GPIO 9.
A wildcard action ("y0"
) is defined to control the speed of the fan.
Each step change in the value monitored by the wildcard action changes the
fan control GPIO lines to adjust its speed.
Actions
Key | Action | Description |
---|---|---|
"0" | Off | The default action after boot unless the Initial State has been set |
"1" | On |
A fan has two actions. The Digital Outputs
"r": [{}]
for each should be configured to attain the desired state.
Speed Step
The Speed Step option is used to define the number of speed steps the fan has. When a request is made to increment or decrement the fan speed then the next or previous step in speed will be selected.
Speed Step is defined by the "e"
key contained within the
accessory object.
Key | Value | Description |
---|---|---|
"e" | 100 | (default) |
1 - 100 | Integer value specifying percentage or step change on each speed change request |
Setting the Speed Step to a value of 3 gives the fan three speeds, plus stop. When viewing the fan speed from within the Home App the fan accessory will show speeds of 0%, 33%, 66% & 100% depending on which speed step has been selected.
Accessory Notifications
The list of Accessory Notifications "m"
values supported are:
Key | Value | Notification |
---|---|---|
"v" | 0 | Fan OFF (default) |
1 | Fan on | |
-1 | Reset maximum use time "d" |
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 | Action |
---|---|
"f0" | Perform action "0" (Off) |
"f1" | Perform action "1" (On) |
"g0" | Set accessory state to Off |
"g1" | Set accessory state to On |
Refer to State Inputs for more detail and examples.
ICMP Ping Inputs
ICMP Ping inputs "p[n]"
and "q[n]"
are supported by this accessory.
The supported list is:
Key | Action |
---|---|
"p0" | Perform action "0" (Off) |
"p1" | Perform action "1" (On) |
"q0" | Set accessory state to Off |
"q1" | Set accessory state to On |
Refer to ICMP Ping Inputs for more detail.
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 fan speed |
Wildcard actions cam be mapped to each of the Speed Steps.
For example, if 3 Speed Steps have been defined ("e":3
) then wildcard actions
can be set for 0, 1, 2 & 3.
Refer to Wildcard Actions for more detail.
Initial State
The Initial State key is supported by this accessory. Refer to Initial State for details of the available values.