Rename key of water level sensor in PEGELONLINE (#97289)
This commit is contained in:
parent
7113db8da4
commit
dce9a1b998
4 changed files with 8 additions and 8 deletions
|
@ -31,10 +31,10 @@ class PegelOnlineDataUpdateCoordinator(DataUpdateCoordinator[PegelOnlineData]):
|
|||
async def _async_update_data(self) -> PegelOnlineData:
|
||||
"""Fetch data from API endpoint."""
|
||||
try:
|
||||
current_measurement = await self.api.async_get_station_measurement(
|
||||
water_level = await self.api.async_get_station_measurement(
|
||||
self.station.uuid
|
||||
)
|
||||
except CONNECT_ERRORS as err:
|
||||
raise UpdateFailed(f"Failed to communicate with API: {err}") from err
|
||||
|
||||
return {"current_measurement": current_measurement}
|
||||
return {"water_level": water_level}
|
||||
|
|
|
@ -8,4 +8,4 @@ from aiopegelonline import CurrentMeasurement
|
|||
class PegelOnlineData(TypedDict):
|
||||
"""TypedDict for PEGELONLINE Coordinator Data."""
|
||||
|
||||
current_measurement: CurrentMeasurement
|
||||
water_level: CurrentMeasurement
|
||||
|
|
|
@ -37,11 +37,11 @@ class PegelOnlineSensorEntityDescription(
|
|||
|
||||
SENSORS: tuple[PegelOnlineSensorEntityDescription, ...] = (
|
||||
PegelOnlineSensorEntityDescription(
|
||||
key="current_measurement",
|
||||
translation_key="current_measurement",
|
||||
key="water_level",
|
||||
translation_key="water_level",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
fn_native_unit=lambda data: data["current_measurement"].uom,
|
||||
fn_native_value=lambda data: data["current_measurement"].value,
|
||||
fn_native_unit=lambda data: data["water_level"].uom,
|
||||
fn_native_value=lambda data: data["water_level"].value,
|
||||
icon="mdi:waves-arrow-up",
|
||||
),
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"current_measurement": {
|
||||
"water_level": {
|
||||
"name": "Water level"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue