feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Interlock for all switches

Open fra87 opened this issue 2 years ago • 1 comments

Describe the problem you have/What new integration you would like

The interlock feature is useful, but it is not something that shall be limited to the GPIO platform only (so different switches can be synchronized). From the code point of view, I think the best is to move the interlock feature in the Switch class.

Please describe your use case for this integration and alternatives you've tried:

I have four relays connected to four GPIOs. For better understanding I wanted to add another level of abstraction, so I wrote

output:
  - platform: gpio
    pin: D5
    id: relay_ch1
switch:
  - platform: output
    name: "My output 1"
    output: 'relay_ch1'

This, however, does not allow the interlock feature to be used. Consequently I had to modify my configuration in:

switch:
  - platform: gpio
    pin: D5 # relay_ch1
    name: "My output 1"

This is, in my opinion, less clear (and does not allow to interlock different types of switches)

Additional context

I don't know if this is actually feasible for all types of Switches, so I don't know if it can be directly included in the Switch base class.

fra87 avatar Apr 25 '22 12:04 fra87

I would love to see this implemented on the Switch level, not only limited to GPIO type switches as it is now, so it could be used, for example, with switches created based on Arduino Port Extender outputs using generic output or template switches.

kluszczyn avatar Jul 31 '22 08:07 kluszczyn