diff --git a/homeassistant/components/climacell/const.py b/homeassistant/components/climacell/const.py index 977a5089783..0352807138a 100644 --- a/homeassistant/components/climacell/const.py +++ b/homeassistant/components/climacell/const.py @@ -6,6 +6,7 @@ from pyclimacell.const import ( HealthConcernType, PollenIndex, PrimaryPollutantType, + V3PollenIndex, WeatherCode, ) @@ -307,8 +308,20 @@ CC_V3_SENSOR_TYPES = [ ATTR_FIELD: CC_V3_ATTR_CHINA_HEALTH_CONCERN, ATTR_NAME: "China MEP Health Concern", }, - {ATTR_FIELD: CC_V3_ATTR_POLLEN_TREE, ATTR_NAME: "Tree Pollen Index"}, - {ATTR_FIELD: CC_V3_ATTR_POLLEN_WEED, ATTR_NAME: "Weed Pollen Index"}, - {ATTR_FIELD: CC_V3_ATTR_POLLEN_GRASS, ATTR_NAME: "Grass Pollen Index"}, + { + ATTR_FIELD: CC_V3_ATTR_POLLEN_TREE, + ATTR_NAME: "Tree Pollen Index", + ATTR_VALUE_MAP: V3PollenIndex, + }, + { + ATTR_FIELD: CC_V3_ATTR_POLLEN_WEED, + ATTR_NAME: "Weed Pollen Index", + ATTR_VALUE_MAP: V3PollenIndex, + }, + { + ATTR_FIELD: CC_V3_ATTR_POLLEN_GRASS, + ATTR_NAME: "Grass Pollen Index", + ATTR_VALUE_MAP: V3PollenIndex, + }, {ATTR_FIELD: CC_V3_ATTR_FIRE_INDEX, ATTR_NAME: "Fire Index"}, ] diff --git a/homeassistant/components/climacell/manifest.json b/homeassistant/components/climacell/manifest.json index 89f6d7bf846..bb7dea841e4 100644 --- a/homeassistant/components/climacell/manifest.json +++ b/homeassistant/components/climacell/manifest.json @@ -3,7 +3,7 @@ "name": "ClimaCell", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/climacell", - "requirements": ["pyclimacell==0.18.0"], + "requirements": ["pyclimacell==0.18.2"], "codeowners": ["@raman325"], "iot_class": "cloud_polling" } diff --git a/homeassistant/components/climacell/sensor.py b/homeassistant/components/climacell/sensor.py index fc35f2c2a2e..df611079403 100644 --- a/homeassistant/components/climacell/sensor.py +++ b/homeassistant/components/climacell/sensor.py @@ -128,7 +128,7 @@ class BaseClimaCellSensorEntity(ClimaCellEntity, SensorEntity): ): return round(self._state * self.sensor_type[ATTR_METRIC_CONVERSION], 4) - if ATTR_VALUE_MAP in self.sensor_type: + if ATTR_VALUE_MAP in self.sensor_type and self._state is not None: return self.sensor_type[ATTR_VALUE_MAP](self._state).name.lower() return self._state diff --git a/requirements_all.txt b/requirements_all.txt index b79b989ab1e..2e4c10e7f6d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1319,7 +1319,7 @@ pychromecast==9.1.2 pycketcasts==1.0.0 # homeassistant.components.climacell -pyclimacell==0.18.0 +pyclimacell==0.18.2 # homeassistant.components.cmus pycmus==0.1.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 82130eb6f41..3e96e843884 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -720,7 +720,7 @@ pycfdns==1.2.1 pychromecast==9.1.2 # homeassistant.components.climacell -pyclimacell==0.18.0 +pyclimacell==0.18.2 # homeassistant.components.comfoconnect pycomfoconnect==0.4 diff --git a/tests/components/climacell/test_sensor.py b/tests/components/climacell/test_sensor.py index 7757fe208d3..44fc163848b 100644 --- a/tests/components/climacell/test_sensor.py +++ b/tests/components/climacell/test_sensor.py @@ -119,9 +119,9 @@ async def test_v3_sensor( check_sensor_state(hass, EPA_HEALTH_CONCERN, "Good") check_sensor_state(hass, EPA_PRIMARY_POLLUTANT, "pm25") check_sensor_state(hass, FIRE_INDEX, "9") - check_sensor_state(hass, GRASS_POLLEN, "0") - check_sensor_state(hass, WEED_POLLEN, "0") - check_sensor_state(hass, TREE_POLLEN, "0") + check_sensor_state(hass, GRASS_POLLEN, "minimal_to_none") + check_sensor_state(hass, WEED_POLLEN, "minimal_to_none") + check_sensor_state(hass, TREE_POLLEN, "minimal_to_none") async def test_v4_sensor(