Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dougiteixeira committed Nov 12, 2023
1 parent cecf51a commit 26a5cba
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion custom_components/proxmoxve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
ProxmoxNodeCoordinator,
ProxmoxQEMUCoordinator,
ProxmoxStorageCoordinator,
ProxmoxUpdateCoordinator,
)

PLATFORMS = [
Expand Down Expand Up @@ -355,6 +356,17 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
coordinators[node] = coordinator_node
if coordinator_node.data is not None:
nodes_add_device.append(node)


coordinator_updates = ProxmoxUpdateCoordinator(
hass=hass,
proxmox=proxmox,
api_category=ProxmoxType.Update,
node_name=node,
)
await coordinator_updates.async_refresh()
coordinators[f"{ProxmoxType.Update}_{node}"] = coordinator_updates

else:
async_create_issue(
hass,
Expand All @@ -370,6 +382,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
"port": config_entry.data[CONF_PORT],
"resource_type": "Node",
"resource": node,
"permission": f"['perm','/nodes/{node}',['Sys.Audit']]",
},
)

Expand Down Expand Up @@ -406,6 +419,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
"port": config_entry.data[CONF_PORT],
"resource_type": ProxmoxType.QEMU,
"resource": vm_id,
"permission": f"['perm','/vms/{vm_id}',['VM.Audit']]",
},
)

Expand Down Expand Up @@ -442,6 +456,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
"port": config_entry.data[CONF_PORT],
"resource_type": ProxmoxType.LXC,
"resource": container_id,
"permission": f"['perm','/vms/{container_id}',['VM.Audit']]",
},
)

Expand Down Expand Up @@ -478,6 +493,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
"port": config_entry.data[CONF_PORT],
"resource_type": ProxmoxType.Storage,
"resource": storage_id,
"permission": f"['perm','/storage/{storage_id}',['Datastore.Audit'],'any',1]"
},
)

Expand Down Expand Up @@ -573,7 +589,7 @@ def device_info(
)
model = api_category.capitalize()

elif api_category is ProxmoxType.Node:
elif api_category in (ProxmoxType.Node, ProxmoxType.Update):
coordinator = coordinators[node]
if (coordinator_data := coordinator.data) is not None:
model_processor = coordinator_data.model
Expand Down

0 comments on commit 26a5cba

Please sign in to comment.