smartechru / homebridge-relays

This Homebridge plugin controls 4 relays through Apple Home App.
MIT License
16 stars 13 forks source link

Add support for Switch input_pin #11

Open brancooo1 opened 2 years ago

brancooo1 commented 2 years ago

First of all, thanks for your work on this library. I've searched the history for a solution to this problem, so I'm writing a new request.

There are cases where devices are switched on and off by pulse and on another pin you monitor the status of the device. This is also the case for standard installation pulse relays. A switch on the wall creates a pulse that changes the state of the pulse relay.

I think the solution would be an optional parameter inputPin, which if filled would serve as a mirroring for the switch state. Now obsolete homebridge-gpio-device library had a very similar approach, notice the configuration.

With debouncing it can work very nicely, for example with a configuration like this. What do you think about it, thanks for your opinion.

{
    "accessory": "Relay",
    "name": "Kitchen Light",
    "pin": 5,
    "invert": true,
    "intial_state": 0,
    "timeout_ms": 500,
    "input_pin": 6,
}
Screenshot 2022-08-28 at 10 04 26