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:
|
async def _async_update_data(self) -> PegelOnlineData:
|
||||||
"""Fetch data from API endpoint."""
|
"""Fetch data from API endpoint."""
|
||||||
try:
|
try:
|
||||||
current_measurement = await self.api.async_get_station_measurement(
|
water_level = await self.api.async_get_station_measurement(
|
||||||
self.station.uuid
|
self.station.uuid
|
||||||
)
|
)
|
||||||
except CONNECT_ERRORS as err:
|
except CONNECT_ERRORS as err:
|
||||||
raise UpdateFailed(f"Failed to communicate with API: {err}") from 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):
|
class PegelOnlineData(TypedDict):
|
||||||
"""TypedDict for PEGELONLINE Coordinator Data."""
|
"""TypedDict for PEGELONLINE Coordinator Data."""
|
||||||
|
|
||||||
current_measurement: CurrentMeasurement
|
water_level: CurrentMeasurement
|
||||||
|
|
|
@ -37,11 +37,11 @@ class PegelOnlineSensorEntityDescription(
|
||||||
|
|
||||||
SENSORS: tuple[PegelOnlineSensorEntityDescription, ...] = (
|
SENSORS: tuple[PegelOnlineSensorEntityDescription, ...] = (
|
||||||
PegelOnlineSensorEntityDescription(
|
PegelOnlineSensorEntityDescription(
|
||||||
key="current_measurement",
|
key="water_level",
|
||||||
translation_key="current_measurement",
|
translation_key="water_level",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
fn_native_unit=lambda data: data["current_measurement"].uom,
|
fn_native_unit=lambda data: data["water_level"].uom,
|
||||||
fn_native_value=lambda data: data["current_measurement"].value,
|
fn_native_value=lambda data: data["water_level"].value,
|
||||||
icon="mdi:waves-arrow-up",
|
icon="mdi:waves-arrow-up",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"current_measurement": {
|
"water_level": {
|
||||||
"name": "Water level"
|
"name": "Water level"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue