Smooth out sensor (update less frequently)?

I have a smart plug for my Automower, to be able to tell what it is doing based on the watt used.

  • Less then 1w = Parked - waiting for schedule to start
  • Between 2 and 4 watts = Cutting grass
  • Above 4w = Charging

It works well (and has been) for a while, but when I view the History of the sensor, there are small gaps where the state changes, since the watts change for 30 seconds or so:


Is there a way to decrease the update of the sensor or another way to smooth out and have it update less frequently?

The code used:

  - name: "kajsa_klipper"
    unique_id: "Kajsa klipper"
    state: >
      {% set kajsa = states('sensor.shelly_s_kajsa_power')|round(0) %}
      {% if kajsa < 1 %}
        Chillar
      {% elif kajsa > 2 and kajsa < 4 %}
        Klipper  
      {% else %}
        Laddar
      {% endif %}    
    icon: >
      mdi:robot-mower-outline

Try using a statistics sensor.
You may need to adjust the template slightly to get it to work as expected.

1 Like