From e8101d497bd7768f3662192c4d3aa5bf8f2412b2 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:41:26 -0500 Subject: [PATCH 1/2] Add state translations and icons to ClimaCell sensors --- homeassistant/components/climacell/const.py | 11 ++++++++ .../components/climacell/strings.json | 2 +- .../components/climacell/strings.sensor.json | 27 +++++++++++++++++++ .../components/climacell/translations/en.json | 3 +-- .../climacell/translations/sensor.en.json | 27 +++++++++++++++++++ 5 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 homeassistant/components/climacell/strings.sensor.json create mode 100644 homeassistant/components/climacell/translations/sensor.en.json diff --git a/homeassistant/components/climacell/const.py b/homeassistant/components/climacell/const.py index 83152cc38f2a4b..7da259f614af76 100644 --- a/homeassistant/components/climacell/const.py +++ b/homeassistant/components/climacell/const.py @@ -246,6 +246,7 @@ def __post_init__(self) -> None: key=CC_ATTR_PRECIPITATION_TYPE, name="Precipitation Type", value_map=PrecipitationType, + device_class="climacell__precipitation_type", ), ClimaCellSensorEntityDescription( key=CC_ATTR_OZONE, @@ -301,6 +302,8 @@ def __post_init__(self) -> None: key=CC_ATTR_EPA_HEALTH_CONCERN, name="US EPA Health Concern", value_map=HealthConcernType, + device_class="climacell__health_concern", + icon="mdi:hospital", ), ClimaCellSensorEntityDescription( key=CC_ATTR_CHINA_AQI, @@ -315,21 +318,29 @@ def __post_init__(self) -> None: key=CC_ATTR_CHINA_HEALTH_CONCERN, name="China MEP Health Concern", value_map=HealthConcernType, + device_class="climacell__health_concern", + icon="mdi:hospital", ), ClimaCellSensorEntityDescription( key=CC_ATTR_POLLEN_TREE, name="Tree Pollen Index", value_map=PollenIndex, + device_class="climacell__pollen_index", + icon="mdi:flower-pollen", ), ClimaCellSensorEntityDescription( key=CC_ATTR_POLLEN_WEED, name="Weed Pollen Index", value_map=PollenIndex, + device_class="climacell__pollen_index", + icon="mdi:flower-pollen", ), ClimaCellSensorEntityDescription( key=CC_ATTR_POLLEN_GRASS, name="Grass Pollen Index", value_map=PollenIndex, + device_class="climacell__pollen_index", + icon="mdi:flower-pollen", ), ClimaCellSensorEntityDescription( CC_ATTR_FIRE_INDEX, diff --git a/homeassistant/components/climacell/strings.json b/homeassistant/components/climacell/strings.json index 44021f4b6d0668..7b6e01b8dd4e77 100644 --- a/homeassistant/components/climacell/strings.json +++ b/homeassistant/components/climacell/strings.json @@ -22,7 +22,7 @@ "options": { "step": { "init": { - "title": "Update [%key:component::climacell::title%] Options", + "title": "Update ClimaCell Options", "description": "If you choose to enable the `nowcast` forecast entity, you can configure the number of minutes between each forecast. The number of forecasts provided depends on the number of minutes chosen between forecasts.", "data": { "timestep": "Min. Between NowCast Forecasts" diff --git a/homeassistant/components/climacell/strings.sensor.json b/homeassistant/components/climacell/strings.sensor.json new file mode 100644 index 00000000000000..1864a0340433a3 --- /dev/null +++ b/homeassistant/components/climacell/strings.sensor.json @@ -0,0 +1,27 @@ +{ + "state": { + "climacell__pollen_index": { + "none": "None", + "very_low": "Very Low", + "low": "Low", + "medium": "Medium", + "high": "High", + "very_high": "Very High" + }, + "climacell__health_concern": { + "good": "Good", + "moderate": "Moderate", + "unhealthy_for_sensitive_groups": "Unhealthy for Sensitive Groups", + "unhealthy": "Unhealthy", + "very_unhealthy": "Very Unhealthy", + "hazardous": "Hazardous" + }, + "climacell__precipitation_type": { + "none": "None", + "rain": "Rain", + "snow": "Snow", + "freezing_rain": "Freezing Rain", + "ice_pellets": "Ice Pellets" + } + } +} diff --git a/homeassistant/components/climacell/translations/en.json b/homeassistant/components/climacell/translations/en.json index 3e5cd436ba8382..920e2a1443e540 100644 --- a/homeassistant/components/climacell/translations/en.json +++ b/homeassistant/components/climacell/translations/en.json @@ -29,6 +29,5 @@ "title": "Update ClimaCell Options" } } - }, - "title": "ClimaCell" + } } \ No newline at end of file diff --git a/homeassistant/components/climacell/translations/sensor.en.json b/homeassistant/components/climacell/translations/sensor.en.json new file mode 100644 index 00000000000000..0cb1d27aaec588 --- /dev/null +++ b/homeassistant/components/climacell/translations/sensor.en.json @@ -0,0 +1,27 @@ +{ + "state": { + "climacell__health_concern": { + "good": "Good", + "hazardous": "Hazardous", + "moderate": "Moderate", + "unhealthy": "Unhealthy", + "unhealthy_for_sensitive_groups": "Unhealthy for Sensitive Groups", + "very_unhealthy": "Very Unhealthy" + }, + "climacell__pollen_index": { + "high": "High", + "low": "Low", + "medium": "Medium", + "none": "None", + "very_high": "Very High", + "very_low": "Very Low" + }, + "climacell__precipitation_type": { + "freezing_rain": "Freezing Rain", + "ice_pellets": "Ice Pellets", + "none": "None", + "rain": "Rain", + "snow": "Snow" + } + } +} \ No newline at end of file From cb4b91613e271314b640ac6f1b3e585230ed3737 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:59:46 -0500 Subject: [PATCH 2/2] additional icons --- homeassistant/components/climacell/const.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/climacell/const.py b/homeassistant/components/climacell/const.py index 7da259f614af76..69567bf65fc5b5 100644 --- a/homeassistant/components/climacell/const.py +++ b/homeassistant/components/climacell/const.py @@ -247,6 +247,7 @@ def __post_init__(self) -> None: name="Precipitation Type", value_map=PrecipitationType, device_class="climacell__precipitation_type", + icon="mdi:weather-snowy-rainy", ), ClimaCellSensorEntityDescription( key=CC_ATTR_OZONE, @@ -345,6 +346,7 @@ def __post_init__(self) -> None: ClimaCellSensorEntityDescription( CC_ATTR_FIRE_INDEX, name="Fire Index", + icon="mdi:fire", ), )