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
SENSORS = {
"in_meeting": "In Meeting",
"muted": "Muted",
}
SENSORS = (
"in_meeting",
"muted",
)
async def async_setup_entry(
@ -30,15 +30,13 @@ async def async_setup_entry(
class MuteStatus(update_coordinator.CoordinatorEntity, BinarySensorEntity):
"""Mütesync binary sensors."""
_attr_has_entity_name = True
def __init__(self, coordinator, sensor_type):
"""Initialize our sensor."""
super().__init__(coordinator)
self._sensor_type = sensor_type
@property
def name(self):
"""Return the name of the sensor."""
return SENSORS[self._sensor_type]
self._attr_translation_key = sensor_type
@property
def unique_id(self):

View File

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