Add entity translations to Garages Amsterdam (#98584)
This commit is contained in:
parent
7e7cb15d5b
commit
56e5c34283
4 changed files with 19 additions and 9 deletions
|
@ -8,7 +8,6 @@ from homeassistant.components.binary_sensor import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from . import get_coordinator
|
||||
from .entity import GaragesAmsterdamEntity
|
||||
|
@ -38,13 +37,7 @@ class GaragesAmsterdamBinarySensor(GaragesAmsterdamEntity, BinarySensorEntity):
|
|||
"""Binary Sensor representing garages amsterdam data."""
|
||||
|
||||
_attr_device_class = BinarySensorDeviceClass.PROBLEM
|
||||
|
||||
def __init__(
|
||||
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
|
||||
) -> None:
|
||||
"""Initialize garages amsterdam binary sensor."""
|
||||
super().__init__(coordinator, garage_name, info_type)
|
||||
self._attr_name = garage_name
|
||||
_attr_name = None
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
|
|
@ -14,6 +14,7 @@ class GaragesAmsterdamEntity(CoordinatorEntity):
|
|||
"""Base Entity for garages amsterdam data."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
|
||||
|
|
|
@ -49,7 +49,7 @@ class GaragesAmsterdamSensor(GaragesAmsterdamEntity, SensorEntity):
|
|||
) -> None:
|
||||
"""Initialize garages amsterdam sensor."""
|
||||
super().__init__(coordinator, garage_name, info_type)
|
||||
self._attr_name = f"{garage_name} - {info_type}".replace("_", " ")
|
||||
self._attr_translation_key = info_type
|
||||
self._attr_icon = SENSORS[info_type]
|
||||
|
||||
@property
|
||||
|
|
|
@ -12,5 +12,21 @@
|
|||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"free_space_short": {
|
||||
"name": "Short parking free space"
|
||||
},
|
||||
"free_space_long": {
|
||||
"name": "Long parking free space"
|
||||
},
|
||||
"short_capacity": {
|
||||
"name": "Short parking capacity"
|
||||
},
|
||||
"long_capacity": {
|
||||
"name": "Long parking capacity"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue