Problem to config filter sensor with a smart plug for a washing machine

Hi,
I have a sensor on a smart plufg/outlet connected to a washing machine which works between 0 and 2000 watt.

this is may config:

  - platform: filter
    name: "Watt Lavatrice filtered"
    entity_id: sensor.watt_lavatrice
    filters:
      - filter: outlier
        window_size: 0
        radius: 2000.0
      - filter: lowpass
        time_constant: 60
      - filter: time_simple_moving_average
        window_size: 00:05
        precision: 0

this don’t work for me: any suggestions?

Can you expand on that? Are there any config errors? Any run-time errors? Have you enabled debug in the logger for homeassistant.components.filter and checked home-assistant.log? Is the entity sensor.watt_lavatrice_filtered being created, and if so, how is its value different from what you expect?

Although I haven’t really used this sensor, I’m wondering if a window_size of 0 makes sense for the outlier filter.

Hi,
the problem sin filter configuration; here you can see real sensor graph:


and here is the result of my filter:

I need help to config better my filter configuration…

Maybe let’s take a step back. What are you ultimately trying to accomplish? If you’re just trying to determine if the washing machine is running, how about using a Threshold Binary Sensor instead? Maybe something like:

binary_sensor:
  - platform: threshold
    name: Washing Machine
    entity_id: sensor.watt_lavatrice
    upper: 1000
    hysteresis: 100

This will create binary_sensor.washing_machine which will start out being 'off', and will switch to 'on' whenever sensor.watt_lavatrice goes above 1100, and will switch to 'off' whenever sensor.watt_lavatrice goes below 900.

Or if you’re really just trying to create a filtered version of sensor.watt_lavatrice, then maybe given the nature of that signal you should consider which filters make sense for you. Another thing to consider is, how often does sensor.watt_lavatrice update? If it doesn’t update very often (and, especially, if it doesn’t update when its value doesn’t change) then it might be hard to get reasonable results from the filter sensor. It works much better if the input changes often and on a consistent basis (which most sensors don’t do.)

Hi,
I already have threshold sensor. I only would a normalised graph of WATT consumption to reduce effort on sd card…I not need specificities value but only trends …

Sorry, not sure I understand that. Your filtered entity will change exactly as often as the input entity does, and result in the same number of state updates. Not sure why the filtered entity would cause any less writes to the sd card as the original entity.

I would sample lessa data to have less write on SD card; please see follow example of original sensor with many spikes:
Home-Assistant-sensore-pre-filtering

and filtered result with less variation so less writes on sd card:
Home-Assistant-sensore-post-filtering

I hope this could be more clear now…

Just because the changes are smaller doesn’t necessarily mean there are fewer of them.

Sorry, I guess I’m not helping.

OK, but can you suggest how to config better filter component?

Like I said, I’ve really not used this sensor. However, I’d (again) suggest that maybe a window_size of 0 for the outlier filter is not appropriate. Or maybe remove the outlier and lowpass filters and just try time_simple_moving_average by itself, maybe with a larger window_size (15 minutes instead of 5???)