|
1 | | -#------------------------------------------- |
2 | | -# @CCOSTAN |
3 | | -# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig |
4 | | -# Proxmox Frigate Host - Nightly reboot schedule. |
5 | | -#------------------------------------------- |
6 | 1 | ###################################################################### |
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. |
8 | 10 | ###################################################################### |
9 | | -# More info: https://www.vcloudinfo.com/click-here |
10 | 11 | automation: |
11 | 12 | - alias: "Nightly Frigate Server Reboot" |
12 | 13 | id: nightly_frigate_reboot |
13 | 14 | description: "Reboots the Frigate server every day at 5 AM" |
| 15 | + mode: single |
14 | 16 | trigger: |
15 | 17 | - platform: time |
16 | 18 | at: "05:00:00" |
17 | 19 | action: |
18 | 20 | - service: button.press |
19 | 21 | target: |
20 | 22 | entity_id: button.qemu_docker2_101_reboot |
21 | | - mode: single |
22 | 23 |
|
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 |
26 | 28 | trigger: |
27 | | - - platform: state |
28 | | - entity_id: binary_sensor.node_proxmox02_updates_packages |
29 | | - to: 'on' |
30 | 29 | - platform: state |
31 | 30 | 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 %} |
33 | 42 | 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