From dce9a1b9988a4a305bf14a819be153112440dd08 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:03:38 +0200 Subject: [PATCH] Rename key of water level sensor in PEGELONLINE (#97289) --- homeassistant/components/pegel_online/coordinator.py | 4 ++-- homeassistant/components/pegel_online/model.py | 2 +- homeassistant/components/pegel_online/sensor.py | 8 ++++---- homeassistant/components/pegel_online/strings.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/pegel_online/coordinator.py b/homeassistant/components/pegel_online/coordinator.py index 995953c5e36ed..8fab3ce36ae8f 100644 --- a/homeassistant/components/pegel_online/coordinator.py +++ b/homeassistant/components/pegel_online/coordinator.py @@ -31,10 +31,10 @@ def __init__( 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} diff --git a/homeassistant/components/pegel_online/model.py b/homeassistant/components/pegel_online/model.py index c1760d3261b6a..c8dac75bcf28d 100644 --- a/homeassistant/components/pegel_online/model.py +++ b/homeassistant/components/pegel_online/model.py @@ -8,4 +8,4 @@ class PegelOnlineData(TypedDict): """TypedDict for PEGELONLINE Coordinator Data.""" - current_measurement: CurrentMeasurement + water_level: CurrentMeasurement diff --git a/homeassistant/components/pegel_online/sensor.py b/homeassistant/components/pegel_online/sensor.py index 7d48635781bc7..14ec0c2d03228 100644 --- a/homeassistant/components/pegel_online/sensor.py +++ b/homeassistant/components/pegel_online/sensor.py @@ -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", ), ) diff --git a/homeassistant/components/pegel_online/strings.json b/homeassistant/components/pegel_online/strings.json index 71ec95f825cd3..930e349f9c3de 100644 --- a/homeassistant/components/pegel_online/strings.json +++ b/homeassistant/components/pegel_online/strings.json @@ -26,7 +26,7 @@ }, "entity": { "sensor": { - "current_measurement": { + "water_level": { "name": "Water level" } }