Add reboot button for tplink (#127935)

* Add reboot button for tplink

* Add device_class, remove unnecessary translation and update fixtures

* update snapshot
This commit is contained in:
Teemu R. 2024-10-11 12:21:36 +02:00 committed by GitHub
parent c39a1596d5
commit 64693eaca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 0 deletions

View file

@ -9,6 +9,7 @@ from kasa import Feature
from homeassistant.components.button import (
DOMAIN as BUTTON_DOMAIN,
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
@ -45,6 +46,10 @@ BUTTON_DESCRIPTIONS: Final = [
breaks_in_ha_version="2025.4.0",
),
),
TPLinkButtonEntityDescription(
key="reboot",
device_class=ButtonDeviceClass.RESTART,
),
]
BUTTON_DESCRIPTIONS_MAP = {desc.key: desc for desc in BUTTON_DESCRIPTIONS}

View file

@ -205,6 +205,11 @@
"type": "BinarySensor",
"category": "Info"
},
"reboot": {
"value": "<Action>",
"type": "Action",
"category": "Debug"
},
"test_alarm": {
"value": "<Action>",
"type": "Action",

View file

@ -1,4 +1,37 @@
# serializer version: 1
# name: test_states[button.my_device_restart-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
'domain': 'button',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'button.my_device_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
'original_icon': None,
'original_name': 'Restart',
'platform': 'tplink',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'reboot',
'unique_id': '123456789ABCDEFGH_reboot',
'unit_of_measurement': None,
})
# ---
# name: test_states[button.my_device_stop_alarm-entry]
EntityRegistryEntrySnapshot({
'aliases': set({