mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix LaCrosse View not updating (#79474)
This commit is contained in:
parent
da960f6ed4
commit
d6a6d0d754
@ -105,7 +105,7 @@ async def async_setup_entry(
|
|||||||
sensors: list[Sensor] = coordinator.data
|
sensors: list[Sensor] = coordinator.data
|
||||||
|
|
||||||
sensor_list = []
|
sensor_list = []
|
||||||
for sensor in sensors:
|
for i, sensor in enumerate(sensors):
|
||||||
for field in sensor.sensor_field_names:
|
for field in sensor.sensor_field_names:
|
||||||
description = SENSOR_DESCRIPTIONS.get(field)
|
description = SENSOR_DESCRIPTIONS.get(field)
|
||||||
if description is None:
|
if description is None:
|
||||||
@ -125,6 +125,7 @@ async def async_setup_entry(
|
|||||||
coordinator=coordinator,
|
coordinator=coordinator,
|
||||||
description=description,
|
description=description,
|
||||||
sensor=sensor,
|
sensor=sensor,
|
||||||
|
index=i,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -144,6 +145,7 @@ class LaCrosseViewSensor(
|
|||||||
description: LaCrosseSensorEntityDescription,
|
description: LaCrosseSensorEntityDescription,
|
||||||
coordinator: DataUpdateCoordinator[list[Sensor]],
|
coordinator: DataUpdateCoordinator[list[Sensor]],
|
||||||
sensor: Sensor,
|
sensor: Sensor,
|
||||||
|
index: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
@ -157,11 +159,11 @@ class LaCrosseViewSensor(
|
|||||||
"model": sensor.model,
|
"model": sensor.model,
|
||||||
"via_device": (DOMAIN, sensor.location.id),
|
"via_device": (DOMAIN, sensor.location.id),
|
||||||
}
|
}
|
||||||
self._sensor = sensor
|
self.index = index
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> float | str:
|
def native_value(self) -> float | str:
|
||||||
"""Return the sensor value."""
|
"""Return the sensor value."""
|
||||||
return self.entity_description.value_fn(
|
return self.entity_description.value_fn(
|
||||||
self._sensor, self.entity_description.key
|
self.coordinator.data[self.index], self.entity_description.key
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user