mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Use TemplateStateFromEntityId in Template trigger entity (#130136)
This commit is contained in:
parent
48e7fed901
commit
742eca5927
@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.template import TemplateStateFromEntityId
|
||||
from homeassistant.helpers.trigger_template_entity import TriggerBaseEntity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
@ -41,11 +42,11 @@ class TriggerEntity( # pylint: disable=hass-enforce-class-module
|
||||
def _process_data(self) -> None:
|
||||
"""Process new data."""
|
||||
|
||||
this = None
|
||||
if state := self.hass.states.get(self.entity_id):
|
||||
this = state.as_dict()
|
||||
run_variables = self.coordinator.data["run_variables"]
|
||||
variables = {"this": this, **(run_variables or {})}
|
||||
variables = {
|
||||
"this": TemplateStateFromEntityId(self.hass, self.entity_id),
|
||||
**(run_variables or {}),
|
||||
}
|
||||
|
||||
self._render_templates(variables)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user