From 6cbe897a2c4b60d090d1c19541bfdf0fbb5c6de6 Mon Sep 17 00:00:00 2001 From: akasma74 Date: Mon, 16 Mar 2020 12:02:11 +0000 Subject: [PATCH] example updated (#12384) There is no need in using as_timestamp as we can subtract datetimes and then use the resulting timedelta's total_seconds() I believe it's more intuitive and elegant --- source/_docs/automation/trigger.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_docs/automation/trigger.markdown b/source/_docs/automation/trigger.markdown index 7207906f377..9cad84046be 100644 --- a/source/_docs/automation/trigger.markdown +++ b/source/_docs/automation/trigger.markdown @@ -288,7 +288,7 @@ As an alternative, providing you include the sensor [time](/integrations/time_da automation: trigger: platform: template - value_template: "{{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.YOUR.ENTITY.last_changed)) > 300 }}" + value_template: "{{ (states.sensor.time.last_changed - states.YOUR.ENTITY.last_changed).total_seconds() > 300 }}" ``` {% endraw %}