esphome / esphome/feature-requests

Having `FilterChain` as a standalone class and use it from other (non-sensor) components

Open
#755 0 comments 0 reactions 0 assignees View on GitHub
component: sensor
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

I am trying to augment certain features of certain components, and I would find useful to be able to use filters from outside sensors, e.g. have a `FilterChain` C++ class that can be used from not only sensor components but also other places like the `TimeBasedCover` component.

**Please describe your use case for this integration and alternatives you've tried:**

My use case is: I have a time-based cover which is non-linear along its course --i.e. the first half of the window is much slower to open as the other half, and the last 10% is excruciatingly slow. I thought of adding a feature on the TimeBasedCover by using something similar to CalibratePolynomialFilter, but that is inside the sensor codebase and using it seems hackish. I could do a custom component, but then nobody else will benefit from that; also, the evaluation of the polynomial coefficients (which should be done in compile time) is not easily done with a custom component. And redoing that is reinventing the wheel, as that polynomial mechanism already exists and is in esphome codebase.

**Additional context**

I am ready to do the PR myself. But I was a bit confused and have been looking at it from different perspectives (I am a Python developer, but I am not familiar with the code generating mechanisms, so I have a steep-ish learning curve ahead). And I am not sure if that PR will be useful and reestructuring the filter codebase would be seen with good eyes (with that FilterChain structure concept or something similar). Before diving into it and I wanted to make sure that it makes sense as a whole.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.