From 0beb0ee474c67b9cf68ca40d04faa38d3bb4db2a Mon Sep 17 00:00:00 2001 From: Erwin Douna Date: Tue, 25 Aug 2026 19:10:03 +0200 Subject: [PATCH] Add VM pause button to ProxmoxVE (#178399) Co-authored-by: Franck Nijhof --- homeassistant/components/proxmoxve/button.py | 10 +++- homeassistant/components/proxmoxve/icons.json | 3 ++ .../components/proxmoxve/strings.json | 3 ++ .../proxmoxve/snapshots/test_button.ambr | 50 +++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/proxmoxve/button.py b/homeassistant/components/proxmoxve/button.py index 339e2b3c3a36..1ec29155be2f 100644 --- a/homeassistant/components/proxmoxve/button.py +++ b/homeassistant/components/proxmoxve/button.py @@ -130,11 +130,19 @@ VM_BUTTONS: tuple[ProxmoxVMButtonEntityDescription, ...] = ( entity_category=EntityCategory.CONFIG, device_class=ButtonDeviceClass.RESTART, ), + ProxmoxVMButtonEntityDescription( + key="pause", + translation_key="pause", + press_action=lambda coordinator, node, vmid: ( + coordinator.proxmox.nodes(node).qemu(vmid).status.suspend.post() + ), + entity_category=EntityCategory.CONFIG, + ), ProxmoxVMButtonEntityDescription( key="hibernate", translation_key="hibernate", press_action=lambda coordinator, node, vmid: ( - coordinator.proxmox.nodes(node).qemu(vmid).status.suspend.post() + coordinator.proxmox.nodes(node).qemu(vmid).status.suspend.post(todisk=1) ), entity_category=EntityCategory.CONFIG, ), diff --git a/homeassistant/components/proxmoxve/icons.json b/homeassistant/components/proxmoxve/icons.json index 7c60fef838f6..9ca036bbcb71 100644 --- a/homeassistant/components/proxmoxve/icons.json +++ b/homeassistant/components/proxmoxve/icons.json @@ -24,6 +24,9 @@ "hibernate": { "default": "mdi:power-sleep" }, + "pause": { + "default": "mdi:pause" + }, "reset": { "default": "mdi:restart" }, diff --git a/homeassistant/components/proxmoxve/strings.json b/homeassistant/components/proxmoxve/strings.json index 17ff5ebed3c9..2637252502ee 100644 --- a/homeassistant/components/proxmoxve/strings.json +++ b/homeassistant/components/proxmoxve/strings.json @@ -139,6 +139,9 @@ "hibernate": { "name": "Suspend" }, + "pause": { + "name": "Pause" + }, "reset": { "name": "Reset" }, diff --git a/tests/components/proxmoxve/snapshots/test_button.ambr b/tests/components/proxmoxve/snapshots/test_button.ambr index d3475674bb5e..ad4115c67314 100644 --- a/tests/components/proxmoxve/snapshots/test_button.ambr +++ b/tests/components/proxmoxve/snapshots/test_button.ambr @@ -752,6 +752,56 @@ 'state': 'unknown', }) # --- +# name: test_all_button_entities[button.vm_web_pause-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': , + 'entity_id': 'button.vm_web_pause', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Pause', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Pause', + 'platform': 'proxmoxve', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'pause', + 'unique_id': '1234_100_pause', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_button_entities[button.vm_web_pause-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'vm-web Pause', + }), + 'context': , + 'entity_id': 'button.vm_web_pause', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_all_button_entities[button.vm_web_reset-entry] EntityRegistryEntrySnapshot({ 'aliases': list([