Remove unnecessary assignment of Template.hass from notify (#123680)

This commit is contained in:
Erik Montnemery 2024-08-12 15:53:19 +02:00 committed by GitHub
parent b04e3dc6fd
commit 268044cd01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 4 deletions

View File

@ -91,14 +91,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def persistent_notification(service: ServiceCall) -> None:
"""Send notification via the built-in persistent_notify integration."""
message: Template = service.data[ATTR_MESSAGE]
message.hass = hass
check_templates_warn(hass, message)
title = None
title_tpl: Template | None
if title_tpl := service.data.get(ATTR_TITLE):
check_templates_warn(hass, title_tpl)
title_tpl.hass = hass
title = title_tpl.async_render(parse_result=False)
notification_id = None

View File

@ -259,7 +259,6 @@ class BaseNotificationService:
title: Template | None
if title := service.data.get(ATTR_TITLE):
check_templates_warn(self.hass, title)
title.hass = self.hass
kwargs[ATTR_TITLE] = title.async_render(parse_result=False)
if self.registered_targets.get(service.service) is not None:
@ -268,7 +267,6 @@ class BaseNotificationService:
kwargs[ATTR_TARGET] = service.data.get(ATTR_TARGET)
check_templates_warn(self.hass, message)
message.hass = self.hass
kwargs[ATTR_MESSAGE] = message.async_render(parse_result=False)
kwargs[ATTR_DATA] = service.data.get(ATTR_DATA)