mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
history_stats: update examples (#12282)
it is possible to change several attributes in just one datetime.replace call
This commit is contained in:
parent
777a2f397d
commit
b56d6638c1
@ -33,7 +33,7 @@ sensor:
|
|||||||
entity_id: light.my_lamp
|
entity_id: light.my_lamp
|
||||||
state: 'on'
|
state: 'on'
|
||||||
type: time
|
type: time
|
||||||
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
|
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
|
||||||
end: '{{ now() }}'
|
end: '{{ now() }}'
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -132,7 +132,7 @@ Here are some examples of periods you could work with, and what to write in your
|
|||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
|
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
|
||||||
end: '{{ now() }}'
|
end: '{{ now() }}'
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -141,7 +141,7 @@ Here are some examples of periods you could work with, and what to write in your
|
|||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
|
end: '{{ now().replace(hour=0, minute=0, second=0) }}'
|
||||||
duration:
|
duration:
|
||||||
hours: 24
|
hours: 24
|
||||||
```
|
```
|
||||||
@ -151,7 +151,7 @@ Here are some examples of periods you could work with, and what to write in your
|
|||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
start: '{{ now().replace(hour=6).replace(minute=0).replace(second=0) }}'
|
start: '{{ now().replace(hour=6, minute=0, second=0) }}'
|
||||||
duration:
|
duration:
|
||||||
hours: 5
|
hours: 5
|
||||||
```
|
```
|
||||||
@ -163,7 +163,7 @@ Here, last Monday is _today_ as a timestamp, minus 86400 times the current weekd
|
|||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```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() }}'
|
end: '{{ now() }}'
|
||||||
```
|
```
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -172,7 +172,7 @@ Here, last Monday is _today_ as a timestamp, minus 86400 times the current weekd
|
|||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
|
end: '{{ now().replace(hour=0, minute=0, second=0) }}'
|
||||||
duration:
|
duration:
|
||||||
days: 30
|
days: 30
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user