-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hello. I have a project that I have completed with your accessory plugin, but there is a problem with my solution which is after boot, homebridge starts and during the “Exporting and configuring GPIO” and “Exporting GPIO pins from config file” section of the homebridge boot, it activates the pins.
I have the pins crossing a switch so they take the action of a button press on a remote fob. So I have three pins and a ground. I place the pins in mode “out” and pull “down” with the action inverted for a set duration.
Once the homebridge has booted, all is fine, and homebridge can be closed and restarted without causing an issue. All switches work through HomeKit as they should, but my problem is that if the pi reboots due to power failure or scheduled reboot, it will activate the pins on startup again.
At first I added GPIO commands before the homebridge opens so that I can set the pin state for pins 23-25 (13, 19, 26 WiringPi) to OUT and to have a state of 1. I can check this manually and this should set them to the correct format required to be in an “off” state.
This hasn’t made any difference and again when homebridge starts for true first time, the pins are activated before going back to the pin state above and working normally.
I’m not sure what I am missing, but it just means I cannot guarantee that this is in a fail safe state for use.
My code looks like this in the homebridge config:
{
"platform" : "WiringPiPlatform",
"name" : "Pi GPIO (WiringPi)",
"overrideCache" : "true",
"autoExport" : "true",
"gpiopins" : [{
"name" : "GPIO2",
"pin" : 13,
"enabled" : "true",
"mode" : "out",
"pull" : "down",
"inverted" : "true",
"duration" : 2000
},{
"name" : "GPIO3",
"pin" : 19,
"enabled" : "true",
"mode" : "out",
"pull" : "down",
"inverted" : "true",
"duration" : 2000
},{
"name" : "GPIO4",
"pin" : 26,
"enabled" : "true",
"mode" : "out",
"pull" : "down",
"inverted" : "true",
"duration" : 2000
}]
}
This is the GPIO mode and state change before homebridge starts:
/usr/bin/gpio mode 23 out
/usr/bin/gpio mode 24 out
/usr/bin/gpio mode 25 out
/usr/bin/gpio write 25 1
/usr/bin/gpio write 24 1
/usr/bin/gpio write 23 1
sleep 5
/usr/bin/homebridge &
