homebridge-contactsensor
Contact sensor GPIO input plugin for Homebridge
Installation
- 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
Wiring diagram
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
Configuration
accessory
: "ContactSensor"name
: descriptive namepins
: object of names to GPIO physical pins
Example configuration:
"accessories":
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.
See also
- homebridge-gpio-cmd etc. for GPIO outputs
- homebridge-pwm-fan
License
MIT