Remove unnecessary assignment of Template.hass from triggers (#123672)

This commit is contained in:
Erik Montnemery 2024-08-12 14:54:03 +02:00 committed by GitHub
parent 77e9acd864
commit 33a22ae208
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 0 additions and 11 deletions

View file

@ -60,7 +60,6 @@ async def async_attach_trigger(
trigger_data = trigger_info["trigger_data"]
variables = trigger_info["variables"]
template.attach(hass, config[CONF_EVENT_TYPE])
event_types = template.render_complex(
config[CONF_EVENT_TYPE], variables, limited=True
)
@ -72,7 +71,6 @@ async def async_attach_trigger(
event_data_items: ItemsView | None = None
if CONF_EVENT_DATA in config:
# Render the schema input
template.attach(hass, config[CONF_EVENT_DATA])
event_data = {}
event_data.update(
template.render_complex(config[CONF_EVENT_DATA], variables, limited=True)
@ -94,7 +92,6 @@ async def async_attach_trigger(
event_context_items: ItemsView | None = None
if CONF_EVENT_CONTEXT in config:
# Render the schema input
template.attach(hass, config[CONF_EVENT_CONTEXT])
event_context = {}
event_context.update(
template.render_complex(config[CONF_EVENT_CONTEXT], variables, limited=True)

View file

@ -108,7 +108,6 @@ async def async_attach_trigger(
below = config.get(CONF_BELOW)
above = config.get(CONF_ABOVE)
time_delta = config.get(CONF_FOR)
template.attach(hass, time_delta)
value_template = config.get(CONF_VALUE_TEMPLATE)
unsub_track_same: dict[str, Callable[[], None]] = {}
armed_entities: set[str] = set()
@ -119,9 +118,6 @@ async def async_attach_trigger(
trigger_data = trigger_info["trigger_data"]
_variables = trigger_info["variables"] or {}
if value_template is not None:
value_template.hass = hass
def variables(entity_id: str) -> dict[str, Any]:
"""Return a dict with trigger variables."""
trigger_info = {

View file

@ -117,7 +117,6 @@ async def async_attach_trigger(
match_to_state = process_state_match(MATCH_ALL)
time_delta = config.get(CONF_FOR)
template.attach(hass, time_delta)
# If neither CONF_FROM or CONF_TO are specified,
# fire on all changes to the state or an attribute
match_all = all(

View file

@ -131,9 +131,6 @@ class HpIloSensor(SensorEntity):
self._unit_of_measurement = unit_of_measurement
self._ilo_function = SENSOR_TYPES[sensor_type][1]
self.hp_ilo_data = hp_ilo_data
if sensor_value_template is not None:
sensor_value_template.hass = hass
self._sensor_value_template = sensor_value_template
self._state = None