Skip to content

Commit

Permalink
Rename key of water level sensor in PEGELONLINE (home-assistant#97289)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored Jul 26, 2023
1 parent 7113db8 commit dce9a1b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/pegel_online/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion homeassistant/components/pegel_online/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
class PegelOnlineData(TypedDict):
"""TypedDict for PEGELONLINE Coordinator Data."""

current_measurement: CurrentMeasurement
water_level: CurrentMeasurement
8 changes: 4 additions & 4 deletions homeassistant/components/pegel_online/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/pegel_online/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"entity": {
"sensor": {
"current_measurement": {
"water_level": {
"name": "Water level"
}
}
Expand Down

0 comments on commit dce9a1b

Please sign in to comment.