Could someone help me with this template please? I don’t quite understand the new default value in relation to time formatting.
{% set e7_normal = 0.2328 %}
{% set e7_cheap = 0.1378 %}
{% if (states('sensor.time_utc')| timestamp_custom('%H:%M', False, now())) >= ('07:30' | timestamp_custom('%H:%M', False, now())) %}
{{( e7_normal ) | float(0)}} {% else %}
{% if (states('sensor.time_utc')| timestamp_custom('%H:%M', False, now())) >= ('00:30' | timestamp_custom('%H:%M', False, now())) %}
{{( e7_cheap ) | float(0)}} {% else %}
{{( e7_normal ) | float(0)}} {% endif %} {% endif %}
I get the normal price all the time now. Upon investigation, it appears it is always using the default value. So is ‘7:30’ an invalid input?
What is the best way to compare time?
2 posts - 2 participants