mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Add value map for Climacell V3 pollen sensors (#50200)
This commit is contained in:
parent
7b07bc2d65
commit
9f1b1c6c56
@ -6,6 +6,7 @@ from pyclimacell.const import (
|
|||||||
HealthConcernType,
|
HealthConcernType,
|
||||||
PollenIndex,
|
PollenIndex,
|
||||||
PrimaryPollutantType,
|
PrimaryPollutantType,
|
||||||
|
V3PollenIndex,
|
||||||
WeatherCode,
|
WeatherCode,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -307,8 +308,20 @@ CC_V3_SENSOR_TYPES = [
|
|||||||
ATTR_FIELD: CC_V3_ATTR_CHINA_HEALTH_CONCERN,
|
ATTR_FIELD: CC_V3_ATTR_CHINA_HEALTH_CONCERN,
|
||||||
ATTR_NAME: "China MEP 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_TREE,
|
||||||
{ATTR_FIELD: CC_V3_ATTR_POLLEN_GRASS, ATTR_NAME: "Grass Pollen Index"},
|
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"},
|
{ATTR_FIELD: CC_V3_ATTR_FIRE_INDEX, ATTR_NAME: "Fire Index"},
|
||||||
]
|
]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "ClimaCell",
|
"name": "ClimaCell",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/climacell",
|
"documentation": "https://www.home-assistant.io/integrations/climacell",
|
||||||
"requirements": ["pyclimacell==0.18.0"],
|
"requirements": ["pyclimacell==0.18.2"],
|
||||||
"codeowners": ["@raman325"],
|
"codeowners": ["@raman325"],
|
||||||
"iot_class": "cloud_polling"
|
"iot_class": "cloud_polling"
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ class BaseClimaCellSensorEntity(ClimaCellEntity, SensorEntity):
|
|||||||
):
|
):
|
||||||
return round(self._state * self.sensor_type[ATTR_METRIC_CONVERSION], 4)
|
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.sensor_type[ATTR_VALUE_MAP](self._state).name.lower()
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@ -1319,7 +1319,7 @@ pychromecast==9.1.2
|
|||||||
pycketcasts==1.0.0
|
pycketcasts==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.climacell
|
# homeassistant.components.climacell
|
||||||
pyclimacell==0.18.0
|
pyclimacell==0.18.2
|
||||||
|
|
||||||
# homeassistant.components.cmus
|
# homeassistant.components.cmus
|
||||||
pycmus==0.1.1
|
pycmus==0.1.1
|
||||||
|
@ -720,7 +720,7 @@ pycfdns==1.2.1
|
|||||||
pychromecast==9.1.2
|
pychromecast==9.1.2
|
||||||
|
|
||||||
# homeassistant.components.climacell
|
# homeassistant.components.climacell
|
||||||
pyclimacell==0.18.0
|
pyclimacell==0.18.2
|
||||||
|
|
||||||
# homeassistant.components.comfoconnect
|
# homeassistant.components.comfoconnect
|
||||||
pycomfoconnect==0.4
|
pycomfoconnect==0.4
|
||||||
|
@ -119,9 +119,9 @@ async def test_v3_sensor(
|
|||||||
check_sensor_state(hass, EPA_HEALTH_CONCERN, "Good")
|
check_sensor_state(hass, EPA_HEALTH_CONCERN, "Good")
|
||||||
check_sensor_state(hass, EPA_PRIMARY_POLLUTANT, "pm25")
|
check_sensor_state(hass, EPA_PRIMARY_POLLUTANT, "pm25")
|
||||||
check_sensor_state(hass, FIRE_INDEX, "9")
|
check_sensor_state(hass, FIRE_INDEX, "9")
|
||||||
check_sensor_state(hass, GRASS_POLLEN, "0")
|
check_sensor_state(hass, GRASS_POLLEN, "minimal_to_none")
|
||||||
check_sensor_state(hass, WEED_POLLEN, "0")
|
check_sensor_state(hass, WEED_POLLEN, "minimal_to_none")
|
||||||
check_sensor_state(hass, TREE_POLLEN, "0")
|
check_sensor_state(hass, TREE_POLLEN, "minimal_to_none")
|
||||||
|
|
||||||
|
|
||||||
async def test_v4_sensor(
|
async def test_v4_sensor(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user