Skip to content

Commit

Permalink
filter error values from thermostat
Browse files Browse the repository at this point in the history
  • Loading branch information
karlblum committed Jan 3, 2025
1 parent e8d9a36 commit 48e762f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions custom_components/airobot_thermostat/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,25 @@ async def _async_update_data(self):
if co2_value == 65535:
co2_value = None # Set to None to indicate no valid CO2 reading

floor_temperature = status_data.get("TEMP_FLOOR", 0)
floor_temperature_available = 0 < floor_temperature < 32767
hum_air_value = status_data.get("HUM_AIR", 0) / 10
if hum_air_value > 100:
hum_air_value = None

temp_air_value = status_data.get("TEMP_AIR", 0) / 10
if temp_air_value > 100:
temp_air_value = None

floor_temperature = status_data.get("TEMP_FLOOR", 0) / 10
floor_temperature_available = 0 < floor_temperature < 100
if not floor_temperature_available:
floor_temperature = None


return {
"temperature": status_data.get("TEMP_AIR", 0) / 10,
"floor_temperature": status_data.get("TEMP_FLOOR", 0) / 10,
"temperature": temp_air_value,
"floor_temperature": floor_temperature,
"floor_temperature_available": floor_temperature_available,
"humidity": status_data.get("HUM_AIR", 0) / 10,
"humidity": hum_air_value,
"co2": co2_value,
"aqi": status_data.get("AQI", 0),
"setpoint_temp": setpoint_temp,
Expand Down

0 comments on commit 48e762f

Please sign in to comment.