mirror of
https://github.com/home-assistant/core.git
synced 2026-08-14 09:13:06 +01:00
ProxmoxVE component change Hibernate button to Suspend and fix API call path (#177205)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
co-authored by
Joost Lekkerkerker
parent
7ff7f0d200
commit
1941b6b87a
@@ -134,7 +134,7 @@ VM_BUTTONS: tuple[ProxmoxVMButtonEntityDescription, ...] = (
|
||||
key="hibernate",
|
||||
translation_key="hibernate",
|
||||
press_action=lambda coordinator, node, vmid: (
|
||||
coordinator.proxmox.nodes(node).qemu(vmid).status.hibernate.post()
|
||||
coordinator.proxmox.nodes(node).qemu(vmid).status.suspend.post()
|
||||
),
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
},
|
||||
"button": {
|
||||
"hibernate": {
|
||||
"name": "Hibernate"
|
||||
"name": "Suspend"
|
||||
},
|
||||
"reset": {
|
||||
"name": "Reset"
|
||||
|
||||
@@ -752,56 +752,6 @@
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_web_hibernate-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.vm_web_hibernate',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Hibernate',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Hibernate',
|
||||
'platform': 'proxmoxve',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'hibernate',
|
||||
'unique_id': '1234_100_hibernate',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_web_hibernate-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'vm-web Hibernate',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.vm_web_hibernate',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_web_reset-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
@@ -1053,3 +1003,53 @@
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_web_suspend-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.vm_web_suspend',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Suspend',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Suspend',
|
||||
'platform': 'proxmoxve',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'hibernate',
|
||||
'unique_id': '1234_100_hibernate',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_web_suspend-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'vm-web Suspend',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.vm_web_suspend',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -112,7 +112,7 @@ async def test_node_all_actions_buttons(
|
||||
("button.vm_web_start", 100, "start"),
|
||||
("button.vm_web_stop", 100, "stop"),
|
||||
("button.vm_web_restart", 100, "reboot"),
|
||||
("button.vm_web_hibernate", 100, "hibernate"),
|
||||
("button.vm_web_suspend", 100, "suspend"),
|
||||
("button.vm_web_reset", 100, "reset"),
|
||||
("button.vm_web_shut_down", 100, "shutdown"),
|
||||
],
|
||||
@@ -268,9 +268,9 @@ async def test_node_buttons_exceptions(
|
||||
SSLError("ssl error"),
|
||||
),
|
||||
(
|
||||
"button.vm_web_hibernate",
|
||||
"button.vm_web_suspend",
|
||||
100,
|
||||
"hibernate",
|
||||
"suspend",
|
||||
ConnectTimeout("timeout"),
|
||||
),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user