Fix LaCrosse View not updating (#79474)
This commit is contained in:
parent
da960f6ed4
commit
d6a6d0d754
1 changed files with 5 additions and 3 deletions
|
@ -105,7 +105,7 @@ async def async_setup_entry(
|
|||
sensors: list[Sensor] = coordinator.data
|
||||
|
||||
sensor_list = []
|
||||
for sensor in sensors:
|
||||
for i, sensor in enumerate(sensors):
|
||||
for field in sensor.sensor_field_names:
|
||||
description = SENSOR_DESCRIPTIONS.get(field)
|
||||
if description is None:
|
||||
|
@ -125,6 +125,7 @@ async def async_setup_entry(
|
|||
coordinator=coordinator,
|
||||
description=description,
|
||||
sensor=sensor,
|
||||
index=i,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -144,6 +145,7 @@ class LaCrosseViewSensor(
|
|||
description: LaCrosseSensorEntityDescription,
|
||||
coordinator: DataUpdateCoordinator[list[Sensor]],
|
||||
sensor: Sensor,
|
||||
index: int,
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(coordinator)
|
||||
|
@ -157,11 +159,11 @@ class LaCrosseViewSensor(
|
|||
"model": sensor.model,
|
||||
"via_device": (DOMAIN, sensor.location.id),
|
||||
}
|
||||
self._sensor = sensor
|
||||
self.index = index
|
||||
|
||||
@property
|
||||
def native_value(self) -> float | str:
|
||||
"""Return the sensor value."""
|
||||
return self.entity_description.value_fn(
|
||||
self._sensor, self.entity_description.key
|
||||
self.coordinator.data[self.index], self.entity_description.key
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue