kloggy / HA-Irrigation-Version2

225 stars 55 forks source link

Feature Request - General valve switch added #36

Open tizianojeje opened 3 years ago

tizianojeje commented 3 years ago

hi meanwhile, congratulations for the product, I need to add a switch for a general solenoid valve upstream of the irrigations thx Tiziano

kloggy commented 3 years ago

Way back when I first wrote this I also had a Sonoff as a master switch. Is that what you mean?

I removed it before I released the code (I think) because I decided I had enough failsafe controls without the need for it.

tizianojeje commented 3 years ago

Hi , yes I mean this Thx Tiziano

genestealer commented 3 years ago

hi meanwhile, congratulations for the product, I need to add a switch for a general solenoid valve upstream of the irrigations thx Tiziano

You could simply add a separate automation, triggered by the state-change of the downstream valves. :)

tizianojeje commented 2 years ago

HI

tizianojeje commented 2 years ago

HI Could I have more information about it? Thx Tiziano

genestealer commented 2 years ago

@tizianojeje Actually having a think about it, I would suggest you create a templated switch consisting of all of the different switches (valves) you wish to control in one action. (A bit like having multiple lights controlled by one switch, even though each one is individually controllable).

Then you control the 1 templated switch from Kloggy's code, which would then activate as many valves simultaneously as you need.

This way, no changes are required to Kloggy's code.

E.G.

switch:
  - platform: template
    switches:
      valve1:
        turn_on:
          - service: switch.turn_on
            target:
              entity_id: switch.valve1_downstream
          - service: light.turn_on
            target:
              entity_id: switch.valve1_upstream
        turn_off:
          - service: switch.turn_off
            target:
              entity_id: switch.valve1_downstream
          - service: light.turn_ff
            target:
              entity_id: switch.valve1_upstream
      valve2:
        turn_on:
          - service: switch.turn_on
            target:
              entity_id: switch.valve2_downstream
          - service: light.turn_on
            target:
              entity_id: switch.valve2_upstream
        turn_off:
          - service: switch.turn_off
            target:
              entity_id: switch.valve2_downstream
          - service: light.turn_ff
            target:
              entity_id: switch.valve2_upstream
genestealer commented 2 years ago

@kloggy, may recommend closing this as resolved? Perhaps adding it to a Q&A if you have one?