diff --git a/custom_components/alpha_innotec/climate.py b/custom_components/alpha_innotec/climate.py index f237842..2714109 100644 --- a/custom_components/alpha_innotec/climate.py +++ b/custom_components/alpha_innotec/climate.py @@ -93,12 +93,12 @@ def _handle_coordinator_update(self) -> None: @property def current_temperature(self) -> float | None: """Return the current temperature.""" - return self.thermostat.current_temperature if isinstance(self.thermostat.current_temperature, float) else None + return self.thermostat.current_temperature if isinstance(self.thermostat.current_temperature, (float, int)) else None @property def target_temperature(self) -> float: """Return the temperature we try to reach.""" - return self.thermostat.desired_temperature if isinstance(self.thermostat.desired_temperature, float) else None + return self.thermostat.desired_temperature if isinstance(self.thermostat.desired_temperature, (float, int)) else None async def async_set_temperature(self, **kwargs) -> None: """Set new target temperature.""" diff --git a/custom_components/alpha_innotec/coordinator.py b/custom_components/alpha_innotec/coordinator.py index bed0613..744662e 100644 --- a/custom_components/alpha_innotec/coordinator.py +++ b/custom_components/alpha_innotec/coordinator.py @@ -54,6 +54,9 @@ async def _async_update_data(self) -> dict[str, list[Valve | Thermostat]]: current_temperature = module_details["currentTemperature"] battery_percentage = module_details["battery"] + if room.get('status', 'problem') == 'problem': + _LOGGER.error("According to the API there is a problem with: %s", room['name']) + thermostat = Thermostat( identifier=room_id, name=room['name'], diff --git a/custom_components/alpha_innotec/sensor.py b/custom_components/alpha_innotec/sensor.py index ca2677f..4ef05f1 100644 --- a/custom_components/alpha_innotec/sensor.py +++ b/custom_components/alpha_innotec/sensor.py @@ -76,7 +76,7 @@ def name(self) -> str | UndefinedType | None: @property def native_value(self): - return self.thermostat.battery_percentage if self.thermostat.battery_percentage != "unknown" else None + return self.thermostat.battery_percentage if isinstance(self.thermostat.battery_percentage, (float, int)) else None @callback def _handle_coordinator_update(self) -> None: