Filter sensor keeps showing last value the sensor had before dropping to 0

I have created a sensor using a moving average to calculate the average power of the last 10 minutes

sensor:
  - platform: filter
    name: "filtered power prism"
    entity_id: sensor.prism_potenza
    filters:
      - filter: time_simple_moving_average
        window_size: "00:10"
        precision: 2   

the power sensor sends a message every ~1 s, but when power stops being drawn, it sends the last message with payload β€œ0”, and then it stops sending any message (because the power is still 0)

but the filtered entity gets stuck on the average it has before the power went to 0

Capture

where you see a sudden drop of the filtered value, that’s when I restarted HA

I have the same problem here. This is what I have in sensors.yaml:

- platform: filter
  name: 'Enden gefilterd'
  entity_id: sensor.enden_teller
  filters:
    - filter: time_simple_moving_average
      window_size: "00:00:10"
      precision: 1

We use this to measure the speed of a mill. We stopped the mill in the afternoon at 17:22h and the this happens:
image

Looks like it is still running

The only solution I found so far is injecting a very small value (0.1) via mqtt and then 0 immediately after; I do this every 10 seconds if the value is less then 1

2 Likes