Have been struggling with this problem for days and no matter what I try I am unable to get there. I have a home assistant input number that I’d like to use in delay functions. But it requires a either a float or a string where I’d like to use an integer.
I want to use it to set the delay time in minutes.
I obtain the value from home assistant as follows:
sensor: - platform: homeassistant id: max_run_time_minutes name: "Max Run Time - All Zones" entity_id: input_number.irrigation_max_duration
I want to use it with the delay function of this block:
switch: - platform: template name: $friendly_name $zone_4 icon: $sprinkler_icon id: zone_4 lambda: return id(relay_4).state; optimistic: true turn_on_action: - switch.turn_on: relay_4 - delay: minutes: max_run_time_minutes # - delay: # minutes: float_max_run_time_minutes # - delay: $max_run_time # - delay: !lambda "return id(max_run_time_minutes) & 'min';" - switch.turn_off: relay_4 turn_off_action: - switch.turn_off: relay_4
ESP Home complains that minutes expects a float. I tried to set up a global float but that doesn’t work either.
I have managed to use a substitution to set the delay time:
substitutions: # Set Max Run Time Here: =============================# max_run_time: "10min" # Sets delay between switch turn on and switch turn off #======================================================#
But I can’t figure out how to get that back to home assistant.
Tried this without success:
text_sensor: - platform: template name: "Irrigation Max Run" id: str_delay_setting lambda: |- return $max_run_time
I would like to set an initial value within ESPHome and update it with a home assistant value, or at least return that setting to home assistant.
Can anyone point me in the right direction. Just can’t seem to figure it out. Any help would be appreciated. Thanks for reading.