Skip to content

Filtering out extreme values #57

Open
@mark-10-5

Description

I seem to be getting some noise on my sensor and I get very extreme values when this happens. These readings are usually over 100,000 W up to over 1 million some times.

I have found a lambda filler that has a max difference value but am not smart enough to combine the current lambda filter with this one and I can't find in the esphome docs if I can have two lambda filters and it process in order or not.

This is the filter I have found
filters:
- lambda: |-
float MAX_DIFFERENCE = 50000.0; // adjust this!
static float last_value = NAN;
if (isnan(last_value) || std::abs(x - last_value) < MAX_DIFFERENCE)
return last_value = x;
else
return {};

And I need to combine it with the current filter of

  • lambda: return x * ((60.0 / ${pulse_rate}) * 1000.0);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

help-wantedWe need some extra helping hands or expertise in order to resolve this.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions