Cleanup as per issue #10648 (#13013)

* Cleanup as per issue #10648

Added clarification for max samples and adjusted examples.

* ✏️ Tweak

Co-authored-by: Franck Nijhof <frenck@frenck.dev>
This commit is contained in:
tomlut 2020-04-17 06:26:59 +10:00 committed by GitHub
parent cde549a176
commit 1e4b95d451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,8 +87,7 @@ sensors:
If the optional `sample_duration` and `max_samples` parameters are specified
then multiple samples can be stored and used to detect long-term trends.
Each time the state changes, a new sample is stored along with the sample time.
Samples older than `sample_duration` seconds will be discarded.
Each time the state changes, a new sample is stored along with the sample time. Samples older than `sample_duration` seconds will be discarded. The `max_samples` parameter must be large enough to store sensor updates over the requested duration. If you want to trend over two hours and your sensor updates every 120s then then `max_samples` must be at least 60, i.e., 7200/120 = 60.
A trend line is then fitted to the available samples, and the gradient of this
line is compared to `min_gradient` to determine the state of the trend sensor.
@ -124,12 +123,14 @@ binary_sensor:
temp_falling:
entity_id: sensor.outside_temperature
sample_duration: 7200
max_samples: 120
min_gradient: -0.0008
device_class: cold
temp_rising:
entity_id: sensor.outside_temperature
sample_duration: 7200
max_samples: 120
min_gradient: 0.0008
device_class: heat
```