Hi everyone, I can’t understand the problem in the following template sensor:
- sensors:
template_entrance_door_lock:
value_template: >-
{% if states('sensor.vibration_entrance_door_lock_angle_x') | float > 20 %}
locked
{% else %}
potentially unlocked
{% endif %}
icon_template: >
{% if states('sensor.vibration_entrance_door_lock_angle_x') | float > 20 %}
mdi:shield-lock
{% else %}
mdi:help-rhombus
{% endif %}
I use this template in a mushroom template card. The icon is correct, and changes depending on the state, but the state is always unknown. What am I doing wrong?