From a0df91dedfc307793d42285d408dad2ddd6908f2 Mon Sep 17 00:00:00 2001 From: Artem Sorokin Date: Thu, 12 Dec 2024 15:04:41 +0300 Subject: [PATCH] Remove redundant hass object assignment to templates --- custom_components/yandex_smart_home/capability_custom.py | 2 -- custom_components/yandex_smart_home/device.py | 6 +----- custom_components/yandex_smart_home/property_custom.py | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/custom_components/yandex_smart_home/capability_custom.py b/custom_components/yandex_smart_home/capability_custom.py index 1ade2c11..c7b7b958 100644 --- a/custom_components/yandex_smart_home/capability_custom.py +++ b/custom_components/yandex_smart_home/capability_custom.py @@ -86,8 +86,6 @@ def __init__( self._entry_data = entry_data self._config = config self._value_template = value_template - if self._value_template: - self._value_template.hass = hass self.device_id = device_id self.instance = instance diff --git a/custom_components/yandex_smart_home/device.py b/custom_components/yandex_smart_home/device.py index 7113cb4a..d952b835 100644 --- a/custom_components/yandex_smart_home/device.py +++ b/custom_components/yandex_smart_home/device.py @@ -483,11 +483,7 @@ def _get_entry_alias(self, aliases: set[str] | None) -> str | None: @property def _error_code_template(self) -> Template | None: """Prepare template for error code.""" - template: Template | None = self._config.get(CONF_ERROR_CODE_TEMPLATE) - if template is not None: - template.hass = self._hass - - return template + return self._config.get(CONF_ERROR_CODE_TEMPLATE) async def async_get_devices(hass: HomeAssistant, entry_data: ConfigEntryData) -> list[Device]: diff --git a/custom_components/yandex_smart_home/property_custom.py b/custom_components/yandex_smart_home/property_custom.py index 90525b4b..ab475eea 100644 --- a/custom_components/yandex_smart_home/property_custom.py +++ b/custom_components/yandex_smart_home/property_custom.py @@ -94,7 +94,6 @@ def __init__( self._entry_data = entry_data self._config = config self._value_template = value_template - self._value_template.hass = hass self.device_id = device_id