From 4639e7d5c7693a3a48b8f784bb2ba4acac9ad716 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 12 Aug 2024 15:49:37 +0200 Subject: [PATCH] Remove unnecessary assignment of Template.hass from tcp (#123691) --- homeassistant/components/tcp/common.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/homeassistant/components/tcp/common.py b/homeassistant/components/tcp/common.py index d6a7fb28f11..263fc416026 100644 --- a/homeassistant/components/tcp/common.py +++ b/homeassistant/components/tcp/common.py @@ -25,7 +25,6 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity -from homeassistant.helpers.template import Template from homeassistant.helpers.typing import ConfigType from .const import ( @@ -63,10 +62,6 @@ class TcpEntity(Entity): def __init__(self, hass: HomeAssistant, config: ConfigType) -> None: """Set all the config values if they exist and get initial state.""" - value_template: Template | None = config.get(CONF_VALUE_TEMPLATE) - if value_template is not None: - value_template.hass = hass - self._hass = hass self._config: TcpSensorConfig = { CONF_NAME: config[CONF_NAME], @@ -75,7 +70,7 @@ class TcpEntity(Entity): CONF_TIMEOUT: config[CONF_TIMEOUT], CONF_PAYLOAD: config[CONF_PAYLOAD], CONF_UNIT_OF_MEASUREMENT: config.get(CONF_UNIT_OF_MEASUREMENT), - CONF_VALUE_TEMPLATE: value_template, + CONF_VALUE_TEMPLATE: config.get(CONF_VALUE_TEMPLATE), CONF_VALUE_ON: config.get(CONF_VALUE_ON), CONF_BUFFER_SIZE: config[CONF_BUFFER_SIZE], CONF_SSL: config[CONF_SSL],