-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[sensors] High-pass and low-pass filters #5584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation for two new sensor filters: high_pass and low_pass. These filters provide signal processing capabilities to remove high-frequency noise or low-frequency drift from sensor readings.
- Added documentation for high_pass and low_pass filters with explanations, formulas, and usage examples
- Integrated the new filters into the main sensor documentation index in alphabetical order
- Added filter examples to the comprehensive filter list
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| content/components/sensor/filter/low_pass.md | New documentation for the low_pass filter with configuration details and example |
| content/components/sensor/filter/high_pass.md | New documentation for the high_pass filter with configuration details and example |
| content/components/sensor/_index.md | Added high_pass and low_pass filter sections and examples to the main sensor documentation |
| assuming the sensor values are sampled at a constant rate. This filter will remove low-frequency | ||
| components and offset from the sensor values. | ||
|
|
||
| The formula for the high pass filter is: ``y[i] := α × y[i−1] + α × (x[i] − x[i−1])``, |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent multiplication symbol used. The formula uses × (Unicode multiplication sign) while the low_pass filter uses * (asterisk) in its formula. For consistency and to match code syntax conventions, use * instead of ×. Change α × y[i−1] + α × (x[i] − x[i−1]) to α * y[i−1] + α * (x[i] − x[i−1]).
| The formula for the high pass filter is: ``y[i] := α × y[i−1] + α × (x[i] − x[i−1])``, | |
| The formula for the high pass filter is: ``y[i] := α * y[i−1] + α * (x[i] − x[i−1])``, |
| headless: true | ||
| --- | ||
|
|
||
| Basic [low pass filter](https://en.wikipedia.org/wiki/Low-pass_filter>) for the sensor values, |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Wikipedia link has a malformed closing bracket. The link should end with ) instead of >). Change [low pass filter](https://en.wikipedia.org/wiki/Low-pass_filter>) to [low pass filter](https://en.wikipedia.org/wiki/Low-pass_filter).
| Basic [low pass filter](https://en.wikipedia.org/wiki/Low-pass_filter>) for the sensor values, | |
| Basic [low pass filter](https://en.wikipedia.org/wiki/Low-pass_filter) for the sensor values, |
| headless: true | ||
| --- | ||
|
|
||
| Basic [high pass filter](https://en.wikipedia.org/wiki/High-pass_filter>) for the sensor values, |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Wikipedia link has a malformed closing bracket. The link should end with ) instead of >). Change [high pass filter](https://en.wikipedia.org/wiki/High-pass_filter>) to [high pass filter](https://en.wikipedia.org/wiki/High-pass_filter).
| Basic [high pass filter](https://en.wikipedia.org/wiki/High-pass_filter>) for the sensor values, | |
| Basic [high pass filter](https://en.wikipedia.org/wiki/High-pass_filter) for the sensor values, |
| where ``x`` is the input value and ``y`` is the output value. | ||
|
|
||
| A lower α implies that the output will respond more slowly to changes in the input but will also | ||
| be less influenced by noise. We can say the system has more inertia. A value of 0.5 (when time constant equal sampling period) might be a good starting point for experimentation. |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: "equal" should be "equals". Change "when time constant equal sampling period" to "when time constant equals sampling period".
| be less influenced by noise. We can say the system has more inertia. A value of 0.5 (when time constant equal sampling period) might be a good starting point for experimentation. | |
| be less influenced by noise. We can say the system has more inertia. A value of 0.5 (when time constant equals sampling period) might be a good starting point for experimentation. |
| even small changes in input. | ||
|
|
||
| A small α implies that the output will decay quickly and will require large changes in the input | ||
| to cause the output to change much. A value of 0.5 (when time constant equal sampling period) might be a good starting point for experimentation. |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: "equal" should be "equals". Change "when time constant equal sampling period" to "when time constant equals sampling period".
| to cause the output to change much. A value of 0.5 (when time constant equal sampling period) might be a good starting point for experimentation. | |
| to cause the output to change much. A value of 0.5 (when time constant equals sampling period) might be a good starting point for experimentation. |
| # Example configuration entry | ||
| - platform: wifi_signal | ||
| # ... | ||
| filters: | ||
| - low_pass: 0.25 | ||
| ``` | ||
|
|
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration variable description is incomplete and inconsistent with the example usage. The example shows - low_pass: 0.25 (using the filter name directly with a value), but the configuration variable is named alpha. Either clarify that the shorthand syntax sets the alpha parameter, or show the full configuration format. Compare with exponential_moving_average which shows both shorthand and full formats in its example.
| # Example configuration entry | |
| - platform: wifi_signal | |
| # ... | |
| filters: | |
| - low_pass: 0.25 | |
| ``` | |
| # Example configuration entry (shorthand) | |
| - platform: wifi_signal | |
| # ... | |
| filters: | |
| - low_pass: 0.25 # Shorthand: sets alpha to 0.25 | |
| # Example configuration entry (full format) | |
| - platform: wifi_signal | |
| # ... | |
| filters: | |
| - low_pass: | |
| alpha: 0.25 |
Note: The shorthand syntax (- low_pass: 0.25) is equivalent to the full format (- low_pass: { alpha: 0.25 }) and sets the alpha parameter.
| # Example configuration entry | ||
| - platform: wifi_signal | ||
| # ... | ||
| filters: | ||
| - high_pass: 0.75 | ||
| ``` | ||
|
|
||
| Configuration variables: | ||
|
|
||
| - **alpha** (*Required*, float): *Alpha* smoothing factor for the high pass filter. From 0 to 1. |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration variable description is incomplete and inconsistent with the example usage. The example shows - high_pass: 0.75 (using the filter name directly with a value), but the configuration variable is named alpha. Either clarify that the shorthand syntax sets the alpha parameter, or show the full configuration format. Compare with exponential_moving_average which shows both shorthand and full formats in its example.
| # Example configuration entry | |
| - platform: wifi_signal | |
| # ... | |
| filters: | |
| - high_pass: 0.75 | |
| ``` | |
| Configuration variables: | |
| - **alpha** (*Required*, float): *Alpha* smoothing factor for the high pass filter. From 0 to 1. | |
| # Example configuration entry (shorthand and full format) | |
| - platform: wifi_signal | |
| # ... | |
| filters: | |
| # Shorthand: sets alpha directly | |
| - high_pass: 0.75 | |
| # Full configuration format | |
| - high_pass: | |
| alpha: 0.75 |
Configuration variables:
-
alpha (Required, float): Alpha smoothing factor for the high pass filter. From 0 to 1.
You can use the shorthand syntax
- high_pass: 0.75which is equivalent to- high_pass: { alpha: 0.75 }.
Description:
Related issue (if applicable): fixes
Pull request in esphome with YAML changes (if applicable):
Checklist:
I am merging into
nextbecause this is new documentation that has a matching pull-request in esphome as linked above.or
I am merging into
currentbecause this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.Link added in
/components/index.rstwhen creating new documents for new components or cookbook.