Skip to content

Stateless Button

David Dix edited this page Dec 15, 2019 · 26 revisions

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

Type Device Type
3 Stateless Button

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 events defined; single press ("t": 1), double press ("t": 2) & long press ("t": 3)

TODO: Try this out on my Sonoff Basic and try an understand its use???

Actions

A stateless button has three actions.

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

The digital output array "r": [{}] for each should be configured to attain the desired state.

HomeKit Notifications

The list of notifications supported by a stateless switch are as follows:

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

HomeKit Notifications work two ways; A device state change initiates a notification message to HomeKit, or the HomeApp can initiate a HomeKit message to notify the device to make a state change.

When a change of state occurs with the device a notification will be sent to HomeKit.

State Inputs

Name Event
"f0" Single press event
"f1" Double press event
"f2" Long press event

Additionally an accessory can have button(s) or binary input(s) associated with a specific state. When a specific state occurs then a fixed HomeKit event is triggered.

Refer to State Inputs for more detail and examples.

See Buttons for details on how to define this option.

Clone this wiki locally