Pass sensor value from HA to ESPHome

Hello all,

I’m struggling with passing sensor value from HA to ESPHome.

I have a Temperature Sensor sensor.relax_zone_temperature which displays a temperature of my room.

In HA I have

sensor:
- platform: template
  sensors:
    my_temperature_sensor:
       value_template: "{{ states('sensor.sensor.relax_zone_temperature') | int }}"

In ESPHome I have

sensor:
  - platform: homeassistant
    name: "Temperature Sensor From Home Assistant"
    entity_id: sensor.my_temperature_sensor
    id: id_my_temperature_sensor

In logs I have

[21:37:45][W][homeassistant.sensor:015]: 'sensor.my_temperature_sensor': Can't convert 'unavailable' to number!
[21:37:45][D][sensor:094]: 'id_my_temperature_sensor': Sending state nan  with 1 decimals of accuracy

I guess my lambda is false, could you please help me with it

value_template: "{{ states('sensor.sensor.relax_zone_temperature') | int }}"

Maybe “sensor.sensor” is the issue? Is that the correct syntax?

1 Like

And the winner is…
Thank you a lot. Seems one should take rest every 1/2 Hour