From 1e4b95d45163dc5835dc6b24e2929c9bd7bbeee3 Mon Sep 17 00:00:00 2001 From: tomlut <10679300+tomlut@users.noreply.github.com> Date: Fri, 17 Apr 2020 06:26:59 +1000 Subject: [PATCH] Cleanup as per issue #10648 (#13013) * Cleanup as per issue #10648 Added clarification for max samples and adjusted examples. * :pencil2: Tweak Co-authored-by: Franck Nijhof --- source/_integrations/trend.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/_integrations/trend.markdown b/source/_integrations/trend.markdown index 83ffcda9d65..dbac93eacea 100644 --- a/source/_integrations/trend.markdown +++ b/source/_integrations/trend.markdown @@ -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 ```