mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 16:27:19 +00:00
adding default to round() examples to be compliant new validation (#19800)
This commit is contained in:
parent
d1fa0eb725
commit
9b0c14d0b2
@ -61,7 +61,7 @@ template:
|
|||||||
{% set bedroom = states('sensor.bedroom_temperature') | float %}
|
{% set bedroom = states('sensor.bedroom_temperature') | float %}
|
||||||
{% set kitchen = states('sensor.kitchen_temperature') | float %}
|
{% set kitchen = states('sensor.kitchen_temperature') | float %}
|
||||||
|
|
||||||
{{ ((bedroom + kitchen) / 2) | round(1) }}
|
{{ ((bedroom + kitchen) / 2) | round(1, default=0) }}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -86,8 +86,8 @@ template:
|
|||||||
minutes: 0
|
minutes: 0
|
||||||
sensor:
|
sensor:
|
||||||
# Keep track how many days have past since a date
|
# Keep track how many days have past since a date
|
||||||
- name: Not smoking
|
- name: "Not smoking"
|
||||||
state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round }}'
|
state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(default=0) }}'
|
||||||
unit_of_measurement: "Days"
|
unit_of_measurement: "Days"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user