Hello folks!
My irrigation project for my home shall have 6 irrigation lines with a configurable irrigation time in the morning and in the evening for each line. Configuration shall be done via the web interface of Home Assistant. The automation part will be located in the ESP 32 Module.
The switch_on of the irrigation lines will be handled by a YAML Script. It is very basic:
- switch on
- delay (-> wait for a configurable time)
- switch off
What I can not figure out is how to give the parameter for the delay function.
The definition of my script with parameters is:
script:
- id: script_turns_relais_on
mode: parallel
parameters:
channel_index: int
channelname: string
currentdelaysec: float
The delay time is currentdelaysec. and defined as float. When setting the time to the delay something goes wrong:
- delay:
seconds: lambda |-
'return {currentdelaysec)}; '
ESPHome tells me that a float is expected and does not compile. In some post it is advised to assign the time directly to the delay. This throws the error that a time periode with unit is expected. I tried according to several posts global variables, sensor values (normaly float!) and much more - no valid code, no success.
The documentation gives the following advice (see Automations and Templates — ESPHome) and does not compile:
script:
- id: blink_light
parameters:
delay_ms: int
then:
- light.turn_on: status_light
# The param delay_ms is accessible using a lambda
- delay: !lambda return delay_ms;
- light.turn_off: status_light
Has anyone solved this issue? Or do I have to program timers, that bypass ESPHome?