With this plugin, you can create switches that will control Piface outputs.
This fork is adapted from homebridge-dummy.
Example config.json:
"accessories": [
{
"accessory": "PifaceSwitch",
"output": 0,
"name": "My Switch"
}
]
On a fresh installation you should enable SPI.
Therefore start raspi-config
-> Interface Options
-> SPI
-> Yes
.
Reboot the RPi.
git clone https://github.com/piface/libmcp23s17.git
cd libmcp23s17/
make
sudo make install
cd ..
git clone https://github.com/piface/libpifacedigital.git
cd libpifacedigital/
make
sudo make install
cd ..
Use Homebridge web UI or
hb-service add homebrige-switch-piface
The default behavior of a switch is to turn itself off one second after being turned on. However you may want to create a switch that remains on and must be manually turned off. You can do this by passing an argument in your config.json:
"accessories": [
{
"accessory": "PifaceSwitch",
"output": 0,
"name": "My Stateful Switch",
"stateful": true
}
]
You may also want to create a switch that turns itself on one second after being turned off. This can be done by passing the 'reverse' argument in your config.json:
"accessories": [
{
"accessory": "PifaceSwitch",
"output": 0,
"name": "My Reverse Switch",
"reverse": true
}
]
You may also want to create a timed switch that turns itself off after being on for a given time (for example, five seconds). This can be done by passing the 'time' argument in your config.json:
"accessories": [
{
"accessory": "PifaceSwitch",
"output": 0,
"name": "My Timed Switch",
"time": 5000
}
]
You may also want to create a timed switch that is reset each time it is activated. This way, the original timer is reset instead of creating a new timer. This can be done by passing the 'resettable' argument in your config.json:
"accessories": [
{
"accessory": "PifaceSwitch",
"output": 0,
"name": "My Stateful Switch",
"time": 5000,
"resettable": true
}
]