freezeke
(Miekedos)
1
I’m trying to get notified in a markdown when my iMac’s mouse needs to be charged.
the template editor gives me this:
"{{ states.sensor.imac_mouse_battery.state }}"
result is : “75%”
I want to get a notification when battery level drops below 75%, but it doesn’t work …
{% if states.sensor.imac_mouse_battery.state | float < 75 %}
Please charge iMac mouse! {% endif %}
Is this because it is a Restful sensor?
The above is probably a string, and you’re trying to compare it to a float.
What do you get if you put
{% if states.sensor.imac_mouse_battery.state | float < 75 %}
Please charge iMac mouse! {% endif %}
Into Developer Tools / Template ?
freezeke
(Miekedos)
4
I now use it just like this (and working), but of course it is not ideal. I prefer a constant notification
{% if "73%" in states('sensor.imac_mouse_battery') %}
{{'\u26A0\uFE0F'}} Muis van iMac opladen! {% endif %}