HA-Irrigation-Version2 icon indicating copy to clipboard operation
HA-Irrigation-Version2 copied to clipboard

Feature Request - General valve switch added

Open tizianojeje opened this issue 3 years ago • 7 comments

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

tizianojeje avatar Apr 06 '21 16:04 tizianojeje

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.

kloggy avatar Apr 08 '21 21:04 kloggy

Hi , yes I mean this Thx Tiziano

tizianojeje avatar Apr 09 '21 05:04 tizianojeje

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. :)

genestealer avatar Apr 16 '21 21:04 genestealer

HI

tizianojeje avatar Nov 04 '21 17:11 tizianojeje

HI Could I have more information about it? Thx Tiziano

tizianojeje avatar Nov 04 '21 17:11 tizianojeje

@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 avatar Apr 18 '22 16:04 genestealer

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

genestealer avatar Apr 18 '22 16:04 genestealer