Contact sensor GPIO input plugin for Homebridge
- Install Homebridge using
npm install -g homebridge
- Install this plugin
npm install -g homebridge-contactsensor
- Install the RPi.GPIO library and Python (sorry) (included in e.g. Raspbian by default)
- Update your configuration file - see below for an example
Example of connecting three contact sensors to GPIO:
Currently the inputs are assumed to be normally-closed to ground, floating when pressed (internal pull-up resistor enabled). That is, the contact sensor will "closed" when 0, and "open" (as in, the door or whatever is open, not necessarily the electronics) when 1. TODO: configurable active-low/high
name: descriptive name
pins: object of names to GPIO physical pins
Creates a ContactSensor service for each pin.
What use are contact sensors? You can control other devices when they are opened or closed. For example, you could automatically turn on a light when you open your door.