Add icon translations to GIOS (#110131)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
This commit is contained in:
parent
e81a9947e0
commit
0954e4cd73
3 changed files with 31 additions and 9 deletions
30
homeassistant/components/gios/icons.json
Normal file
30
homeassistant/components/gios/icons.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"aqi": {
|
||||
"default": "mdi:air-filter"
|
||||
},
|
||||
"c6h6": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"co": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"no2_index": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"o3_index": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"pm10_index": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"pm25_index": {
|
||||
"default": "mdi:molecule"
|
||||
},
|
||||
"so2_index": {
|
||||
"default": "mdi:molecule"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,7 +54,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
GiosSensorEntityDescription(
|
||||
key=ATTR_AQI,
|
||||
value=lambda sensors: sensors.aqi.value if sensors.aqi else None,
|
||||
icon="mdi:air-filter",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="aqi",
|
||||
|
@ -63,7 +62,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_C6H6,
|
||||
value=lambda sensors: sensors.c6h6.value if sensors.c6h6 else None,
|
||||
suggested_display_precision=0,
|
||||
icon="mdi:molecule",
|
||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
translation_key="c6h6",
|
||||
|
@ -72,7 +70,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_CO,
|
||||
value=lambda sensors: sensors.co.value if sensors.co else None,
|
||||
suggested_display_precision=0,
|
||||
icon="mdi:molecule",
|
||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
translation_key="co",
|
||||
|
@ -89,7 +86,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_NO2,
|
||||
subkey="index",
|
||||
value=lambda sensors: sensors.no2.index if sensors.no2 else None,
|
||||
icon="mdi:molecule",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="no2_index",
|
||||
|
@ -106,7 +102,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_O3,
|
||||
subkey="index",
|
||||
value=lambda sensors: sensors.o3.index if sensors.o3 else None,
|
||||
icon="mdi:molecule",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="o3_index",
|
||||
|
@ -123,7 +118,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_PM10,
|
||||
subkey="index",
|
||||
value=lambda sensors: sensors.pm10.index if sensors.pm10 else None,
|
||||
icon="mdi:molecule",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="pm10_index",
|
||||
|
@ -140,7 +134,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_PM25,
|
||||
subkey="index",
|
||||
value=lambda sensors: sensors.pm25.index if sensors.pm25 else None,
|
||||
icon="mdi:molecule",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="pm25_index",
|
||||
|
@ -157,7 +150,6 @@ SENSOR_TYPES: tuple[GiosSensorEntityDescription, ...] = (
|
|||
key=ATTR_SO2,
|
||||
subkey="index",
|
||||
value=lambda sensors: sensors.so2.index if sensors.so2 else None,
|
||||
icon="mdi:molecule",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["very_bad", "bad", "sufficient", "moderate", "good", "very_good"],
|
||||
translation_key="so2_index",
|
||||
|
|
|
@ -43,7 +43,7 @@ async def test_sensor(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
|||
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
== CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:molecule"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
|
||||
entry = entity_registry.async_get("sensor.home_benzene")
|
||||
assert entry
|
||||
|
|
Loading…
Add table
Reference in a new issue