-
-
Notifications
You must be signed in to change notification settings - Fork 19
switch Device
A switch
device exposes any switchable on/off device connected to a GPIO pin, like a relay, LED, or fan.
Homebridge RPi configures the GPIO pin for output.
Homebridge RPi configures pigpiod
to send real-time notifications when the GPIO state changes.
The device is exposed as a separate HomeKit accessory, with a Switch service. Through this service, you can control the GPIO output from HomeKit.
Set pulse
to make the switch behave like a (stateless) pulse switch, instead of a (stateful) rocker switch.
With this setting, the switch turns off automatically after being turned on.
If you want to turn off the connected device automatically after a longer set duration, use a valve
device or set duration
instead.
The switch
device uses the following config.json keys:
key | type | Description |
---|---|---|
name |
string | The name for the device in HomeKit. |
gpio |
integer | The GPIO pin. |
reversed |
boolean | The device state is reversed, i.e. set or report the switch as on when the GPIO state is low instead of high. |
pulse |
integer | The time (between 20ms and 5000ms) after which the switch is turned off automatically. |
duration |
boolean | Expose Default Duration on a the Switch service, to turn off the switch automatically after the specified time (between 0 and 7200 seconds). Note that Apple's Home app won't show this, and Eve won't allow you to reset the Default Duration to 0. |
Note that you can specify either pulse
or duration
, but not both.