Skip to content

Commit 48f0a94

Browse files
authored
[sprinkler] Update doc for removal of latching valve support (#5806)
* [sprinkler] Update doc for removal of latching valve support * lint
1 parent 0d92bc8 commit 48f0a94

File tree

1 file changed

+74
-130
lines changed

1 file changed

+74
-130
lines changed

content/components/sprinkler.md

Lines changed: 74 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,6 @@ examples that are ready for you to copy and paste!
139139
up from running the pump when no distribution valves are open or to allow the main line out to distribution
140140
valves to drain. May not be used with `pump_stop_pump_delay`.
141141

142-
- **pump_pulse_duration** (*Optional*, [Time](/guides/configuration-types#time)): The *minimum* length of the pulse generated to
143-
operate a pump in milliseconds. *Required* when one or more latching pumps is configured. Note that the *exact*
144-
length of the pulse is determined by the frequency of the main application loop (as are other `delay` timers
145-
used in ESPHome). Typically this is expected to provide a resolution of approximately 16 milliseconds, however
146-
this may vary somewhat depending on your exact configuration. Regardless, it should provide
147-
more-than-sufficient precision to operate any such valve.
148-
149-
- **valve_pulse_duration** (*Optional*, [Time](/guides/configuration-types#time)): The *minimum* length of the pulse generated to
150-
operate a valve in milliseconds. *Required* when one or more latching valves is configured. Note that the *exact*
151-
length of the pulse is determined by the frequency of the main application loop (as are other `delay` timers
152-
used in ESPHome). Typically this is expected to provide a resolution of approximately 16 milliseconds, however
153-
this may vary somewhat depending on your exact configuration. Regardless, it should provide more-than-sufficient
154-
precision to operate any such valve.
155-
156142
- **multiplier_number** (*Optional*, *string*): The name of the {{< docref "/components/number/index" "number" >}} component that
157143
should be presented to the front end (Home Assistant) to enable control of the sprinkler controller's `multiplier`
158144
value. See [Using the Sprinkler Controller's Numbers](#sprinkler-controller-sprinkler_controller_numbers) below for more detail.
@@ -189,23 +175,10 @@ examples that are ready for you to copy and paste!
189175
- **pump_switch_id** (*Optional*, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
190176
component to be used to control the valve's pump or upstream electric valve. Typically this would be a
191177
{{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay or other switching device which in turn would
192-
activate the respective pump/valve. *It is not recommended to expose this switch to the front end; please
193-
see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control) *below for more detail.*
194-
May not be specified with *pump_off_switch_id* or *pump_on_switch_id*.
195-
196-
- **pump_off_switch_id** (*Optional*, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
197-
component to be used to *turn off* the valve's pump or upstream electric *latching* valve. Typically this
198-
would be a {{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay or other switching device which in turn
199-
would *switch off* the respective pump/valve. *It is not recommended to expose this switch to the front end; please
200-
see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control) *below for more detail.*
201-
May not be specified with *pump_switch_id*.
202-
203-
- **pump_on_switch_id** (*Optional*, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
204-
component to be used to *turn on* the valve's pump or upstream electric *latching* valve. Typically this
205-
would be a {{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay or other switching device which in turn
206-
would *switch on* the respective pump/valve. *It is not recommended to expose this switch to the front end; please
207-
see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control) *below for more detail.*
208-
May not be specified with *pump_switch_id*.
178+
activate the respective pump/valve. For latching valves/pumps, use an {{< docref "switch/hbridge" "H-Bridge switch" >}}.
179+
*It is not recommended to expose this switch to the front end; please see*
180+
[An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control)
181+
*below for more detail.*
209182

210183
- **run_duration_number** (*Optional*, *string*): The name of the {{< docref "/components/number/index" "number" >}} component
211184
that should be presented to the front end (Home Assistant) to enable control of the valve's `run_duration` value.
@@ -222,71 +195,58 @@ examples that are ready for you to copy and paste!
222195
- **valve_switch_id** (**Required**, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
223196
component to be used to control the valve that operates the given section or zone of the sprinkler
224197
system. Typically this would be a {{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay
225-
or other switching device which in turn would activate the respective valve. *It is not recommended
226-
to expose this switch to the front end; please see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control)
227-
*below for more detail.* May not be specified with *valve_off_switch_id* or *valve_on_switch_id*.
228-
229-
- **valve_off_switch_id** (**Required**, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
230-
component to be used to *turn off* the *latching* valve that operates the given section or zone of the
231-
sprinkler system. Typically this would be a {{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay
232-
or other switching device which in turn would *switch off* the respective valve. *It is not recommended
233-
to expose this switch to the front end; please see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control)
234-
*below for more detail.* May not be specified with *valve_switch_id*.
235-
236-
- **valve_on_switch_id** (**Required**, [Switch](/components/switch#config-switch)): This is the [switch](/components/switch#config-switch)
237-
component to be used to *turn on* the *latching* valve that operates the given section or zone of the
238-
sprinkler system. Typically this would be a {{< docref "switch/gpio" "GPIO switch" >}} wired to control a relay
239-
or other switching device which in turn would *switch on* the respective valve. *It is not recommended
240-
to expose this switch to the front end; please see* [An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control)
241-
*below for more detail.* May not be specified with *valve_switch_id*.
198+
or other switching device which in turn would activate the respective valve. For latching valves, use an
199+
{{< docref "switch/hbridge" "H-Bridge switch" >}}. *It is not recommended to expose this switch to the front end; please see*
200+
[An Important Note about GPIO Switches and Control](#sprinkler-controller-an_important_note_about_gpio_switches_and_control)
201+
*below for more detail.*
242202

243203
{{< anchor "sprinkler-controller-an_important_note_about_gpio_switches_and_control" >}}
244204

245205
## An Important Note about GPIO Switches and Control
246206

247-
The savvy and/or seasoned ESPHome user will quickly realize that `pump_switch_id`, `pump_off_switch_id`,
248-
`pump_on_switch_id`, `valve_switch_id`, `valve_off_switch_id` and `valve_on_switch_id` (as described above)
249-
are really just pointers to other (GPIO) switches elsewhere in the ESPHome yaml configuration.
207+
The savvy and/or seasoned ESPHome user will quickly realize that `pump_switch_id` and `valve_switch_id` (as described
208+
above) are really just pointers to other switches elsewhere in the ESPHome yaml configuration.
250209

251-
It might seem reasonable to assume that these {{< docref "switch/gpio" "GPIO switches" >}} may be used to switch the various
252-
sprinkler zones on and off, however, this is **not** the case. It's important to note that the sprinkler controller
253-
provides a switch for each configured zone -- ultimately, this switch is to be used to switch any given zone on or
254-
off, **not** the {{< docref "switch/gpio" "GPIO switch" >}} the zone is configured with.
210+
It might seem reasonable to assume that these switches (typically {{< docref "switch/gpio" "GPIO switches" >}} or
211+
{{< docref "switch/hbridge" "H-Bridge switches" >}}) may be used to switch the various sprinkler zones on and off,
212+
however, this is **not** the case. It's important to note that the sprinkler controller provides a switch for each
213+
configured zone -- ultimately, this switch is to be used to switch any given zone on or off, **not** the underlying
214+
switch the zone is configured with.
255215

256-
Keep in mind that a {{< docref "switch/gpio" "GPIO switch" >}} directly controls the state of the GPIO pin it is associated
257-
with. While it's technically feasible to "override" this behavior, it might not always be desirable. For example,
258-
if you *wanted* to control the state of the switch/pin manually during testing of your system/configuration, this
259-
would make doing so impossible (or at least more difficult than necessary), presenting other complications. Ultimately,
260-
flexibility is key, as we've learned from any number of conversations on the ESPHome Discord server.
216+
Keep in mind that a switch directly controls its associated hardware (GPIO pins, H-Bridge circuits, etc.). While it's
217+
technically feasible to "override" this behavior, it might not always be desirable. For example, if you *wanted* to
218+
control the state of the switch manually during testing of your system/configuration, this would make doing so impossible
219+
(or at least more difficult than necessary), presenting other complications. Ultimately, flexibility is key, as we've
220+
learned from any number of conversations on the ESPHome Discord server.
261221

262-
As mentioned in the introduction, the sprinkler controller automates control of the {{< docref "switch/gpio" "GPIO switches" >}}
263-
you provide it with -- it does not "override" control of these switches or alter how they behave beyond simply
264-
switching them on or off as required based on the configured scheduling.
222+
As mentioned in the introduction, the sprinkler controller automates control of the switches you provide it with -- it
223+
does not "override" control of these switches or alter how they behave beyond simply switching them on or off as
224+
required based on the configured scheduling.
265225

266-
So why not just use the {{< docref "switch/gpio" "GPIO switch" >}} to control the various sprinkler zones directly? As it relates
226+
So why not just use the underlying switches to control the various sprinkler zones directly? As it relates
267227
to the sprinkler controller itself, the primary reason relates to *state* -- that is, we need to be able to ensure
268-
that the {{< docref "switch/gpio" "GPIO switch" >}} state(s) are kept consistent with the configuration of the sprinkler
269-
controller. While it's less important for systems that simply consist of one valve per zone, it becomes very important
270-
for systems with some additional complexity. Consider the example of a system with a pump and multiple distribution
271-
valves attached to said pump; the controller in this case is configured to switch the pump off three seconds *before*
272-
switching off any given distribution valve. If you suddenly manually switch off a {{< docref "switch/gpio" "GPIO switch" >}}
273-
connected to one of these distribution valves, what happens to the pump? What should the sprinkler controller do? Should
274-
it switch the distribution valve back on?...or maybe just switch the pump off, too? In either case, based on its
275-
configuration, the pump was supposed be shut down before the valve, but you just went and turned off the valve. The pump
276-
could be damaged. There are many other similar situations such as this that may occur, the simplest of which is little
277-
more than ensuring that any given valve is switched off after *some* duration and does not remain on/open perpetually.
228+
that the switch state(s) are kept consistent with the configuration of the sprinkler controller. While it's less
229+
important for systems that simply consist of one valve per zone, it becomes very important for systems with some
230+
additional complexity. Consider the example of a system with a pump and multiple distribution valves attached to
231+
said pump; the controller in this case is configured to switch the pump off three seconds *before* switching off
232+
any given distribution valve. If you suddenly manually switch off an underlying switch connected to one of these
233+
distribution valves, what happens to the pump? What should the sprinkler controller do? Should it switch the
234+
distribution valve back on?...or maybe just switch the pump off, too? In either case, based on its configuration,
235+
the pump was supposed be shut down before the valve, but you just went and turned off the valve. The pump could be
236+
damaged. There are many other similar situations such as this that may occur, the simplest of which is little more
237+
than ensuring that any given valve is switched off after *some* duration and does not remain on/open perpetually.
278238

279239
In summary, to ensure that your sprinkler controller consistently operates as expected:
280240

281241
- Only use the switches provided by the sprinkler controller component to switch any given sprinkler zone on or off.
282-
- Do not use the {{< docref "switch/gpio" "GPIO switches" >}} you have in your configuration to control sprinkler zones/valves
283-
outside of initial testing of your device configuration.
242+
- Do not use the underlying switches (GPIO, H-Bridge, etc.) you have in your configuration to control sprinkler
243+
zones/valves outside of initial testing of your device configuration.
284244

285-
- To help prevent accidents, it's probably best if the {{< docref "switch/gpio" "GPIO switches" >}} for each sprinkler zone are
286-
**not** exposed to the front end. This can be accomplished in two ways:
245+
- To help prevent accidents, it's probably best if the underlying switches for each sprinkler zone are **not** exposed
246+
to the front end. This can be accomplished in two ways:
287247

288-
- Do not provide a `name:` parameter to your {{< docref "switch/gpio" "GPIO switches" >}}, or
289-
- Add `internal: true` to each of your {{< docref "switch/gpio" "GPIO switch" >}} configurations
248+
- Do not provide a `name:` parameter to your switches, or
249+
- Add `internal: true` to each of your switch configurations
290250

291251
These simple configuration tweaks will help prevent any number of errors (human, automation, or otherwise) and may help
292252
to avert disaster!
@@ -646,7 +606,7 @@ esphome:
646606
name: esp-sprinkler-controller
647607
648608
esp32:
649-
board: featheresp32
609+
board: esp32dev
650610
651611
wifi:
652612
ssid: "wifi_ssid"
@@ -676,7 +636,7 @@ esphome:
676636
name: esp-sprinkler-controller
677637
678638
esp32:
679-
board: featheresp32
639+
board: esp32dev
680640
681641
wifi:
682642
ssid: "wifi_ssid"
@@ -727,7 +687,7 @@ esphome:
727687
name: esp-sprinkler-controller
728688
729689
esp32:
730-
board: featheresp32
690+
board: esp32dev
731691
732692
wifi:
733693
ssid: "wifi_ssid"
@@ -776,11 +736,8 @@ switch:
776736
### Single Controller, Three Latching Valves, Single Latching Pump
777737

778738
This example is similar to the previous example, however it illustrates how a "latching" or "pulsed"
779-
valve can be configured. This type of valve requires two {{< docref "switch/gpio" "GPIO switches" >}} to
780-
operate -- one to switch the valve on and one to switch the valve off. To switch on the valve, the
781-
"on" {{< docref "switch/gpio" "GPIO switch" >}} is switched on for the configured duration and then switched
782-
off. To switch the valve off, the "off" {{< docref "switch/gpio" "GPIO switch" >}} is switched on for the
783-
configured duration and then switched off.
739+
valve can be configured using {{< docref "switch/hbridge" "H-Bridge switches" >}}. This type of valve
740+
requires two GPIO pins to operate -- one to switch the valve on and another to switch the valve off.
784741

785742
Note that, while this example illustrates a configuration that uses exclusively latching valves,
786743
latching and non-latching valves may be mixed and matched in any configuration, even if attached to
@@ -791,7 +748,7 @@ esphome:
791748
name: esp-sprinkler-controller
792749
793750
esp32:
794-
board: featheresp32
751+
board: esp32dev
795752
796753
wifi:
797754
ssid: "wifi_ssid"
@@ -805,57 +762,45 @@ sprinkler:
805762
auto_advance_switch: "Lawn Sprinklers Auto Advance"
806763
queue_enable_switch: "Lawn Sprinklers Queue Enable"
807764
reverse_switch: "Lawn Sprinklers Reverse"
808-
pump_pulse_duration: 250ms
809-
valve_pulse_duration: 250ms
810765
valve_open_delay: 5s
811766
valves:
812767
- valve_switch: "Front Lawn"
813768
enable_switch: "Enable Front Lawn"
814-
pump_off_switch_id: sprinkler_pump_sw_off
815-
pump_on_switch_id: sprinkler_pump_sw_on
769+
pump_switch_id: sprinkler_pump_sw
816770
run_duration: 900s
817-
valve_off_switch_id: lawn_sprinkler_valve_sw0_off
818-
valve_on_switch_id: lawn_sprinkler_valve_sw0_on
771+
valve_switch_id: lawn_sprinkler_valve_sw0
819772
- valve_switch: "Side Lawn"
820773
enable_switch: "Enable Side Lawn"
821-
pump_off_switch_id: sprinkler_pump_sw_off
822-
pump_on_switch_id: sprinkler_pump_sw_on
774+
pump_switch_id: sprinkler_pump_sw
823775
run_duration: 900s
824-
valve_off_switch_id: lawn_sprinkler_valve_sw1_off
825-
valve_on_switch_id: lawn_sprinkler_valve_sw1_on
776+
valve_switch_id: lawn_sprinkler_valve_sw1
826777
- valve_switch: "Back Lawn"
827778
enable_switch: "Enable Back Lawn"
828-
pump_off_switch_id: sprinkler_pump_sw_off
829-
pump_on_switch_id: sprinkler_pump_sw_on
779+
pump_switch_id: sprinkler_pump_sw
830780
run_duration: 900s
831-
valve_off_switch_id: lawn_sprinkler_valve_sw2_off
832-
valve_on_switch_id: lawn_sprinkler_valve_sw2_on
781+
valve_switch_id: lawn_sprinkler_valve_sw2
833782
834783
switch:
835-
- platform: gpio
836-
id: sprinkler_pump_sw_off
837-
pin: GPIOXX
838-
- platform: gpio
839-
id: sprinkler_pump_sw_on
840-
pin: GPIOXX
841-
- platform: gpio
842-
id: lawn_sprinkler_valve_sw0_off
843-
pin: GPIOXX
844-
- platform: gpio
845-
id: lawn_sprinkler_valve_sw0_on
846-
pin: GPIOXX
847-
- platform: gpio
848-
id: lawn_sprinkler_valve_sw1_off
849-
pin: GPIOXX
850-
- platform: gpio
851-
id: lawn_sprinkler_valve_sw1_on
852-
pin: GPIOXX
853-
- platform: gpio
854-
id: lawn_sprinkler_valve_sw2_off
855-
pin: GPIOXX
856-
- platform: gpio
857-
id: lawn_sprinkler_valve_sw2_on
858-
pin: GPIOXX
784+
- platform: hbridge
785+
id: sprinkler_pump_sw
786+
on_pin: GPIOXX
787+
off_pin: GPIOXX
788+
pulse_length: 250ms
789+
- platform: hbridge
790+
id: lawn_sprinkler_valve_sw0
791+
on_pin: GPIOXX
792+
off_pin: GPIOXX
793+
pulse_length: 250ms
794+
- platform: hbridge
795+
id: lawn_sprinkler_valve_sw1
796+
on_pin: GPIOXX
797+
off_pin: GPIOXX
798+
pulse_length: 250ms
799+
- platform: hbridge
800+
id: lawn_sprinkler_valve_sw2
801+
on_pin: GPIOXX
802+
off_pin: GPIOXX
803+
pulse_length: 250ms
859804
```
860805

861806
### Dual Controller, Five Valves, Two Pumps
@@ -869,7 +814,7 @@ esphome:
869814
name: esp-sprinkler-controller
870815
871816
esp32:
872-
board: featheresp32
817+
board: esp32dev
873818
874819
wifi:
875820
ssid: "wifi_ssid"
@@ -1025,8 +970,7 @@ sprinkler:
1025970
```
1026971

1027972
This arrangement is possible for any other switch within the sprinkler controller's configuration block, with
1028-
the exception of `pump_off_switch_id`, `pump_on_switch_id`, `pump_switch_id`, `valve_off_switch_id`,
1029-
`valve_on_switch_id` and `valve_switch_id` (because these are the IDs of other switch components already
973+
the exception of `pump_switch_id` and `valve_switch_id` (because these are the IDs of other switch components already
1030974
defined elsewhere in your configuration). In addition, specifying each switch ID enables the ability to refer
1031975
to any of the sprinkler controller's switches from elsewhere in your configuration. Here's another brief example:
1032976

0 commit comments

Comments
 (0)