From 33fe6ad647ef96108dc860cb8e822a79e1cdb92c Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 5 Mar 2024 22:37:53 +0100 Subject: [PATCH] Add icon translations to Tomorrowio (#112315) --- .../components/tomorrowio/icons.json | 48 +++++++++++++++++++ homeassistant/components/tomorrowio/sensor.py | 14 ------ 2 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 homeassistant/components/tomorrowio/icons.json diff --git a/homeassistant/components/tomorrowio/icons.json b/homeassistant/components/tomorrowio/icons.json new file mode 100644 index 00000000000..aa1d3782546 --- /dev/null +++ b/homeassistant/components/tomorrowio/icons.json @@ -0,0 +1,48 @@ +{ + "entity": { + "sensor": { + "dew_point": { + "default": "mdi:thermometer-water" + }, + "cloud_base": { + "default": "mdi:cloud-arrow-down" + }, + "cloud_ceiling": { + "default": "mdi:cloud-arrow-up" + }, + "cloud_cover": { + "default": "mdi:cloud-percent" + }, + "wind_gust": { + "default": "mdi:weather-windy" + }, + "precipitation_type": { + "default": "mdi:weather-snowy-rainy" + }, + "health_concern": { + "default": "mdi:hospital" + }, + "china_mep_health_concern": { + "default": "mdi:hospital" + }, + "pollen_index": { + "default": "mdi:tree" + }, + "weed_pollen_index": { + "default": "mdi:flower-pollen" + }, + "grass_pollen_index": { + "default": "mdi:grass" + }, + "fire_index": { + "default": "mdi:fire" + }, + "uv_index": { + "default": "mdi:sun-wireless" + }, + "uv_radiation_health_concern": { + "default": "mdi:weather-sunny-alert" + } + } + } +} diff --git a/homeassistant/components/tomorrowio/sensor.py b/homeassistant/components/tomorrowio/sensor.py index 6b285378e7e..d45be4aafdc 100644 --- a/homeassistant/components/tomorrowio/sensor.py +++ b/homeassistant/components/tomorrowio/sensor.py @@ -117,7 +117,6 @@ SENSOR_TYPES = ( key="dew_point", translation_key="dew_point", attribute=TMRW_ATTR_DEW_POINT, - icon="mdi:thermometer-water", native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -146,7 +145,6 @@ SENSOR_TYPES = ( key="cloud_base", translation_key="cloud_base", attribute=TMRW_ATTR_CLOUD_BASE, - icon="mdi:cloud-arrow-down", unit_imperial=UnitOfLength.MILES, unit_metric=UnitOfLength.KILOMETERS, device_class=SensorDeviceClass.DISTANCE, @@ -162,7 +160,6 @@ SENSOR_TYPES = ( key="cloud_ceiling", translation_key="cloud_ceiling", attribute=TMRW_ATTR_CLOUD_CEILING, - icon="mdi:cloud-arrow-up", unit_imperial=UnitOfLength.MILES, unit_metric=UnitOfLength.KILOMETERS, device_class=SensorDeviceClass.DISTANCE, @@ -177,7 +174,6 @@ SENSOR_TYPES = ( key="cloud_cover", translation_key="cloud_cover", attribute=TMRW_ATTR_CLOUD_COVER, - icon="mdi:cloud-percent", native_unit_of_measurement=PERCENTAGE, ), # Data comes in as m/s, convert to mi/h for imperial @@ -185,7 +181,6 @@ SENSOR_TYPES = ( key="wind_gust", translation_key="wind_gust", attribute=TMRW_ATTR_WIND_GUST, - icon="mdi:weather-windy", unit_imperial=UnitOfSpeed.MILES_PER_HOUR, unit_metric=UnitOfSpeed.METERS_PER_SECOND, device_class=SensorDeviceClass.SPEED, @@ -199,7 +194,6 @@ SENSOR_TYPES = ( translation_key="precipitation_type", attribute=TMRW_ATTR_PRECIPITATION_TYPE, value_map=PrecipitationType, - icon="mdi:weather-snowy-rainy", ), # Data comes in as ppb, convert to µg/m^3 # Molecular weight of Ozone is 48 @@ -272,7 +266,6 @@ SENSOR_TYPES = ( translation_key="health_concern", attribute=TMRW_ATTR_EPA_HEALTH_CONCERN, value_map=HealthConcernType, - icon="mdi:hospital", ), TomorrowioSensorEntityDescription( key="china_mep_air_quality_index", @@ -291,13 +284,11 @@ SENSOR_TYPES = ( translation_key="china_mep_health_concern", attribute=TMRW_ATTR_CHINA_HEALTH_CONCERN, value_map=HealthConcernType, - icon="mdi:hospital", ), TomorrowioSensorEntityDescription( key="tree_pollen_index", translation_key="pollen_index", attribute=TMRW_ATTR_POLLEN_TREE, - icon="mdi:tree", value_map=PollenIndex, ), TomorrowioSensorEntityDescription( @@ -305,34 +296,29 @@ SENSOR_TYPES = ( translation_key="weed_pollen_index", attribute=TMRW_ATTR_POLLEN_WEED, value_map=PollenIndex, - icon="mdi:flower-pollen", ), TomorrowioSensorEntityDescription( key="grass_pollen_index", translation_key="grass_pollen_index", attribute=TMRW_ATTR_POLLEN_GRASS, - icon="mdi:grass", value_map=PollenIndex, ), TomorrowioSensorEntityDescription( key="fire_index", translation_key="fire_index", attribute=TMRW_ATTR_FIRE_INDEX, - icon="mdi:fire", ), TomorrowioSensorEntityDescription( key="uv_index", translation_key="uv_index", attribute=TMRW_ATTR_UV_INDEX, state_class=SensorStateClass.MEASUREMENT, - icon="mdi:sun-wireless", ), TomorrowioSensorEntityDescription( key="uv_radiation_health_concern", translation_key="uv_radiation_health_concern", attribute=TMRW_ATTR_UV_HEALTH_CONCERN, value_map=UVDescription, - icon="mdi:weather-sunny-alert", ), )