I am using this as a notification:
The overnight low will be {% set forecast = state_attr('weather.ecobee', 'forecast') %}{{ forecast[1]['templow'] }}°C.
It outputs “The overnight low will be 18.6°C.”
Which is good, it works. I’d like to round it to say 19°C instead. It’s at-a-glance info for me, and also I don’t like the implied precision in a forecast when the actual overnight low could easily vary by a few degrees.
I have tried to round this in several places, and apparently I don’t understand how it works. Could someone help me understand how to round a sensor state attribute? Here are the things I tried:
{% set forecast = (state_attr('weather.ecobee', 'forecast') | float) | round(1) %}{{ forecast[1]['templow'] }}
{% set forecast = state_attr('weather.ecobee', 'forecast') %}{{ (forecast[1]['templow']) | float) | round(1) }}
{% (set forecast = state_attr('weather.ecobee', 'forecast') %}{{ forecast[1]['templow']) | float) | round (1) }}
Yes, I’m just trying stuff to see if any of it works. I obviously don’t know where to put the float and round. Can anyone steer me in the right direction?