Closed ppmt closed 2 years ago
It looks like I misunderstood how template works.
states(..) will return a string whatever the sensor is as per this page
https://www.home-assistant.io/docs/configuration/templating/
and more precisely
states('device_tracker.paulus') will return the state string (not the object) of the given entity or unknown if it doesn’t exist.
So I think it was a non issue to start with. I will close it
Well I learnt something new here, I didn’t know that was the case!
Describe the bug The sensor state is correctly displaying the rate but it is a string rather than a number.
To Reproduce Steps to reproduce the behavior:
Go to 'Develloper Tools/ Template'
Enter the following code {% if states('sensor.octopus_agile_current_rate') is number %} It is a number {% else %} It is not a number {% endif %}
Check what is written in the right panel
Expected behavior I expected the state of the sensor to be number (so that it can be used in the Energy integration as the electicity cost)