mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 08:26:41 +01:00
Add suspend all button Proxmox (#166417)
This commit is contained in:
@@ -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, ...] = (
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -130,6 +130,9 @@
|
||||
},
|
||||
"stop_all": {
|
||||
"name": "Stop all"
|
||||
},
|
||||
"suspend_all": {
|
||||
"name": "Suspend all"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
|
||||
@@ -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': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.pve1_suspend_all',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'button.pve1_suspend_all',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_button_entities[button.vm_db_hibernate-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user