Template.hass is no longer automatically set when rendering templates
· One min read
With the merge of core PR #89242, 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
Templateobjects manually must pass a validhassobject to the constructor. This is in particular the case when creating templates for config entries. Not passing ahassobject will trigger a deprecation warning and fail in Home Assistant Core 2025.10. - The helper function
template.attachno 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.