Remove unnecessary assignment of Template.hass from tcp (#123691)

This commit is contained in:
Erik Montnemery 2024-08-12 15:49:37 +02:00 committed by GitHub
parent 78b6cdb201
commit 4639e7d5c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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],