-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blog post about deprecated template.attach (#2302)
* Add blog post about deprecated template.attach * Improve * Improve language
- Loading branch information
1 parent
bd26070
commit 3635dae
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
author: Erik Montnemery | ||
authorURL: https://github.com/emontnemery | ||
title: "Template.hass is no longer automatically set when rendering templates" | ||
--- | ||
|
||
With the merge of [core PR #89242](https://github.com/home-assistant/core/pull/124656), which landed in Home Assistant Core 2023.4, `Template.hass` will be set on `Template` objects created during schema validation. | ||
|
||
Before this change, it was necessary to check and set `Template.hass` before rendering templates, and this happened in numerous places throughout the codebase. | ||
Such code has been removed from Home Assistant Core, which impacts custom integration authors: | ||
- Custom integrations which create `Template` objects manually must pass a valid `hass` object to the constructor. This is in particular the case when creating templates for config entries. Not passing a `hass` object will trigger a deprecation warning and fail in Home Assistant Core 2025.10. | ||
- The helper function `template.attach` no longer serves a purpose and is no longer used by core. It has been marked as deprecated, and scheduled for removal in Home Assistant Core 2025.10. |