mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 21:36:52 +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
|
||||
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
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user