Skip to content

Stateless Button

David Dix edited this page May 9, 2020 · 26 revisions

Stateless buttons can be used to trigger state changes in HomeKit based on the type of press placed on the button.

Type Device Type
3 Stateless Button

The following configuration is available for stateless buttons:

Section Key Description
Actions "a" The actions performed by the accessory
State & Status Inputs "f[n]" & "g[n]" Inputs that manage accessory state
Accessory Notifications "m" Notifications to send to another accessory
Initial State "s" State a switch accessory enters on boot

Example

{
  "c": {
    "b": [{ "g": 0, "t": 5 }]
  },
  "a": [{
    "t": 3,
    "f0": [{ "g": 0, "t": 1 }],
    "f1": [{ "g": 0, "t": 2 }],
    "f2": [{ "g": 0, "t": 3 }]
  }]
}

This is an example of a stateless button ("t": 3) connected to GPIO 0 with 3 state inputs defined; single press ("t": 1), double press ("t": 2) & long press ("t": 3)

Actions

A stateless button has three actions.

Action Press Description
"0" Single (default)
"1" Double
"2" Long

The Digital Outputs "r": [{}] for each should be configured to attain the desired state.

Accessory Notifications

The list of notifications "m" supported by a stateless button are as follows:

Value Notification
0 Single press (default)
1 Double press
2 Long press

See the general Accessory Notifications section for details of how to configure these notifications.

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" Single press
"f1" Double press
"f2" Long press

Refer to State Inputs for more detail and examples.

Initial State

The Initial State key is not supported by this accessory.

Clone this wiki locally