Actuators and sensors for the Raspberry Pi GPIO pins. This plugin uses the node.js module onoff.
You can load the plugin by editing your config.json
to include:
{
"plugin": "gpio"
}
in the plugins
Array.
Devices can be added by adding them to the devices
Array in the config file.
Set the class
property to GpioSwitch
, GpioPresence
, or GpioContact
, respectively. By default,
the device state will be true
, i.e. on, opened, or present, when the GPIO pin is HIGH. If you need
the device to be active on LOW, set the property inverted
to true
.
The GpioSwitch
device additionally provides the optional defaultState
property which can be used to set the
initial switch state to the given value. If the property is not present the last state will be recovered from
database or it will be set to false
if the last state cannot be obtained.
For device configuration options see the device-config-schema file.
Use the GPIO numbers from the RPi Low-level peripherals wiki page.
On Raspberry Pi, most GPIOs have either their pull-up or pull-down resistor activated by default. For further details, see Configuring pull-up and pull-down resistors.
{
"id": "led-light",
"class": "GpioSwitch",
"name": "led light",
"gpio": 17,
"inverted": true,
"defaultState": false
}
{
"id": "presence-sensor",
"class": "GpioPresence",
"name": "motion detector",
"gpio": 18
}
{
"id": "contact-sensor",
"class": "GpioContact",
"name": "contact detector",
"debounceTimeout": 50,
"gpio": 18
}