mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Add entity translations to Keymitt ble (#98236)
This commit is contained in:
parent
fb66ceb302
commit
a2cf08a1ea
@ -16,11 +16,12 @@ from .coordinator import MicroBotDataUpdateCoordinator
|
|||||||
class MicroBotEntity(PassiveBluetoothCoordinatorEntity[MicroBotDataUpdateCoordinator]):
|
class MicroBotEntity(PassiveBluetoothCoordinatorEntity[MicroBotDataUpdateCoordinator]):
|
||||||
"""Generic entity for all MicroBots."""
|
"""Generic entity for all MicroBots."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(self, coordinator, config_entry):
|
def __init__(self, coordinator, config_entry):
|
||||||
"""Initialise the entity."""
|
"""Initialise the entity."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._address = self.coordinator.ble_device.address
|
self._address = self.coordinator.ble_device.address
|
||||||
self._attr_name = "Push"
|
|
||||||
self._attr_unique_id = self._address
|
self._attr_unique_id = self._address
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
connections={(dr.CONNECTION_BLUETOOTH, self._address)},
|
connections={(dr.CONNECTION_BLUETOOTH, self._address)},
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"entity": {
|
||||||
|
"switch": {
|
||||||
|
"push": {
|
||||||
|
"name": "Push"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"calibrate": {
|
"calibrate": {
|
||||||
"name": "Calibrate",
|
"name": "Calibrate",
|
||||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(
|
|||||||
class MicroBotBinarySwitch(MicroBotEntity, SwitchEntity):
|
class MicroBotBinarySwitch(MicroBotEntity, SwitchEntity):
|
||||||
"""MicroBot switch class."""
|
"""MicroBot switch class."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_translation_key = "push"
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn on the switch."""
|
"""Turn on the switch."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user