create a spook repair issue when there are ProxMox updates. Notifications from ProxMox

Fixes #1494
This commit is contained in:
Carlo Costanzo
2025-12-02 09:48:29 -05:00
parent d682517040
commit 5071041fa3

View File

@@ -1,16 +1,18 @@
#------------------------------------------- ######################################################################
# @CCOSTAN # @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Proxmox Frigate Host - Nightly reboot schedule. # -------------------------------------------------------------------
#------------------------------------------- # Proxmox Host Automations - reboots and update alerts
# Nightly Frigate host reboot plus update repair issues.
# -------------------------------------------------------------------
# Notes: Creates HA repair issues when proxmox nodes report updates.
###################################################################### ######################################################################
## Automates nightly reboot of the Frigate server via Proxmox API.
######################################################################
# More info: https://www.vcloudinfo.com/click-here
automation: automation:
- alias: "Nightly Frigate Server Reboot" - alias: "Nightly Frigate Server Reboot"
id: nightly_frigate_reboot id: nightly_frigate_reboot
description: "Reboots the Frigate server every day at 5 AM" description: "Reboots the Frigate server every day at 5 AM"
mode: single
trigger: trigger:
- platform: time - platform: time
at: "05:00:00" at: "05:00:00"
@@ -18,23 +20,39 @@ automation:
- service: button.press - service: button.press
target: target:
entity_id: button.qemu_docker2_101_reboot entity_id: button.qemu_docker2_101_reboot
mode: single
- alias: "Notify Carlo of Proxmox Updates" - alias: "Proxmox Updates Repair Issues"
id: notify_carlo_proxmox_updates id: proxmox_updates_repair
description: "Sends a notification to Carlo when there are updates available for the Proxmox hosts." description: "Track repair issues when Proxmox hosts report updates."
mode: restart
trigger: trigger:
- platform: state
entity_id: binary_sensor.node_proxmox02_updates_packages
to: 'on'
- platform: state - platform: state
entity_id: binary_sensor.node_proxmox1_updates_packages entity_id: binary_sensor.node_proxmox1_updates_packages
to: 'on' - platform: state
entity_id: binary_sensor.node_proxmox02_updates_packages
variables:
node_name: >
{% if 'proxmox1' in trigger.entity_id %}Proxmox1{% else %}Proxmox02{% endif %}
issue_id: >
{% if 'proxmox1' in trigger.entity_id %}
proxmox1_updates_available
{% else %}
proxmox02_updates_available
{% endif %}
action: action:
- service: script.notify_engine - choose:
- conditions: "{{ trigger.to_state.state == 'on' }}"
sequence:
- service: repairs.create
data: data:
who: carlo issue_id: "{{ issue_id }}"
title: "Proxmox Updates Available" severity: warning
value1: "There are updates available for the Proxmox hosts. Please review and apply updates as needed." persistent: false
group: "information" title: "{{ node_name }} has updates available"
mode: single description: >
{{ trigger.entity_id }} is ON, indicating pending updates on {{ node_name }}.
Apply updates in Proxmox, then reload this sensor to clear the issue.
default:
- service: repairs.remove
data:
issue_id: "{{ issue_id }}"