Set GoogleEntity entity_id in constructor (#124830)
parent
3d39f6ce88
commit
4b59ef4733
|
@ -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"<GoogleEntity {self.state.entity_id}: {self.state.name}>"
|
||||
|
||||
@property
|
||||
def entity_id(self):
|
||||
"""Return entity ID."""
|
||||
return self.state.entity_id
|
||||
|
||||
@callback
|
||||
def traits(self) -> list[trait._Trait]:
|
||||
"""Return traits for entity."""
|
||||
|
|
Loading…
Reference in New Issue