From a2cf08a1eaaf535d54ae5602ca0b74913545b646 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 11 Aug 2023 13:14:13 +0200 Subject: [PATCH] Add entity translations to Keymitt ble (#98236) --- homeassistant/components/keymitt_ble/entity.py | 3 ++- homeassistant/components/keymitt_ble/strings.json | 7 +++++++ homeassistant/components/keymitt_ble/switch.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/keymitt_ble/entity.py b/homeassistant/components/keymitt_ble/entity.py index b61f8a3c24d..a9294bce239 100644 --- a/homeassistant/components/keymitt_ble/entity.py +++ b/homeassistant/components/keymitt_ble/entity.py @@ -16,11 +16,12 @@ from .coordinator import MicroBotDataUpdateCoordinator class MicroBotEntity(PassiveBluetoothCoordinatorEntity[MicroBotDataUpdateCoordinator]): """Generic entity for all MicroBots.""" + _attr_has_entity_name = True + def __init__(self, coordinator, config_entry): """Initialise the entity.""" super().__init__(coordinator) self._address = self.coordinator.ble_device.address - self._attr_name = "Push" self._attr_unique_id = self._address self._attr_device_info = DeviceInfo( connections={(dr.CONNECTION_BLUETOOTH, self._address)}, diff --git a/homeassistant/components/keymitt_ble/strings.json b/homeassistant/components/keymitt_ble/strings.json index ab2d4ad9440..2a1f428603e 100644 --- a/homeassistant/components/keymitt_ble/strings.json +++ b/homeassistant/components/keymitt_ble/strings.json @@ -24,6 +24,13 @@ "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" } }, + "entity": { + "switch": { + "push": { + "name": "Push" + } + } + }, "services": { "calibrate": { "name": "Calibrate", diff --git a/homeassistant/components/keymitt_ble/switch.py b/homeassistant/components/keymitt_ble/switch.py index 3e5883ae5d0..4c9f0c335a7 100644 --- a/homeassistant/components/keymitt_ble/switch.py +++ b/homeassistant/components/keymitt_ble/switch.py @@ -43,7 +43,7 @@ async def async_setup_entry( class MicroBotBinarySwitch(MicroBotEntity, SwitchEntity): """MicroBot switch class.""" - _attr_has_entity_name = True + _attr_translation_key = "push" async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the switch."""