How to use the new filter sensor

I can look into making changes. Would you be willing to give me 10-15 min walkthrough your code including HA core parts. I am not very clear for example on how one add/expose configuration parameters that are visible in the YAML file and then access them inside the component.
I also need some initial guidance on the workflow… ie: branching strategy , reviews, etc… I am very confused how it all works with the HA distributed team. If you can spare a few mins to answer my questions, I would be happy to work with you on filter component and maybe others in the future.

Just look into the existing filters, the code has been written so that it is easy to add new filters :slight_smile:

I’ll be available to review your code and advise on the right directions

Really happy with the over all output of this filter vs just using the stats filter to smooth data, however I have noted that this filters output will never drop to zero or the last reported value…

I am testing it to smooth power readings from a wemo insight plug but the wemo stops reporting when power is below a certain point after a device shuts down.

Any suggestions on this?

Which filter are you using ? (share your filter sensor configuration)

I was using the low pass filter with defaults, I switched to the outlier filter which seems to work better with what I need.

I am monitoring my high efficiency washer and want to know when it is off / idle / running and when it is done its cycle.

Technically the low pass filter provided better running numbers however at the end it never drops off to 0. Again I think this is due to the way the wemo works, i don’t think it reports changes if there are none.

The outlier seems to work with a small window size as it reacts more quickly and at the end of the cycle the wemo does report at least about 3 times before no new values appear

Today I upgraded from HA 0.65 to HA 0.67 and since then my filter is not working anymore. My config is as follows:

sensors:
 - platform: filter
   name: "Stroomverbruik"
   entity_id: sensor.power_consumption
   filters:
      - filter: throttle
        window_size: 20

In the log, the following error occurs: ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.filter]: not a valid value for dictionary value @ data['filters'][0]['filter']. Got 'throttle'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.filter/

Any suggestions?

If you copy&paste correctly I would say you have an extra " "(space) before “- filter: throttle”

Unfortunately adjusting the spacing does not fix it. When I change “throttle” into “outlier” (and adding a radius), the filter does work without errors.

Can you add some logs ?

logger:
  default: error 
  logs:
    homeassistant.components.sensor.filter: debug

Sure, but that results in nothing new compared to the previous log.

2018-05-02 19:31:47 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.filter]: not a valid value for dictionary value @ data['filters'][0]['filter']. Got 'throttle'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.filter/

OK :slight_smile:

Sorry for that…

Will be fixed in the next release (either 0.68.2 or 0.69)

Hi, i have an issue using filters: i have a temperature reading coming from a wifi thermostat. I use this filter:

  - platform: filter 
    name: "temptermostato_slow"  
    entity_id: sensor.temptermostato 
    filters:
      - filter: lowpass
        time_constant: 5
        precision: 1

It works fine, but when i restart Hassio it give, initially, a wrong value (in excess). See picture below:


How can i avoid this?
Thank you.

Please excuse me for continuing an old thread.
I have been trying to smooth out the temperature graph of a dallas temp sensor. Used the exponential moving average , but the chart has steps instead of smooth transitions.I visualize response that is akin to charging and discharging of a capacitor through a resistor.
My question is
Will the lowass filter work under the Esphome integration?

Can someone please explain to me in plain noob language what radius and window size are?

I have a few smartplug which occasionally report extreme high values and then jump back to the old value again. I have set this filter with window size 1 because it’s only one state update and a radius of 0.5. because the value can never raise more then 0.5 kWh in one state change. But I guess I don’t understand these 2 values the right way. Can some one tell me what right values are in my case of the above?

My guestion it is almost the same as yours. Did you find any solution? Or anyone in the past 2 years?

I am using the filter sensor to calculate average MPG in an RV. When the engine is not running the input value is “Unavailable”. I would like the filter to pause itself when this happens but what is really happening is that it’s acting as if the input is zero. This means that every time the RV is started the filter takes a long time to get back to the correct value.

Is there any way to “preload” a value into the filter? I could work around that problem if I could store the value before the engine shuts off and preload it when the engine starts again.