diff --git a/homeassistant/components/proxmoxve/button.py b/homeassistant/components/proxmoxve/button.py index f81333d7f2b..1eef500b326 100644 --- a/homeassistant/components/proxmoxve/button.py +++ b/homeassistant/components/proxmoxve/button.py @@ -82,6 +82,14 @@ NODE_BUTTONS: tuple[ProxmoxNodeButtonNodeEntityDescription, ...] = ( ).stopall.post(), entity_category=EntityCategory.CONFIG, ), + ProxmoxNodeButtonNodeEntityDescription( + key="suspend_all", + translation_key="suspend_all", + press_action=lambda coordinator, node: coordinator.proxmox.nodes( + node + ).suspendall.post(), + entity_category=EntityCategory.CONFIG, + ), ) VM_BUTTONS: tuple[ProxmoxVMButtonEntityDescription, ...] = ( diff --git a/homeassistant/components/proxmoxve/icons.json b/homeassistant/components/proxmoxve/icons.json index 98ccdd556d8..6d57d99a47a 100644 --- a/homeassistant/components/proxmoxve/icons.json +++ b/homeassistant/components/proxmoxve/icons.json @@ -13,8 +13,17 @@ "start": { "default": "mdi:play" }, + "start_all": { + "default": "mdi:play" + }, "stop": { "default": "mdi:stop" + }, + "stop_all": { + "default": "mdi:stop" + }, + "suspend_all": { + "default": "mdi:pause" } }, "sensor": { diff --git a/homeassistant/components/proxmoxve/strings.json b/homeassistant/components/proxmoxve/strings.json index fa44c5e09e0..6831985b07c 100644 --- a/homeassistant/components/proxmoxve/strings.json +++ b/homeassistant/components/proxmoxve/strings.json @@ -130,6 +130,9 @@ }, "stop_all": { "name": "Stop all" + }, + "suspend_all": { + "name": "Suspend all" } }, "sensor": { diff --git a/tests/components/proxmoxve/snapshots/test_button.ambr b/tests/components/proxmoxve/snapshots/test_button.ambr index 4d81b550f51..915e5b2e7fd 100644 --- a/tests/components/proxmoxve/snapshots/test_button.ambr +++ b/tests/components/proxmoxve/snapshots/test_button.ambr @@ -502,6 +502,56 @@ 'state': 'unknown', }) # --- +# name: test_all_button_entities[button.pve1_suspend_all-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.pve1_suspend_all', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Suspend all', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Suspend all', + 'platform': 'proxmoxve', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'suspend_all', + 'unique_id': '1234_node/pve1_suspend_all', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_button_entities[button.pve1_suspend_all-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'pve1 Suspend all', + }), + 'context': , + 'entity_id': 'button.pve1_suspend_all', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_all_button_entities[button.vm_db_hibernate-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/proxmoxve/test_button.py b/tests/components/proxmoxve/test_button.py index cc223cdbdd5..564f259c4f9 100644 --- a/tests/components/proxmoxve/test_button.py +++ b/tests/components/proxmoxve/test_button.py @@ -82,9 +82,10 @@ async def test_node_buttons( [ ("button.pve1_start_all", "startall"), ("button.pve1_stop_all", "stopall"), + ("button.pve1_suspend_all", "suspendall"), ], ) -async def test_node_startall_stopall_buttons( +async def test_node_all_actions_buttons( hass: HomeAssistant, mock_proxmox_client: MagicMock, mock_config_entry: MockConfigEntry,