Clarify 0.117 breaking changes for templates (#15361)

This commit is contained in:
Anders Melchiorsen 2020-10-25 13:47:10 +01:00 committed by GitHub
parent dd1c0f4bc0
commit c59a141ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,7 +238,7 @@ No configuration changes are necessary, to keep existing configs working, the ke
</details>
<details>
<summary><b>Templates</b></summary>
<summary><b>Templates - native types</b></summary>
<p>
Template results are now rendered to native Python types.
@ -276,19 +276,50 @@ homeassistant:
Please note, this is a transitional option, which will be removed in the future.
([@frenck] - [#41227])
</p>
</details>
<details>
<summary><b>Templates - rate limits</b></summary>
<p>
Previously we implemented a rate limit of 1 update per minute for
`states.DOMAIN` in templates. This works fine for all `states`, however it turned
out to be too conservative for `states.DOMAIN` per
[this comment](https://github.com/home-assistant/architecture/issues/449#issuecomment-711032893).
Therefore it has been changed to an update once every second.
`states.DOMAIN` in templates. This has been changed to an update once every second.
It is no longer necessary to reference `sensor.time`, `sensor.date`, or manually
update template entities that do not listen for state changes, as they will
automatically update when an referenced entity changes state or every 60 seconds
after the last state changed event when `now()` or `utcnow()` is contained in
the template.
Templates using `states` (without a domain) still have a rate limit of 1 update per minute.
([@frenck] - [#41227]) ([@bdraco] - [#42004] [#41147])
([@bdraco] - [#42004])
</p>
</details>
<details>
<summary><b>Templates - auto-updating `now()`</b></summary>
<p>
The `entity_id:` attribute was recently removed from template entities because
the templates are now able to find all referenced entities automatically. This
removal introduced a new problem where templates using the current time could
no longer use `entity_id: sensor.time` to ensure periodic updates.
With apologies to those who have spent the last couple of releases adding
workarounds to their templates, we are now introducing an auto-refresh feature
to time-based templates.
It is thus no longer necessary to reference `sensor.time`, `sensor.date` or manually
update template entities when `now()` or `utcnow()` is present in the template.
The template will automatically be updated when:
- A referenced entity changes state.
- At the start of each minute when `now()` or `utcnow()` is present in the template.
Please note, if you have a time-based template where you _do not_ want it to
update periodically it will now have to be reworked to not use `now()`.
([@bdraco] - [#41147] [#42225])
</p>
</details>