Hi,
I want to create a binary sensor whose status is formed from the difference of 2 temperatures. In addition, I would like to have the current temperature difference as an attribute.
In the template editor this is as expected:
But when I create the template sensor in the config.yaml, the attribute ist only rendered as td.
- binary_sensor:
- name: "Heizkoerper_Diele"
unique_id: "ffd69dd1-0278-4ced-8038-896b5ef38c58"
state: >
{% set td = states('sensor.testlumi_lumi_weather_72b24b04_temperature') | float()
- states('sensor.bt_klima_diele_temperature') | float() %}
{% if(td > 1.5) %} on {%else%} off {% endif%}
attributes:
tempdiff: td
I suspect that the variable “td” is no longer present. How can I solve this?