From 268044cd015207d370ec8bce31a9a266d5590a89 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 12 Aug 2024 15:53:19 +0200 Subject: [PATCH] Remove unnecessary assignment of Template.hass from notify (#123680) --- homeassistant/components/notify/__init__.py | 2 -- homeassistant/components/notify/legacy.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/homeassistant/components/notify/__init__.py b/homeassistant/components/notify/__init__.py index 1fc7836ecd8..31c7b8e4d70 100644 --- a/homeassistant/components/notify/__init__.py +++ b/homeassistant/components/notify/__init__.py @@ -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 diff --git a/homeassistant/components/notify/legacy.py b/homeassistant/components/notify/legacy.py index 81444a36296..dcb148a99f5 100644 --- a/homeassistant/components/notify/legacy.py +++ b/homeassistant/components/notify/legacy.py @@ -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)