I have a sensor with values that range from 0.005 to 0.015 that updates every minute or so.
For some reason I cannot figure out or troubleshoot, there are some values, twice a day, that go up from 4 to 30.
This really messes up my graphs.
I was trying to set up a filter sensor like this:
- platform: filter
name: "filtered sensor"
- filter: outlier
I have tried different
radius values, but I cant figure out which ones to use, I cannot quite figure out the documentation details.
Right now with the above values i get a constant 0 with some peaks around 1-2.
How can I create a filtered sensor that will ignore any value larger than say 0.2?
Thanks in advance.
As far as I understand it, the window size is how many samples to use for a rolling average. The new value must be within +/-
radius of this average to be accepted as valid.
I have found strange things happen after a restart though. If the first sample is a bad one it will make it into the average then no real readings are accepted.
As you have a well defined range of 0.005 to 0.015 perhaps you would be better off with a range filter?
- filter: range
I never even noticed the range filter.
My fault for not going through the whole documentation page It looks like exactly what i need.
Updated the code and rebooting now.
I did a test run with upper 0.1 and lower 0.
It seems to be working but it is rounding the results to two decimals. I am getting a constant 0.01.
I’ll let it run a couple of hours, maybe it will correct itself after it has some more samples.
There is a precision option but it seems like its referring to another filter, so I dont know if it can be used.
Thanks for the input @tom_l
I think precision should work for all the filters, lowpass is just mentioned in the docs an example.