mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-12-03 11:31:42 +00:00
59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
######################################################################
|
|
# @CCOSTAN - Follow Me on X
|
|
# For more info visit https://www.vcloudinfo.com/click-here
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
# -------------------------------------------------------------------
|
|
# 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.
|
|
######################################################################
|
|
automation:
|
|
- alias: "Nightly Frigate Server Reboot"
|
|
id: nightly_frigate_reboot
|
|
description: "Reboots the Frigate server every day at 5 AM"
|
|
mode: single
|
|
trigger:
|
|
- platform: time
|
|
at: "05:00:00"
|
|
action:
|
|
- service: button.press
|
|
target:
|
|
entity_id: button.qemu_docker2_101_reboot
|
|
|
|
- alias: "Proxmox Updates Repair Issues"
|
|
id: proxmox_updates_repair
|
|
description: "Track repair issues when Proxmox hosts report updates."
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.node_proxmox1_updates_packages
|
|
- 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:
|
|
- choose:
|
|
- conditions: "{{ trigger.to_state.state == 'on' }}"
|
|
sequence:
|
|
- service: repairs.create
|
|
data:
|
|
issue_id: "{{ issue_id }}"
|
|
severity: warning
|
|
persistent: false
|
|
title: "{{ node_name }} has updates available"
|
|
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 }}"
|