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

Just give your home assistant sensors an ID, e.g. for your drum wash timer

sensor:
  - platform: homeassistant
    name: "Drum wash timer"
    entity_id: sensor.drum_wash_timer
    id: my_drum_wash_timer

then you can refer to it in an action

on_...:
  then:
    - switch.turn_on: relay_1
    - delay: !lambda 'return id(my_drum_wash_timer).state;'
    - switch.turn_off: relay_1
2 Likes