I defined a sensor and I’m simply trying to work with the sensor value. But whenever I try to read it it’s unknown or not existing.
sensor:
- platform: template
sensors:
woonkamer_target_temp_diff:
value_template: >-
{% set current_temp = states.climate.woonkamer.attributes.current_temperature|int %}
{% set target_temp = states.climate.woonkamer.attributes.temperature|int %}
{{ (target_temp - current_temp)|int }}
The state is -2.
Now how do I display or use this in a template?
{{ states.sensor.sensor.woonkamer_target_temp.state }}
UndefinedError: ‘None’ has no attribute ‘woonkamer_target_temp’
{{states('sensor.woonkamer_target_temp')}}
unknown
Trying all variants Google will come up with still give invalid results.