homebridge-gpio-wpi2 icon indicating copy to clipboard operation
homebridge-gpio-wpi2 copied to clipboard

Feature Request RelayBoard

Open MarWind opened this issue 7 years ago • 5 comments

For special use cases it would be very helpful to have an config option "relayboard". In this special case the constructor should not initialize the gpio pin instead set the defined high/low bit.

e.g. Door Opener build with relayboard. If the Pi gets down / powerless / reboots the gpios always sets the first state and the door opens uncontrollable.

If there is an other option for scenarios like that - please excuse and close my request.

Thanks a lot, Greez Markus

in python it should work like that, but i'm not sure if WiringPi supports it. GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) … … GPIO.output(RELAIS_1_GPIO, GPIO.LOW)

MarWind avatar May 05 '17 09:05 MarWind

It would have to set a state - rather than just not initialise the pin - to ensure that HomeKit remains in sync with the GPIO state.

I think there are a couple of options...

A persistentState (that remembers the last state the pin was in by saving to the accessory cache) - so at reboot, you get back what was last set. I think this has been asked for before!

An initialState (that forces an initial state - e.g. Low or High)

These two new config options would also need to be mutually exclusive; it doesn't seem to make sense to able to set both at once!

Does that make sense and sound like what you need?

rsg98 avatar May 05 '17 10:05 rsg98

They booth could be an option. But I can not really say if it will work with force after initialize. I will do some further testing the relayboard with WPI instead of python (without running the homebridge service).

You are right, booth at the same time are not really good, but a initial state if there was no persistent state before may be under special circumstances a nice feature.

MarWind avatar May 05 '17 11:05 MarWind

Same issue here. If you need anyone to test I can help out.

greberg avatar May 11 '17 09:05 greberg

There is a possible hardware solution, just use 2 relays - set them in series circuit. Now to switch two of the gpios needed. In ios you can put 2 gpio switches into one scene.

MarWind avatar May 11 '17 15:05 MarWind

Hi, looking around i found the way. it's not documented on Gordon website but you could set mode to "high" instead of "out" and pin will be set up with high value that in my case means relay (of relay board) switched off (i also set "inverted" for the same reason). shell command is "gpio export x high". so the trick could be just handle "high" value in "mode" parameter in config file. ****i'm trying to mod source code to handle this new value. let you know
Edit: i changed code and is attached here. test it and let me know if it works for you as well usage: in config file, under gpiopins set prop "mode": "high" wpi2_modRelays.zip

pumamood avatar Jun 25 '17 20:06 pumamood