More Sensor Filters

This commit is contained in:
Otto Winter 2018-05-17 21:39:46 +02:00
parent 6031365442
commit 0d17464155
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
2 changed files with 50 additions and 0 deletions

View File

@ -119,6 +119,31 @@ Filter
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::ThrottleFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::DeltaFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::OrFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::AndFilter
:members:
:protected-members:
:undoc-members:
.. doxygenclass:: sensor::UniqueFilter
:members:
:protected-members:
:undoc-members:
MQTTSensorComponent
*******************

View File

@ -134,6 +134,12 @@ sensor <https://www.home-assistant.io/components/sensor.filter/>`__.
- exponential_moving_average:
alpha: 0.1
send_every: 15
- throttle: 1s
- delta: 5.0
- unique:
- or:
- throttle: 1s
- delta: 5.0
- lambda: x * (9.0/5.0) + 32.0
Above example configuration entry is probably a bit useless, but shows
@ -161,6 +167,25 @@ every filter there is currently:
- **alpha**: The forget factor/alpha value of the filter.
- **send_every**: How often a sensor value should be pushed out.
- **throttle**: Throttle the incoming values. When this filter gets an incoming value,
it checks if the last value passed out of this filter is at least the value of this filter
old. If it is not older than the configured value, the value is not passed forward.
- **delta**: This filter stores the last value passed through this filter and only
passes incoming values through if the absolute difference is greater than the configured
value. For example if a value of 1.0 first comes in, it's passed on. If the delta filter
is configured with a value of 5, it will now not pass on an incoming value of 2.0, only values
that are at least 6.0 big or -4.0.
- **unique**: This filter has no parameter and does one very simple thing: It only passes
forward values if they are different from the last one that got through the pipeline.
- **or**: Pass forward a value with the first child filter that returns. Above example
will only pass forward values that are *either* at least 1s old or are if the absolute
difference is at least 5.0.
- **and**: Similar to or. Only pass on a value if all child filters pass.
- **lambda**: Perform a simple mathematical operation over the sensor
values. The input value is ``x`` and the result of the lambda is used
as output. Each floating point operation should have ``.0`` attached