mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Remove unnecessary assignment of Template.hass from tcp (#123691)
This commit is contained in:
parent
78b6cdb201
commit
4639e7d5c7
@ -25,7 +25,6 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.exceptions import TemplateError
|
from homeassistant.exceptions import TemplateError
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.template import Template
|
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -63,10 +62,6 @@ class TcpEntity(Entity):
|
|||||||
def __init__(self, hass: HomeAssistant, config: ConfigType) -> None:
|
def __init__(self, hass: HomeAssistant, config: ConfigType) -> None:
|
||||||
"""Set all the config values if they exist and get initial state."""
|
"""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._hass = hass
|
||||||
self._config: TcpSensorConfig = {
|
self._config: TcpSensorConfig = {
|
||||||
CONF_NAME: config[CONF_NAME],
|
CONF_NAME: config[CONF_NAME],
|
||||||
@ -75,7 +70,7 @@ class TcpEntity(Entity):
|
|||||||
CONF_TIMEOUT: config[CONF_TIMEOUT],
|
CONF_TIMEOUT: config[CONF_TIMEOUT],
|
||||||
CONF_PAYLOAD: config[CONF_PAYLOAD],
|
CONF_PAYLOAD: config[CONF_PAYLOAD],
|
||||||
CONF_UNIT_OF_MEASUREMENT: config.get(CONF_UNIT_OF_MEASUREMENT),
|
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_VALUE_ON: config.get(CONF_VALUE_ON),
|
||||||
CONF_BUFFER_SIZE: config[CONF_BUFFER_SIZE],
|
CONF_BUFFER_SIZE: config[CONF_BUFFER_SIZE],
|
||||||
CONF_SSL: config[CONF_SSL],
|
CONF_SSL: config[CONF_SSL],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user