I have this sensor which works great for the “Floor” and “Car” conditions, but gives me “unavailable” when it should be giving me “Dunno”.
template:
- sensor:
name: "Car in garage"
state: >
{% if not is_number(states('sensor.garage_door_vl53l0x_distance')) %}
Floor
{% elif states('sensor.garage_door_vl53l0x_distance') > 400 %}
Car
{% else %}
Dunno
{% endif %}
“Dunno” is really “the garage door is open so since I can’t see past the door, I don’t really know whether the car is there or not”. The sensor itself is reporting that shorter distance properly (~16mm), so it’s not data being missing causing this.
Any ideas why this (I thought) simple snippet isn’t working?
Thanks!