How to pass a variable from Home Assistant front end to ESPHome?

Referencing input_number from ESPHome without an intermediary sensor in HA worked for me:

Here’s a snipped from my ESPHome yaml:

    name: "Pump off minutes input"
    id: pump_off_minutes_input
    internal: true
    accuracy_decimals: 0
    entity_id: input_number.pump_off_minutes

Using ESPHome 1.16.0

1 Like

/Updates: In the end I implemented with a timer inside ESPHome and works as expected. Even so, I don’t understand why lambda does not work with the delay.

I have the below implementation, and after a few runs, the switch stuck with ON state. Any ideas what I am doing wrong?
For small values (1-5s works as expected), but when I multiple with 60000 to have minutes it beginnings to not work anymore as expected.

switch:
  - platform: gpio
    pin: D1
    inverted: yes
    restore_mode: ALWAYS_OFF
    id: vegiesdown
    
  - platform: template
    name: "Vegies Down"
    optimistic: True
    id: vegiesdowntemplate
    turn_on_action:
      - switch.turn_on: vegiesdown
      - delay: !lambda "return id(garden_water_vegiesdown_duration_sensor).state * 60000;"
      - switch.turn_off: vegiesdown