Add rights to homebridge user if running homebridge as systemd service: sudo usermod -a -G gpio homebridge
Install this plugin using: sudo npm install -g homebridge-gpio-device --unsafe-perm
Update your configuration file. See bellow for a sample.
Wiring
Any inputs are configured with pull-up resistor and considered as active on low state.
Sensors must be plug as following
GND <---> SENSOR <---> PIN
Sensors are considered as Normally Opened by default. If using Normally Closed sensor, you can use inverted or invertedInputs parameters as explained in the next section.
Pull-up resistors can be disabled by adding parameter "pullUp": false in any accessory using inputs. If disabled, you'll have to wire pull-up or pull-down resistors by yourself.
Note
In the section bellow, LOW state means sensor contact closed. HIGH state means sensor contact opened.
For outputs, LOW state means 0V and HIGH state means 3.3V.
ContactSensor, MotionSensor, LeakSensor, SmokeSensor, CarbonDioxideSensor and CarbonMonoxideSensor types monitor a GPIO input and report it as HomeKit Sensor.
Configuration
Parameter
Type
Default
Note
pin
Integer
N/A
mandatory, input pin number to monitor (LOW: sensor triggered, HIGH: sensor not triggered)
inverted
Boolean
false
optional, reverse the behaviour of the GPIO input pin (HIGH: sensor triggered, LOW: sensor not triggered)
postpone
Integer
100
optional, delay (ms) between 2 state change to avoid bouncing
MotionSensor additional parameters
MotionSensor has optional OccupancySensor wich can be configured with a timeout.
Could be used with this PIR Sensor.
Parameter
Type
Default
Note
occupancy
{}
null
optional, activate an occupancy sensor with a timeout after motion detection
occupancy.name
String
N/A
mandatory, occupancy sensor name
occupancy.timeout
Integer (sec)
60
optional, ocupancy timeout in sec after motion detection
DigitalOutput
Switch, Lightbulb, Outlet, Fan, Fanv2 and Valve operates a GPIO output as ON/OFF.
Configuration
Parameter
Type
Default
Note
pin
Integer
N/A
mandatory, output pin number to trigger (on: HIGH, off: LOW)
inverted
Boolean
false
optional, reverse the behaviour of the GPIO output pin (on: LOW, off: HIGH)
initState
0/1
0
optional, default state of the switch at startup (0: off, 1: on)
duration
Integer
0
optional, duration before restoring output state (0: disabled)
inputPin
Integer
N/A
optional, input pin number used as mirroring. (LOW: switch to on, HIGH: switch to off)
Valve optional configuration
Parameter
Type
Default
Note
subType
String
"generic"
optional, valve widget subtype like "irrigation", "shower" or "faucet"
inputPin
Integer
N/A
optional, input pin number used as "InUse" characteristic for Valve widget. (LOW: in use, HIGH: not in use)
ProgrammableSwitch
StatelessProgrammableSwitch or Doorbell types monitor a GPIO input and reports it as HomeKit Stateless Programmable Switch.
Configuration
Parameter
Type
Default
Note
pin
Integer
N/A
mandatory, input pin number to monitor (LOW: button pressed, HIGH: button released)
inverted
Boolean
false
optional, reverse the behaviour of the GPIO output pin (HIGH: button pressed, LOW: button released)
shortPress
Integer
500
optional, delay (ms) of a short press (double press will be detected if done in this delay)
longPress
Integer
2000
optional, delay (ms) of a long press
postpone
Integer
100
optional, delay (ms) between 2 state change to avoid bouncing
PositionOpener
Window, WindowCovering or Door controls 2 GPIO outputs plugged to a remote control.
When operating, the GPIO is turned on for 200ms to simulate a button pression on the remote control.
Configuration
Parameter
Type
Default
Note
pins
Integer[2]
N/A
mandatory, output pins numbers to trigger (pins[0]: open, pins[1]: close)
inverted
Boolean
false
optional, reverse the behaviour of the GPIO output pin(s) (pulse becomes HIGH->LOW->HIGH)
initPosition
Integer (%)
0
optional, default shutter position at homebridge startup to compensate absence of state feedback, recommanded to ensure open/close scenarios after unexptected restart: 99%
shiftDuration
Integer (sec)
20
optional, duration of a shift (close->open or open->close) used to compute intermediate position
pulseDuration
Integer
200
optional, duration of the pin pulse. (0: deactivate, pin active during all shifting)
invertStopPin
Boolean
false
optional, utilize the opposite pin to stop the shutter
openSensorPin
Integer
N/A
optional, input pin number for open sensor (LOW: opened position)
closeSensorPin
Integer
N/A
optional, input pin number for close sensor (LOW: closed position)
invertedInputs
Boolean
false
optional, reverse the behaviour of the GPIO input pins (detect opened/closed on HIGH state)
GarageDoorOpener
GarageDoorOpener controls 1 or 2 GPIO output(s) plugged to a garage door engine.
When operating, the GPIO is turned on for 200ms.
Configuration
Parameter
Type
Default
Note
pin
Integer
N/A
optional, output pin number for toggle opener (first pulse: open, second pulse: close)
optional, reverse the behaviour of the GPIO output pin(s) (pulse becomes HIGH->LOW->HIGH)
openingDuration
Integer
10
optional, opening duration of the door (seconds). Emulate transition if openSensorPin not provided.
closingDuration
Integer
10
optional, closing duration of the door (seconds). Emulate transition if closeSensorPin not provided.
waitingDuration
Integer
N/A
optional, waiting duration of the door shift before closing (seconds). If setted, emulate a cyclic door if openSensorPin not provided.
pulseDuration
Integer
200
optional, duration of the pin pulse.
openSensorPin
Integer
N/A
optional, input pin number for open sensor (LOW: opened position)
closeSensorPin
Integer
N/A
optional, input pin number for close sensor (LOW: closed position)
invertedInputs
Boolean
false
optional, reverse the behaviour of the GPIO input pins (detect opened/closed on HIGH state)
LockMechanism
LockMechanism operate a GPIO outputs plugged to an electric latch.
When operating, the latch is unlocked for duration seconds (or indefinitely if duration=0)
Configuration
Parameter
Type
Default
Note
pin
Integer
N/A
mandatory, output pin number to trigger (lock: LOW, unlock: HIGH)
duration
Integer (sec)
0
optional, duration before restoring locked state (0 : disabled)
inverted
Boolean
false
optional, reverse the behaviour of the GPIO output pin (lock: HIGH, unlock: LOW)
inputPin
Integer
N/A
optional, input pin number for lock sensor (LOW: unlocked, HIGH: locked)
请发表评论