From 4b59ef4733b8c4e219914b89e4b7df76fc7098ce Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 28 Aug 2024 15:47:11 -1000 Subject: [PATCH] Set GoogleEntity entity_id in constructor (#124830) --- homeassistant/components/google_assistant/helpers.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index 7f8f7a68ffa..76869487ee3 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -521,7 +521,7 @@ def supported_traits_for_state(state: State) -> list[type[trait._Trait]]: class GoogleEntity: """Adaptation of Entity expressed in Google's terms.""" - __slots__ = ("hass", "config", "state", "_traits") + __slots__ = ("hass", "config", "state", "entity_id", "_traits") def __init__( self, hass: HomeAssistant, config: AbstractConfig, state: State @@ -530,17 +530,13 @@ class GoogleEntity: self.hass = hass self.config = config self.state = state + self.entity_id = state.entity_id self._traits: list[trait._Trait] | None = None def __repr__(self) -> str: """Return the representation.""" return f"" - @property - def entity_id(self): - """Return entity ID.""" - return self.state.entity_id - @callback def traits(self) -> list[trait._Trait]: """Return traits for entity."""