Document filter changes (#4418)

This commit is contained in:
Clyde Stubbs 2024-11-11 12:18:09 +11:00 committed by GitHub
parent 9853544bfd
commit edb9e1021d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,12 +127,14 @@ Filters are processed in the order they are defined in your configuration.
# Example filters: # Example filters:
filters: filters:
- offset: 2.0 - offset: 2.0
- multiply: 1.2 - multiply: !lambda return 1.2;
- calibrate_linear: - calibrate_linear:
- 0.0 -> 0.0 - 0.0 -> 0.0
- 40.0 -> 45.0 - 40.0 -> 45.0
- 100.0 -> 102.5 - 100.0 -> 102.5
- filter_out: 42.0 - filter_out:
- 42.0
- 43.0
- median: - median:
window_size: 5 window_size: 5
send_every: 5 send_every: 5
@ -162,7 +164,7 @@ Filters are processed in the order they are defined in your configuration.
``offset`` ``offset``
********** **********
Adds a constant value to each sensor value. Adds a value to each sensor value. The value may be a constant or a lambda returning a float.
.. code-block:: yaml .. code-block:: yaml
@ -172,11 +174,12 @@ Adds a constant value to each sensor value.
filters: filters:
- offset: 2.0 - offset: 2.0
- multiply: 1.2 - multiply: 1.2
- offset: !lambda return id(some_sensor).state;
``multiply`` ``multiply``
************ ************
Multiplies each value by a constant value. Multiplies each value by a templatable value.
.. _sensor-filter-calibrate_linear: .. _sensor-filter-calibrate_linear:
@ -260,6 +263,20 @@ degree with a least squares solver.
filters: filters:
- filter_out: 85.0 - filter_out: 85.0
A list of values may be supplied, and values are templatable:
.. code-block:: yaml
# Example configuration entry
- platform: wifi_signal
# ...
filters:
- filter_out:
- 85.0
- !lambda return id(some_sensor).state;
``clamp`` ``clamp``
********* *********
@ -542,7 +559,7 @@ of the input values.
************ ************
After the first value has been sent, if no subsequent value is published within the After the first value has been sent, if no subsequent value is published within the
``specified time period``, send a value which defaults to ``NaN``. ``specified time period``, send a templatable value which defaults to ``NaN``.
Especially useful when data is derived from some other communication Especially useful when data is derived from some other communication
channel, e.g. a serial port, which can potentially be interrupted. channel, e.g. a serial port, which can potentially be interrupted.
@ -553,7 +570,7 @@ channel, e.g. a serial port, which can potentially be interrupted.
- timeout: 10s # sent value will be NaN - timeout: 10s # sent value will be NaN
- timeout: - timeout:
timeout: 10s timeout: 10s
value: 0 value: !lambda return 0;
``debounce`` ``debounce``
************ ************