Add entity translations to mutesync (#96741)

This commit is contained in:
Joost Lekkerkerker 2023-07-17 12:07:43 +02:00 committed by GitHub
parent 56bc708b28
commit 5a951c390b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -9,10 +9,10 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN from .const import DOMAIN
SENSORS = { SENSORS = (
"in_meeting": "In Meeting", "in_meeting",
"muted": "Muted", "muted",
} )
async def async_setup_entry( async def async_setup_entry(
@ -30,15 +30,13 @@ async def async_setup_entry(
class MuteStatus(update_coordinator.CoordinatorEntity, BinarySensorEntity): class MuteStatus(update_coordinator.CoordinatorEntity, BinarySensorEntity):
"""Mütesync binary sensors.""" """Mütesync binary sensors."""
_attr_has_entity_name = True
def __init__(self, coordinator, sensor_type): def __init__(self, coordinator, sensor_type):
"""Initialize our sensor.""" """Initialize our sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self._sensor_type = sensor_type self._sensor_type = sensor_type
self._attr_translation_key = sensor_type
@property
def name(self):
"""Return the name of the sensor."""
return SENSORS[self._sensor_type]
@property @property
def unique_id(self): def unique_id(self):

View File

@ -12,5 +12,15 @@
"invalid_auth": "Enable authentication in mütesync Preferences > Authentication", "invalid_auth": "Enable authentication in mütesync Preferences > Authentication",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
} }
},
"entity": {
"binary_sensor": {
"in_meeting": {
"name": "In meeting"
},
"muted": {
"name": "Muted"
}
}
} }
} }