Skip to content

Commit

Permalink
Merge pull request #160 from dougiteixeira/fix-update
Browse files Browse the repository at this point in the history
Fix update
  • Loading branch information
dougiteixeira authored Nov 12, 2023
2 parents 1e3fa51 + bb55dbb commit 9673ac4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion custom_components/proxmoxve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
ProxmoxNodeCoordinator,
ProxmoxQEMUCoordinator,
ProxmoxStorageCoordinator,
ProxmoxUpdateCoordinator,
)

PLATFORMS = [
Expand Down Expand Up @@ -356,6 +357,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 Down Expand Up @@ -574,7 +586,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
4 changes: 4 additions & 0 deletions custom_components/proxmoxve/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ProxmoxType(StrEnum):
QEMU = "qemu"
LXC = "lxc"
Storage = "storage"
Update = "update"


class ProxmoxCommand(StrEnum):
Expand Down Expand Up @@ -81,3 +82,6 @@ class ProxmoxKeyAPIParse(StrEnum):
NAME = "name"
NETWORK_IN = "network_in"
NETWORK_OUT = "network_out"
UPDATE_TOTAL = "total"
UPDATE_LIST = "updates_list"
UPDATE_AVAIL = "update"

0 comments on commit 9673ac4

Please sign in to comment.