-
-
Notifications
You must be signed in to change notification settings - Fork 19
button Device
A button
device exposes a push button connected to a GPIO pin.
Homebridge RPi configures the GPIO pin for input.
By default, Homebridge RPi configures the internal pull-up resister for the GPIO pin.
Homebridge RPi configures pigpiod
to send real-time notifications when the GPIO state changes.
Homebridge RPi debounces the input signal.
The device is exposed to HomeKit as a Stateless Programmable Switch service.
By default, the switch supports Single Press, Double Press, and Long Press events.
The Double Press events can be disabled, by setting DoublePressTimeout
to 0.
The Long Press events can be disabled, by setting LongPressTimeout
to 0.
Disabling both Double Press and Long Press improves the responsiveness of Single Press, as Homebridge RPi no longer needs to wait for the button to be released or pressed again, before issuing Single Press.
All button
and rocker
devices for the same host are exposed under a single HomeKit accessory,
each as a separate Stateless Programmable Switch service.
Through this service, you can configure actions in HomeKit,
for Single Press, Double Press, and/or Long Press.
Apple's Home app shows one tile for all the Stateless Programmable Switch services,
with a separate Button section per service in the Configuration screen to configure the actions.
Note that you need a home hub for this.
The button
device uses the following config.json keys:
key | type | Description |
---|---|---|
name |
string | The name for the device in HomeKit. |
gpio |
integer | The GPIO pin. |
pull |
string | The configuration of the internal pull-up/pull-down resistor for the GPIO pin: off , down , or up (default). |
reversed |
boolean | The device state is reversed, i.e. report the button as pressed when the GPIO pin is high instead of on low. |
debounceTimeout |
integer | Time in ms to ignore state changes after initial change. Default 20ms. |
doublePressTimeout |
integer | Time in ms to wait after a release to see if button is pressed again for Double Press. Default 500ms. Set to 0 to disable Double Press altogether. Note that Single Press events are delayed while Homebridge RPi waits for a possible second press. |
longPressTimeout |
integer | Time in ms between button press and release after which a Long Press is issued. Default: 1000ms. Set to 0 to disable Long Press. |