From 5a951c390b5c2b6554c5ca0018d609e9336fb741 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 17 Jul 2023 12:07:43 +0200 Subject: [PATCH] Add entity translations to mutesync (#96741) --- .../components/mutesync/binary_sensor.py | 16 +++++++--------- homeassistant/components/mutesync/strings.json | 10 ++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/mutesync/binary_sensor.py b/homeassistant/components/mutesync/binary_sensor.py index d225400c7cc..3c9d92094f7 100644 --- a/homeassistant/components/mutesync/binary_sensor.py +++ b/homeassistant/components/mutesync/binary_sensor.py @@ -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): diff --git a/homeassistant/components/mutesync/strings.json b/homeassistant/components/mutesync/strings.json index 9b18620acf8..2a3cca666ee 100644 --- a/homeassistant/components/mutesync/strings.json +++ b/homeassistant/components/mutesync/strings.json @@ -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" + } + } } }