Most frequent sensor value?

I am using an mqtt sensor to pick up 433 codes but it is very noisy (10 per second when a frequency is received).

I’m trying to find a way to filter but can’t seem to crack it.

Ideally I would like the mode/most frequent value in, say, a 10 second period. I’ve tried with average and median but that won’t work

For example if the sensor read

10, 35, 20, 20, 5, 35, 35

I would like the filter to show 35. Does anyone have any ideas on how to solve for that?

You may wish to use a Filter Sensor. You can do signal processing by applying various filters.

The use case here seems to be catch an integer value that is most common, not to time-smooth a signal, but I could be wrong. I don’t know an easy way to do this, but I would put in a feature request for mode to be added to the statistics sensor. This seems like a straightforward addition.

Hi all

@123 - yes, have been trying to use filter sensor but have only seen average and median, or first value in a given time period but that doesn’t help unfortunately unless someone knows how I can use it as the documentation is not the clearest

@MatthewFlamm exactly - I was hoping that I could identify the most common vs. time-smooth, averages etc. I may try the statistics sensor with a max age of 10 seconds and see if median works for my purposes (even if variance is high, so long as over 50% of values are the one I am looking for it might work), but yes probably a feature request if no existing capability

Did you find a way to do this? I am looking for the exact same thing…

1 Like

This!
I’m looking for a ‘mode’ sensor too. we have ‘mean’ and ‘median’ value in the statistics sensor but no mode!

Any help gratefully appreciated :slight_smile:

1 Like

Vote for a mode (most frequent) statistics sensor on this thread: Mode for statistics sensor