Skip to content

Commit 5071041

Browse files
committed
create a spook repair issue when there are ProxMox updates. Notifications from ProxMox
Fixes #1494
1 parent d682517 commit 5071041

1 file changed

Lines changed: 40 additions & 22 deletions

File tree

config/packages/proxmox.yaml

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,58 @@
1-
#-------------------------------------------
2-
# @CCOSTAN
3-
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
4-
# Proxmox Frigate Host - Nightly reboot schedule.
5-
#-------------------------------------------
61
######################################################################
7-
## Automates nightly reboot of the Frigate server via Proxmox API.
2+
# @CCOSTAN - Follow Me on X
3+
# For more info visit https://www.vcloudinfo.com/click-here
4+
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
5+
# -------------------------------------------------------------------
6+
# Proxmox Host Automations - reboots and update alerts
7+
# Nightly Frigate host reboot plus update repair issues.
8+
# -------------------------------------------------------------------
9+
# Notes: Creates HA repair issues when proxmox nodes report updates.
810
######################################################################
9-
# More info: https://www.vcloudinfo.com/click-here
1011
automation:
1112
- alias: "Nightly Frigate Server Reboot"
1213
id: nightly_frigate_reboot
1314
description: "Reboots the Frigate server every day at 5 AM"
15+
mode: single
1416
trigger:
1517
- platform: time
1618
at: "05:00:00"
1719
action:
1820
- service: button.press
1921
target:
2022
entity_id: button.qemu_docker2_101_reboot
21-
mode: single
2223

23-
- alias: "Notify Carlo of Proxmox Updates"
24-
id: notify_carlo_proxmox_updates
25-
description: "Sends a notification to Carlo when there are updates available for the Proxmox hosts."
24+
- alias: "Proxmox Updates Repair Issues"
25+
id: proxmox_updates_repair
26+
description: "Track repair issues when Proxmox hosts report updates."
27+
mode: restart
2628
trigger:
27-
- platform: state
28-
entity_id: binary_sensor.node_proxmox02_updates_packages
29-
to: 'on'
3029
- platform: state
3130
entity_id: binary_sensor.node_proxmox1_updates_packages
32-
to: 'on'
31+
- platform: state
32+
entity_id: binary_sensor.node_proxmox02_updates_packages
33+
variables:
34+
node_name: >
35+
{% if 'proxmox1' in trigger.entity_id %}Proxmox1{% else %}Proxmox02{% endif %}
36+
issue_id: >
37+
{% if 'proxmox1' in trigger.entity_id %}
38+
proxmox1_updates_available
39+
{% else %}
40+
proxmox02_updates_available
41+
{% endif %}
3342
action:
34-
- service: script.notify_engine
35-
data:
36-
who: carlo
37-
title: "Proxmox Updates Available"
38-
value1: "There are updates available for the Proxmox hosts. Please review and apply updates as needed."
39-
group: "information"
40-
mode: single
43+
- choose:
44+
- conditions: "{{ trigger.to_state.state == 'on' }}"
45+
sequence:
46+
- service: repairs.create
47+
data:
48+
issue_id: "{{ issue_id }}"
49+
severity: warning
50+
persistent: false
51+
title: "{{ node_name }} has updates available"
52+
description: >
53+
{{ trigger.entity_id }} is ON, indicating pending updates on {{ node_name }}.
54+
Apply updates in Proxmox, then reload this sensor to clear the issue.
55+
default:
56+
- service: repairs.remove
57+
data:
58+
issue_id: "{{ issue_id }}"

0 commit comments

Comments
 (0)