Skip to content

Commit

Permalink
Fix the outdoor temperature sensor and prevent similar issues in the …
Browse files Browse the repository at this point in the history
…future
  • Loading branch information
msvisser committed Feb 13, 2025
1 parent 5719b7e commit 439aa10
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/remeha_home/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="outdoorTemperature",
key="outdoorTemperatureInformation.applianceOutdoorTemperature",
name="Outdoor Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
Expand Down
1 change: 1 addition & 0 deletions custom_components/remeha_home/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def _async_update_data(self):
# handled by the data update coordinator.
async with asyncio.timeout(30):
data = await self.api.async_get_dashboard()
_LOGGER.debug("Requested dashboard information: %s", data)
except ClientResponseError as err:
# Raising ConfigEntryAuthFailed will cancel future updates
# and start a config flow with SOURCE_REAUTH (async_step_reauth)
Expand Down
6 changes: 6 additions & 0 deletions custom_components/remeha_home/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ def native_value(self):
"""Return the measurement value for this sensor."""
data = self._data
for part in self.entity_description.key.split("."):
# If the key is missing for some reason, don't crash, instead return None
if part not in data:
_LOGGER.warning(
"Key not found in data: %s", self.entity_description.key
)
return None
data = data[part]
value = data

Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Remeha Home",
"filename": "remeha_home.zip",
"homeassistant": "2024.10.4",
"homeassistant": "2025.1.4",
"render_readme": true,
"country": "NL",
"zip_release": true
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
colorlog==6.7.0
homeassistant==2024.10.4
homeassistant==2025.1.4
pip>=21.0,<23.2
ruff==0.0.292

0 comments on commit 439aa10

Please sign in to comment.