Rounding Sensor State Attribute Values

I’m working on a notification system for the overnight low temperature using Home Assistant. The current setup works, but I’d like to round the temperature value for a cleaner display. Here’s what I’m trying to achieve and the issues I’ve encountered:

Currently, my notification displays the temperature as 18.6°C, but I’d prefer it to show 19°C. I’ve tried several approaches to round the value, but none have worked so far. Here are the methods I’ve attempted:

  • Attempt 1:

    {% set forecast = (state_attr(‘weather.ecobee’, ‘forecast’) | float) | round(1) %}
    {{ forecast[1][‘templow’] }}

    This didn’t work as expected.

  • Attempt 2:

    {% set forecast = state_attr(‘weather.ecobee’, ‘forecast’) %}
    {{ (forecast[1][‘templow’]) | float) | round(1) }}

    Still no luck.

  • Attempt 3:

    {% (set forecast = state_attr(‘weather.ecobee’, ‘forecast’) %}
    {{ forecast[1][‘templow’]) | float) | round (1) }}

    This also didn’t work.

I’m clearly missing something in how to apply the rounding correctly. If anyone has successfully rounded sensor values or knows the correct syntax, I’d greatly appreciate your guidance. Let’s see if we can crack this together!

Cheers,
[Your Name]