diff --git a/homeassistant/components/sensibo/climate.py b/homeassistant/components/sensibo/climate.py index 906c4259ce5..a40cb110f66 100644 --- a/homeassistant/components/sensibo/climate.py +++ b/homeassistant/components/sensibo/climate.py @@ -252,7 +252,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): return features @property - def current_humidity(self) -> int | None: + def current_humidity(self) -> float | None: """Return the current humidity.""" return self.device_data.humidity diff --git a/homeassistant/components/sensibo/manifest.json b/homeassistant/components/sensibo/manifest.json index 610695aaf7b..4cadd3f8692 100644 --- a/homeassistant/components/sensibo/manifest.json +++ b/homeassistant/components/sensibo/manifest.json @@ -15,5 +15,5 @@ "iot_class": "cloud_polling", "loggers": ["pysensibo"], "quality_scale": "platinum", - "requirements": ["pysensibo==1.1.0"] + "requirements": ["pysensibo==1.2.1"] } diff --git a/homeassistant/components/sensibo/sensor.py b/homeassistant/components/sensibo/sensor.py index 09f095bfaec..bab85eb2294 100644 --- a/homeassistant/components/sensibo/sensor.py +++ b/homeassistant/components/sensibo/sensor.py @@ -101,14 +101,25 @@ MOTION_SENSOR_TYPES: tuple[SensiboMotionSensorEntityDescription, ...] = ( value_fn=lambda data: data.temperature, ), ) + + +def _pure_aqi(pm25_pure: PureAQI | None) -> str | None: + """Return the Pure aqi name or None if unknown.""" + if pm25_pure: + aqi_name = pm25_pure.name.lower() + if aqi_name != "unknown": + return aqi_name + return None + + PURE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( SensiboDeviceSensorEntityDescription( key="pm25", translation_key="pm25_pure", device_class=SensorDeviceClass.ENUM, - value_fn=lambda data: data.pm25_pure.name.lower() if data.pm25_pure else None, + value_fn=lambda data: _pure_aqi(data.pm25_pure), extra_fn=None, - options=[aqi.name.lower() for aqi in PureAQI], + options=[aqi.name.lower() for aqi in PureAQI if aqi.name != "UNKNOWN"], ), SensiboDeviceSensorEntityDescription( key="pure_sensitivity", @@ -119,6 +130,7 @@ PURE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( FILTER_LAST_RESET_DESCRIPTION, ) + DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( SensiboDeviceSensorEntityDescription( key="timer_time", diff --git a/requirements_all.txt b/requirements_all.txt index 9a5807d7b40..42c54364162 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2293,7 +2293,7 @@ pysaj==0.0.16 pyschlage==2025.4.0 # homeassistant.components.sensibo -pysensibo==1.1.0 +pysensibo==1.2.1 # homeassistant.components.serial pyserial-asyncio-fast==0.16 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 7491190cb92..aba6bd90c02 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1875,7 +1875,7 @@ pysabnzbd==1.1.1 pyschlage==2025.4.0 # homeassistant.components.sensibo -pysensibo==1.1.0 +pysensibo==1.2.1 # homeassistant.components.acer_projector # homeassistant.components.crownstone diff --git a/tests/components/sensibo/test_sensor.py b/tests/components/sensibo/test_sensor.py index 8ea76036123..7b7450b97a4 100644 --- a/tests/components/sensibo/test_sensor.py +++ b/tests/components/sensibo/test_sensor.py @@ -11,7 +11,7 @@ import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntry -from homeassistant.const import Platform +from homeassistant.const import STATE_UNKNOWN, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er @@ -45,3 +45,14 @@ async def test_sensor( state = hass.states.get("sensor.kitchen_pure_aqi") assert state.state == "moderate" + + mock_client.async_get_devices_data.return_value.parsed[ + "AAZZAAZZ" + ].pm25_pure = PureAQI(0) + + freezer.tick(timedelta(minutes=5)) + async_fire_time_changed(hass) + await hass.async_block_till_done() + + state = hass.states.get("sensor.kitchen_pure_aqi") + assert state.state == STATE_UNKNOWN