Homebridge plugin + schematics to automate somfy shutters
GPL-3.0 License
This Homebridge plugin allows control of Raspberry Pi GPIO pins, more specifically to control a Somfy remote + schematics to wire the remote to the Raspberry Pi.
To install this plugin simple type sudo npm install homebridge-somfy -g --unsafe-perm=true
.
Next open the config.json that contains your Homebridge configuration and add a block like the following one to the accessories array:
{
"accessory": "HomebridgeSomfy",
"name": "display-name",
"pinup": "hardware pin number",
"pindown": "hardware pin number",
"movementduration": "average full up/down motion in seconds",
"pressduration": "duration of button press in milliseconds",
"delay": "the delay in seconds (can be 0 for the first plugin instance)",
"mqttbroker": "mqtt://broker-url:1883",
"mqttuser": "username",
"mqttpassword": "password",
"mqtttopicin": "/path/and/topic/in",
"mqtttopicout": "/path/and/topic/out"
}
The accessory name has to be HomebridgeSomfy
to link to the plugin.
The name
field is for the display name in the HomeKit app.
The pinup
and pindown
fields are your hardware pin numbers for shutters up/down.
The movementduration
field sets the duration (in seconds as a string) it takes for the shutters to fully open or close.
The pressduration
field sets the duration (in milliseconds as a string) the button on the remote is activated/pressed.
The delay
field is optional when only one instance of this plugin is used.
The mqttbroker
field is the broker url (including mqtt:// and port, default 1883) to connect to.
The mqttuser
field is the username used for the mqtt connection.
The mqttpassword
field is the password used for the mqtt connection.
The mqtttopicin
field contains the topic for controlling the shutters via mqtt, payload must be JSON with a field name target
being either up
or down
.
The mqtttopicout
field contains the topic for sending updates when the shutters are controlled, the messages have the retained flag set.
When using multiple instances of this plugin it is required to specify this field.
It contains the number of seconds that the plugin should wait before sending a signal to the remote.
The default state for the shutters in the HomeKit app is disabled, which means the shutters are raised. If the switch is active it means the shutters are lowered. The plugin only sends a short activation signal and keeps internal state of the shutters.
This code makes use of the node-rpio
library, more information here