mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add pair/unpair buttons for tplink (#135847)
This commit is contained in:
parent
b7a344fd65
commit
37b23a9691
@ -70,6 +70,8 @@ BUTTON_DESCRIPTIONS: Final = [
|
|||||||
key="tilt_down",
|
key="tilt_down",
|
||||||
available_fn=lambda dev: dev.is_on,
|
available_fn=lambda dev: dev.is_on,
|
||||||
),
|
),
|
||||||
|
TPLinkButtonEntityDescription(key="pair"),
|
||||||
|
TPLinkButtonEntityDescription(key="unpair"),
|
||||||
]
|
]
|
||||||
|
|
||||||
BUTTON_DESCRIPTIONS_MAP = {desc.key: desc for desc in BUTTON_DESCRIPTIONS}
|
BUTTON_DESCRIPTIONS_MAP = {desc.key: desc for desc in BUTTON_DESCRIPTIONS}
|
||||||
|
@ -138,6 +138,12 @@
|
|||||||
},
|
},
|
||||||
"tilt_down": {
|
"tilt_down": {
|
||||||
"name": "Tilt down"
|
"name": "Tilt down"
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"name": "Pair new device"
|
||||||
|
},
|
||||||
|
"unpair": {
|
||||||
|
"name": "Unpair device"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
|
@ -370,5 +370,15 @@
|
|||||||
"value": 10,
|
"value": 10,
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"category": "Config"
|
"category": "Config"
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Config"
|
||||||
|
},
|
||||||
|
"unpair": {
|
||||||
|
"value": "<Action>",
|
||||||
|
"type": "Action",
|
||||||
|
"category": "Debug"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,50 @@
|
|||||||
# serializer version: 1
|
# serializer version: 1
|
||||||
|
# name: test_states[button.my_device_pair_new_device-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||||
|
'entity_id': 'button.my_device_pair_new_device',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Pair new device',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'pair',
|
||||||
|
'unique_id': '123456789ABCDEFGH_pair',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[button.my_device_pair_new_device-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'my_device Pair new device',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.my_device_pair_new_device',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[button.my_device_pan_left-entry]
|
# name: test_states[button.my_device_pan_left-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@ -308,6 +354,39 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[button.my_device_unpair_device-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_unpair_device',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Unpair device',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'unpair',
|
||||||
|
'unique_id': '123456789ABCDEFGH_unpair',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[my_device-entry]
|
# name: test_states[my_device-entry]
|
||||||
DeviceRegistryEntrySnapshot({
|
DeviceRegistryEntrySnapshot({
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user