@ -7,9 +7,11 @@
# Nightly Frigate host reboot plus update/runtime/disk health automations.
# -------------------------------------------------------------------
# Related Issue: 1584
# Related Issue: 1798
# Notes: Creates HA repair issues when proxmox nodes report updates.
# Notes: Proxmox update activity also writes HA persistent notifications.
# Notes: Adds normalized runtime + disk health signals for dashboard/alerts.
# Notes: Joanna dispatch is reserved for sustained runtime and disk-pressure degradations.
# Notes: Joanna dispatch handles Proxmox updates plus sustained runtime/disk degradations.
# Notes: Normalized disk usage sensors expose state_class for long-term trend rollups.
######################################################################
template:
@ -117,8 +119,16 @@ automation:
trigger:
- platform : state
entity_id : binary_sensor.node_proxmox1_updates_packages
to : "on"
- platform : state
entity_id : binary_sensor.node_proxmox1_updates_packages
to : "off"
- platform : state
entity_id : binary_sensor.node_proxmox02_updates_packages
to : "on"
- platform : state
entity_id : binary_sensor.node_proxmox02_updates_packages
to : "off"
variables:
node_name : >
{% if 'proxmox1' in trigger.entity_id %}Proxmox1{% else %}Proxmox02{% endif %}
@ -141,15 +151,136 @@ automation:
description : >
{{ trigger.entity_id }} is ON, indicating pending updates on {{ node_name }}.
Apply updates in Proxmox, then reload this sensor to clear the issue.
- service : persistent_notification.create
data:
notification_id : "{{ issue_id }}"
title : "{{ node_name }} Proxmox updates available"
message : >
{{ node_name }} reports pending Proxmox updates via {{ trigger.entity_id }}.
Joanna upgrade orchestration will run after the cluster update state settles.
default:
- service : repairs.remove
continue_on_error : true
data:
issue_id : "{{ issue_id }}"
- service : persistent_notification.create
data:
notification_id : "{{ issue_id }}"
title : "{{ node_name }} Proxmox updates cleared"
message : >
{{ node_name }} update telemetry returned to {{ trigger.to_state.state }}.
Repairs state has been cleared and Home Assistant now considers this host patched.
- service : script.send_to_logbook
data:
topic : "PROXMOX"
message : "{{ node_name }} has been Patched"
- alias : "Proxmox Updates Joanna Dispatch"
id : proxmox_updates_joanna_dispatch
description : "Dispatch Joanna when Proxmox host updates are available, with kernel-refresh routing hints."
mode : restart
trigger:
- platform : state
entity_id:
- binary_sensor.node_proxmox1_updates_packages
- binary_sensor.node_proxmox02_updates_packages
to : "on"
condition:
- condition : template
value_template : >-
{{ is_state('binary_sensor.node_proxmox1_updates_packages', 'on') or
is_state('binary_sensor.node_proxmox02_updates_packages', 'on') }}
action:
- delay : "00:01:00"
- condition : template
value_template : >-
{{ is_state('binary_sensor.node_proxmox1_updates_packages', 'on') or
is_state('binary_sensor.node_proxmox02_updates_packages', 'on') }}
- variables:
proxmox1_updates_count : "{{ states('sensor.node_proxmox1_total_updates') | int(0) }}"
proxmox02_updates_count : "{{ states('sensor.node_proxmox02_total_updates') | int(0) }}"
proxmox1_updates_summary : >-
{% set updates = state_attr('sensor.node_proxmox1_total_updates', 'updates_list') | default([], true) %}
{% if updates is sequence and updates is not string and updates | count > 0 %}
{{ updates | join('; ') }}
{% else %}
none reported
{% endif %}
proxmox02_updates_summary : >-
{% set updates = state_attr('sensor.node_proxmox02_total_updates', 'updates_list') | default([], true) %}
{% if updates is sequence and updates is not string and updates | count > 0 %}
{{ updates | join('; ') }}
{% else %}
none reported
{% endif %}
kernel_update_packages : >-
{% set ns = namespace(items=[]) %}
{% for entity_id in ['sensor.node_proxmox1_total_updates', 'sensor.node_proxmox02_total_updates'] %}
{% set updates = state_attr(entity_id, 'updates_list') | default([], true) %}
{% if updates is sequence and updates is not string %}
{% for item in updates %}
{% set haystack = item | string | lower %}
{% if (haystack | regex_findall('(proxmox-kernel|pve-kernel|linux-image|kernel)') | count) > 0 %}
{% set ns.items = ns.items + [item] %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{{ ns.items | join('; ') if ns.items | count > 0 else 'none detected' }}
structured_request : |-
PROXMOX_HOST_UPGRADE_REQUEST
tracking_issue=https://github.com/CCOSTAN/Home-AssistantConfig/issues/1798
triggered_entity={{ trigger.entity_id }}
cluster_nodes=ProxMox1,ProxMox02
proxmox1_updates_sensor=binary_sensor.node_proxmox1_updates_packages
proxmox1_updates_state={{ states('binary_sensor.node_proxmox1_updates_packages') }}
proxmox1_updates_count={{ proxmox1_updates_count }}
proxmox1_updates={{ proxmox1_updates_summary }}
proxmox02_updates_sensor=binary_sensor.node_proxmox02_updates_packages
proxmox02_updates_state={{ states('binary_sensor.node_proxmox02_updates_packages') }}
proxmox02_updates_count={{ proxmox02_updates_count }}
proxmox02_updates={{ proxmox02_updates_summary }}
kernel_update_detected={{ (kernel_update_packages | trim) != 'none detected' }}
kernel_update_packages={{ kernel_update_packages | trim }}
required_policy=Inspect live Proxmox cluster health, storage, VM placement, and node status before changing anything. Patch hosts one node at a time and verify each node returns healthy before moving to the next. If kernel packages are present or a reboot is required after kernel updates, use the $kernel-refresh skill and follow its ordered node-cycling workflow. Verify the live placement of Frigate/Docker14 VM 101, stop it before rebooting the host that owns it, and start it only after the host cycle and VM migrations are complete. Report progress, failures, resume state, and final verification.
- service : script.send_to_logbook
data:
topic : "PROXMOX"
message : >-
Proxmox updates detected on one or more hosts. Joanna upgrade orchestration requested.
Kernel refresh : {{ 'yes' if (kernel_update_packages | trim) != 'none detected' else 'not detected from HA package list' }}.
- service : persistent_notification.create
data:
notification_id : "proxmox_updates_joanna_dispatch"
title : "Proxmox updates detected"
message : |-
Joanna upgrade orchestration requested for Proxmox host updates.
ProxMox1 : {{ proxmox1_updates_count }} updates - {{ proxmox1_updates_summary | trim }}
ProxMox02 : {{ proxmox02_updates_count }} updates - {{ proxmox02_updates_summary | trim }}
Kernel refresh : {% if (kernel_update_packages | trim) != 'none detected' %}yes - {{ kernel_update_packages | trim }}{% else %}not detected from HA package list{% endif %}
- service : script.joanna_dispatch
data:
trigger_context : "HA automation proxmox_updates_joanna_dispatch (Proxmox Updates Joanna Dispatch)"
source : "home_assistant_automation.proxmox_updates_joanna_dispatch"
summary : >-
Proxmox host updates detected. Kernel refresh
{{ 'required' if (kernel_update_packages | trim) != 'none detected' else 'not detected from HA package list' }}.
entity_ids:
- "binary_sensor.node_proxmox1_updates_packages"
- "sensor.node_proxmox1_total_updates"
- "binary_sensor.node_proxmox02_updates_packages"
- "sensor.node_proxmox02_total_updates"
- "binary_sensor.proxmox1_runtime_healthy"
- "binary_sensor.proxmox02_runtime_healthy"
- "binary_sensor.qemu_docker2_101_status"
diagnostics : >-
proxmox1_updates_count={{ proxmox1_updates_count }},
proxmox02_updates_count={{ proxmox02_updates_count }},
kernel_update_detected={{ (kernel_update_packages | trim) != 'none detected' }},
kernel_update_packages={{ kernel_update_packages | trim }}
request : "{{ structured_request }}"
- alias : "Proxmox Runtime Repair Issues"
id : proxmox_runtime_repairs
description : "Create and clear Repairs when Proxmox node runtime becomes unhealthy."