diff --git a/source/_components/sensor.filter.markdown b/source/_components/sensor.filter.markdown index 30661e8d1fc..5e2834eebca 100644 --- a/source/_components/sensor.filter.markdown +++ b/source/_components/sensor.filter.markdown @@ -68,7 +68,7 @@ filters: type: list keys: filter: - description: Algorithm to be used to filter data. Available filters are `lowpass`, `outlier`, `throttle` and `time_simple_moving_average`. + description: Algorithm to be used to filter data. Available filters are `lowpass`, `outlier`, `range`, `throttle` and `time_simple_moving_average`. required: true type: string window_size: @@ -96,6 +96,16 @@ filters: required: false type: string default: last + lower_bound: + description: See [_range_](#range) filter. Lower bound for filter range. + required: false + type: float + default: negative infinity + upper_bound: + description: See [_range_](#range) filter. Upper bound for filter range. + required: false + type: float + default: positive infinity {% endconfiguration %} ## {% linkable_title Filters %} @@ -144,3 +154,19 @@ The Time SMA filter (`time_simple_moving_average`) is based on the paper [Algori The paper defines three types/versions of the Simple Moving Average (SMA): *last*, *next* and *linear*. Currently only *last* is implemented. Theta, as described in the paper, is the `window_size` parameter, and can be expressed using time notation (e.g., 00:05 for a five minutes time window). + +### {% linkable_title Range %} + + +The Range filter (`range`) restricts incoming data to a range specified by a lower and upper bound. + +All values greater then the upper bound are replaced by the upper bound and all values lower than the lower bound are replaced by the lower bound. +Per default there are neither upper nor lower bound. + +```python +if new_state > upper_bound: + upper_bound +if new_state < lower_bound: + lower_bound +new_state +```