How I could round a filtered sensor?

Hi all,
I’ve a filtered sensor and I would like to round the value, I tried in different ways but alway got an error.
This is my last code

sensor:        
  - platform: filter
    name: "Potenza istantanea filtered"
    entity_id: sensor.din_power
    filters:
      - filter: time_simple_moving_average
        window_size: 00:03
    state: '{{ states("sensor.potenza_istantanea_filtered") | round(0) }}'

what’s wrong?

I don’t use filter sensor so I can’t say for sure (the code looks good to me), but I guess you should add quotes to window_size as you are using formatted value, like this:

window_size: "00:03"

Furthermore, in the example I couldn’t find the “state” configuration value, so I’m not sure if this is valid input. To round your value you should probably use configuration value

window_size: "00:03"
precision: 0

at the end of your code.

It works :slight_smile: