Supports triggering General Purpose Input Output (GPIO) pins on platforms supporting the onoff package. It is based on homebridge-gpio, but using the onoff package instead of pi-gpio to be able to listen for changes in pin values.
- Homebridge - HomeKit support for the impatient
- gpio-admin - Reading and writing GPIO pins and listening for changes
- Install Homebridge using
npm install -g homebridge
- Install this plugin
npm install -g homebridge-gpio-onoff
- Update your configuration file
config.json, creating a switch accessory that the user can switch on and off, setting the GPIO pin value to '1' or '0', respectively:
accessory should be set to
GPIO-OnOff for this plugin.
name is the accessory's name, which is shown in HomeKit.
pin is the physical GPIO pin number.
direction can be set to either
in to read from the GPIO pin or
out to write to the pin. If set to
edge property can be set to
both to have a changing GPIO pin value trigger an accessory value change (it is set to
none by default).
By default, a simple 'Switch' accessory is created, which will be set to 'On' or 'Off' by a change in the input value. It is possible to change the service type and even the
false values. For example, to have it act like a light sensor, you can specify:
activeLow will treat '0' as the
true value and '1' as the
hapService can be set to one of the defined services in HomeKitTypes.js and
hapCharacteristic to one of the characteristics defined for the service.
If the characteristic values are not boolean, you can specify the values for
false by setting