From b56d6638c142c157a7ff55382b57abe9684f4837 Mon Sep 17 00:00:00 2001 From: akasma74 Date: Fri, 6 Mar 2020 14:03:26 +0000 Subject: [PATCH] history_stats: update examples (#12282) it is possible to change several attributes in just one datetime.replace call --- source/_integrations/history_stats.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/_integrations/history_stats.markdown b/source/_integrations/history_stats.markdown index 3d3440ebf3a4..8414617f19d2 100644 --- a/source/_integrations/history_stats.markdown +++ b/source/_integrations/history_stats.markdown @@ -33,7 +33,7 @@ sensor: entity_id: light.my_lamp state: 'on' type: time - start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' + start: '{{ now().replace(hour=0, minute=0, second=0) }}' end: '{{ now() }}' ``` {% endraw %} @@ -132,7 +132,7 @@ Here are some examples of periods you could work with, and what to write in your {% raw %} ```yaml - start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' + start: '{{ now().replace(hour=0, minute=0, second=0) }}' end: '{{ now() }}' ``` {% endraw %} @@ -141,7 +141,7 @@ Here are some examples of periods you could work with, and what to write in your {% raw %} ```yaml - end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' + end: '{{ now().replace(hour=0, minute=0, second=0) }}' duration: hours: 24 ``` @@ -151,7 +151,7 @@ Here are some examples of periods you could work with, and what to write in your {% raw %} ```yaml - start: '{{ now().replace(hour=6).replace(minute=0).replace(second=0) }}' + start: '{{ now().replace(hour=6, minute=0, second=0) }}' duration: hours: 5 ``` @@ -163,7 +163,7 @@ Here, last Monday is _today_ as a timestamp, minus 86400 times the current weekd {% raw %} ```yaml - start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}' + start: '{{ as_timestamp( now().replace(hour=0, minute=0, second=0) ) - now().weekday() * 86400 }}' end: '{{ now() }}' ``` {% endraw %} @@ -172,7 +172,7 @@ Here, last Monday is _today_ as a timestamp, minus 86400 times the current weekd {% raw %} ```yaml - end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' + end: '{{ now().replace(hour=0, minute=0, second=0) }}' duration: days: 30 ```