Add entity translations to Keymitt ble (#98236)

This commit is contained in:
Joost Lekkerkerker 2023-08-11 13:14:13 +02:00 committed by GitHub
parent fb66ceb302
commit a2cf08a1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -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)},

View File

@ -24,6 +24,13 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
}
},
"entity": {
"switch": {
"push": {
"name": "Push"
}
}
},
"services": {
"calibrate": {
"name": "Calibrate",

View File

@ -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."""