From 6d42af1b128658d823f2266bf6f2101e6289c382 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Fri, 7 Jan 2022 08:08:49 -0500 Subject: [PATCH] Add state translations and icons to ClimaCell sensors (#63526) --- homeassistant/components/climacell/const.py | 13 +++++++++ .../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, 69 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 83152cc38f2..69567bf65fc 100644 --- a/homeassistant/components/climacell/const.py +++ b/homeassistant/components/climacell/const.py @@ -246,6 +246,8 @@ CC_SENSOR_TYPES = ( key=CC_ATTR_PRECIPITATION_TYPE, name="Precipitation Type", value_map=PrecipitationType, + device_class="climacell__precipitation_type", + icon="mdi:weather-snowy-rainy", ), ClimaCellSensorEntityDescription( key=CC_ATTR_OZONE, @@ -301,6 +303,8 @@ CC_SENSOR_TYPES = ( 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,25 +319,34 @@ CC_SENSOR_TYPES = ( 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, name="Fire Index", + icon="mdi:fire", ), ) diff --git a/homeassistant/components/climacell/strings.json b/homeassistant/components/climacell/strings.json index 44021f4b6d0..7b6e01b8dd4 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 00000000000..1864a034043 --- /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 3e5cd436ba8..920e2a1443e 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 00000000000..0cb1d27aaec --- /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