mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Lyric: Properly tie room accessories to the data coordinator (#115902)
* properly tie lyric accessories to the data coordinator so sensors recieve updates * only check for accessories for LCC devices * revert: meant to give it its own branch and PR
This commit is contained in:
parent
fb76e70c3f
commit
db238a75e3
@ -192,8 +192,8 @@ class LyricAccessoryEntity(LyricDeviceEntity):
|
||||
) -> None:
|
||||
"""Initialize the Honeywell Lyric accessory entity."""
|
||||
super().__init__(coordinator, location, device, key)
|
||||
self._room = room
|
||||
self._accessory = accessory
|
||||
self._room_id = room.id
|
||||
self._accessory_id = accessory.id
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
@ -202,11 +202,25 @@ class LyricAccessoryEntity(LyricDeviceEntity):
|
||||
identifiers={
|
||||
(
|
||||
f"{dr.CONNECTION_NETWORK_MAC}_room_accessory",
|
||||
f"{self._mac_id}_room{self._room.id}_accessory{self._accessory.id}",
|
||||
f"{self._mac_id}_room{self._room_id}_accessory{self._accessory_id}",
|
||||
)
|
||||
},
|
||||
manufacturer="Honeywell",
|
||||
model="RCHTSENSOR",
|
||||
name=f"{self._room.roomName} Sensor",
|
||||
name=f"{self.room.roomName} Sensor",
|
||||
via_device=(dr.CONNECTION_NETWORK_MAC, self._mac_id),
|
||||
)
|
||||
|
||||
@property
|
||||
def room(self) -> LyricRoom:
|
||||
"""Get the Lyric Device."""
|
||||
return self.coordinator.data.rooms_dict[self._mac_id][self._room_id]
|
||||
|
||||
@property
|
||||
def accessory(self) -> LyricAccessories:
|
||||
"""Get the Lyric Device."""
|
||||
return next(
|
||||
accessory
|
||||
for accessory in self.room.accessories
|
||||
if accessory.id == self._accessory_id
|
||||
)
|
||||
|
@ -244,7 +244,6 @@ class LyricAccessorySensor(LyricAccessoryEntity, SensorEntity):
|
||||
accessory,
|
||||
f"{parentDevice.macID}_room{room.id}_acc{accessory.id}_{description.key}",
|
||||
)
|
||||
self.room = room
|
||||
self.entity_description = description
|
||||
if description.device_class == SensorDeviceClass.TEMPERATURE:
|
||||
if parentDevice.units == "Fahrenheit":
|
||||
@ -255,4 +254,4 @@ class LyricAccessorySensor(LyricAccessoryEntity, SensorEntity):
|
||||
@property
|
||||
def native_value(self) -> StateType | datetime:
|
||||
"""Return the state."""
|
||||
return self.entity_description.value_fn(self._room, self._accessory)
|
||||
return self.entity_description.value_fn(self.room, self.accessory)
|
||||
|
Loading…
x
Reference in New Issue
Block a user