Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update #160

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading