Add entity translations to Ukraine Alarm (#96260)

* Add entity translations to Ukraine Alarm

* Add entity translations to Ukraine Alarm
This commit is contained in:
Joost Lekkerkerker 2023-07-11 20:16:24 +02:00 committed by GitHub
parent 2257e7454a
commit a7edf0a608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 7 deletions

View File

@ -30,36 +30,36 @@ from .const import (
BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription(
key=ALERT_TYPE_UNKNOWN,
name="Unknown",
translation_key="unknown",
device_class=BinarySensorDeviceClass.SAFETY,
),
BinarySensorEntityDescription(
key=ALERT_TYPE_AIR,
name="Air",
translation_key="air",
device_class=BinarySensorDeviceClass.SAFETY,
icon="mdi:cloud",
),
BinarySensorEntityDescription(
key=ALERT_TYPE_URBAN_FIGHTS,
name="Urban Fights",
translation_key="urban_fights",
device_class=BinarySensorDeviceClass.SAFETY,
icon="mdi:pistol",
),
BinarySensorEntityDescription(
key=ALERT_TYPE_ARTILLERY,
name="Artillery",
translation_key="artillery",
device_class=BinarySensorDeviceClass.SAFETY,
icon="mdi:tank",
),
BinarySensorEntityDescription(
key=ALERT_TYPE_CHEMICAL,
name="Chemical",
translation_key="chemical",
device_class=BinarySensorDeviceClass.SAFETY,
icon="mdi:chemical-weapon",
),
BinarySensorEntityDescription(
key=ALERT_TYPE_NUCLEAR,
name="Nuclear",
translation_key="nuclear",
device_class=BinarySensorDeviceClass.SAFETY,
icon="mdi:nuke",
),
@ -92,6 +92,7 @@ class UkraineAlarmSensor(
"""Class for a Ukraine Alarm binary sensor."""
_attr_attribution = ATTRIBUTION
_attr_has_entity_name = True
def __init__(
self,
@ -105,7 +106,6 @@ class UkraineAlarmSensor(
self.entity_description = description
self._attr_name = f"{name} {description.name}"
self._attr_unique_id = f"{unique_id}-{description.key}".lower()
self._attr_device_info = DeviceInfo(
entry_type=DeviceEntryType.SERVICE,

View File

@ -28,5 +28,27 @@
"description": "If you want to monitor not only state and district, choose its specific community"
}
}
},
"entity": {
"binary_sensor": {
"unknown": {
"name": "Unknown"
},
"air": {
"name": "Air"
},
"urban_fights": {
"name": "Urban fights"
},
"artillery": {
"name": "Artillery"
},
"chemical": {
"name": "Chemical"
},
"nuclear": {
"name": "Nuclear"
}
}
}
}