-
-
Notifications
You must be signed in to change notification settings - Fork 360
Sensors
Many HomeKit sensors have the same configurable options. The common sensors are defined here along with their available options.
Type | Service Type |
---|---|
5 |
Contact Sensor |
6 |
Occupancy Sensor |
7 |
Leak Sensor |
8 |
Smoke Sensor |
9 |
Carbon Monoxide Sensor |
10 |
Carbon Dioxide Sensor |
11 |
Filter Change Sensor* |
12 |
Motion Sensor |
*Filter Change Sensor is incompatible with a main service and it should be declared as extra service.
The following configuration is available for sensors:
Section | Key | Description |
---|---|---|
Actions |
"0" , "1" , etc. |
The actions performed by the service |
Digital Inputs | "b" |
GPIOs that invoke specific actions |
Inching Time | "i" |
Time period before returning service to previous state |
State & Status Inputs |
"f[n]" & "g[n]"
|
Inputs that manage service state |
Service Notifications | "m" |
Notifications to send to another service |
Initial Lock State | "ks" |
Lock state at boot |
Actions on Boot | "xa" |
Enable / Disable execution of service actions on boot |
Service Characteristics |
{
"c": { "io":[ [[16,13],2], [[14],6,1] ], "l": 13},
"a": [{
"t": 12,
"i": 10,
"0": { "r": [ [ 16 ] ] },
"1": { "r": [ [ 16, 1 ] ] },
"f1": [ [ 14 ] ]
}]
}
This is an example of a Sonoff Basic unit with a motion sensor ("t": 12
)
connected to GPIO 14 ("f1": [{ "g": 14 }]
) and an LED connected to GPIO 13
("l": 13
).
The motion sensor service ("t": 12
) causes
action "1"
to be performed when activated ("f1"
). 10 seconds later
action "0"
will be performed because of the inching time option ("i": 10
)
NOTE: The following options are not needed in this example as they are the
default options but are included to make the example more readable:
"t": 1
& "v": 0
Digital Inputs "b"
are supported by this service.
See Digital Inputs for details on how to define this mandatory option.
A sensor has two actions.
Action | State | Description |
---|---|---|
"0" |
Deactivated | This action should be performed when sensor is deactivated. This is the default action on boot. |
"1" |
Activated | This action should be performed when sensor is activated |
The Digital Outputs
"r": [{}]
for each should be configured to attain the desired state.
The list of notifications "m"
supported by a sensor are as follows:
Value | Notification |
---|---|
0 |
Sensor DEACTIVATED (default) |
1 |
Sensor ACTIVATED |
2 |
Sensor status only DEACTIVATED |
3 |
Sensor status only ACTIVATED |
4 |
Toggle current state |
5 |
Toggle status only |
-1 |
Reset inching timer |
See the general Service Notifications section for details of how to configure these notifications.
The Initial Lock State about Service and Physical controls.
Key | Value | Notification |
---|---|---|
"ks" |
0 |
All locked |
1 |
Service unlocked. Physical controls locked | |
2 |
Service locked. Physical controls unlocked | |
3 |
All unlocked (default) |
State inputs "f[n]"
& Status Inputs "g[n]"
are supported by this service.
The supported list is:
Key | Action |
---|---|
"f0" |
Perform action "0" (Deactivate) |
"f1" |
Perform action "1" (Activate) |
"g0" |
Set service state to Deactivated |
"g1" |
Set service state to Activated |
Refer to State Inputs for more detail and examples.
ICMP Ping inputs "p[n]"
and "q[n]"
are supported by this service.
The supported list is:
Key | Action |
---|---|
"p0" |
Perform action "0" (Deactivate) |
"p1" |
Perform action "1" (Activate) |
"q0" |
Set service state to Deactivated |
"q1" |
Set service state to Activated |
Refer to ICMP Ping Inputs for more detail.
Characteristic | Description |
---|---|
0 |
Sensor State |
Home Accessory Architect
Home Accessory
Installation
Setup Mode
HAA Home Manager App
Configuration
About
General
| GPIOs Configuration
Accessory
| Actions
Service Types
Air Quality
Battery
Data History
Fan
Free Monitor
Garage Door
HAA iAirZoning
Heater Cooler
Humidifier
Light Sensor
Lightbulb
Lock Mechanism
Sensors
Power Measure
Security System
Stateless Button & Doorbell
Switch & Outlet
Temperature & Humidity
TV
Water Valve
Window Covering