Files
homelab-configs/ha/automations.yaml
T
tommy 50e3107e38 ha: add universal media-partition low-space guard for Frigate
Adds a command_line sensor (HAOS Media Partition Free, df of /media =
sda8) and an automation that stops the Frigate add-on when free space
drops below 50 GB for 2 min. Protects HAOS Core from the VAULT1 CIFS
fallthrough fill scenario (RB-001). Fires regardless of CIFS mount
state — the mount sensor can be stale during the crisis. Stop-only +
max-priority ntfy alert; no auto-remount (needs admin token).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 21:33:28 -05:00

107 lines
4.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- id: '1770778485341'
alias: Frigate Notifications (0.14.0.2w)
description: ''
use_blueprint:
path: SgtBatten/Stable.yaml
input:
base_url: https://ha.goattw.net
notify_device: 77ce3c5e3add8ea306c1a8e28477809a
camera:
- camera.front_porch
tap_action: https://ha.goattw.net/api/frigate/notifications/{{id}}/clip.mp4
- id: diun_image_update
alias: Diun - Docker Image Update Notification
description: Sends a mobile notification when Diun detects a new Docker image version
triggers:
- platform: webhook
webhook_id: diun_image_update
allowed_methods:
- POST
actions:
- data:
title: "\U0001F433 Docker Image Update"
message: '{{ trigger.json.message }}'
action: notify.mobile_app_tomcell
- id: ha_core_version_update_alert
alias: HA Core Update - ntfy Alert
description: "ntfy to grafana-alerts when Core installed_version changes; includes old/new version and hard-refresh reminder"
triggers:
- platform: state
entity_id: update.home_assistant_core_update
attribute: installed_version
conditions:
- condition: template
value_template: >-
{{ trigger.from_state is not none
and trigger.to_state is not none
and trigger.from_state.attributes.get('installed_version') not in [none, '']
and trigger.to_state.attributes.get('installed_version') not in [none, '']
and trigger.from_state.attributes['installed_version'] != trigger.to_state.attributes['installed_version'] }}
actions:
- action: rest_command.ntfy_grafana_alerts
data:
title: "HA Core Updated: {{ trigger.to_state.attributes['installed_version'] }}"
message: >-
Core auto-updated: {{ trigger.from_state.attributes['installed_version'] }} → {{ trigger.to_state.attributes['installed_version'] }}.
Hard-refresh your browser: Ctrl+Shift+R (Win/Linux) or Cmd+Shift+R (Mac) to clear frontend cache.
priority: high
tags: warning,house
- id: vault1_mount_heartbeat
alias: VAULT1 Mount Push Heartbeat
description: "Every 5 min: if VAULT1 is CIFS-mounted, push heartbeat to Uptime Kuma. Missed heartbeats alert via ntfy."
triggers:
- platform: time_pattern
minutes: "/5"
conditions:
- condition: state
entity_id: binary_sensor.vault1_cifs_mounted
state: "on"
actions:
- action: rest_command.vault1_push_heartbeat
- id: vault1_mount_lost_alert
alias: VAULT1 Mount Alert on CIFS Lost
description: "Alert via ntfy if VAULT1 stops being CIFS-mounted (fallthrough to sda8 scenario)."
triggers:
- platform: state
entity_id: binary_sensor.vault1_cifs_mounted
to: "off"
for: "00:03:00"
actions:
- action: rest_command.ntfy_grafana_alerts
data:
title: "VAULT1 CIFS Lost Frigate writing to sda8"
message: >-
/media/VAULT1 is no longer CIFS-mounted (//172.30.32.1/VAULT1 dropped).
Frigate recordings are going to sda8 (system partition) until fixed.
See RB-001 in runbooks/phase5-incident-log.md for recovery steps.
priority: high
tags: warning,house
- id: frigate_disk_guard_stop
alias: Frigate Disk Guard Stop Frigate when media partition low
description: >-
Universal low-space safety net. If the HAOS /media (sda8) partition free
space drops below threshold, stop the Frigate add-on so it can't fill the
system partition and take Core down. Fires regardless of VAULT1 CIFS state
(the mount sensor can be stale during exactly this crisis).
triggers:
- platform: numeric_state
entity_id: sensor.haos_media_partition_free
below: 50 # GB free — tune to taste
for: "00:02:00"
actions:
- action: hassio.addon_stop
data:
addon: ccab4aaf_frigate-fa # confirm slug: Settings → Add-ons → Frigate → URL
- action: rest_command.ntfy_grafana_alerts
data:
title: "Frigate STOPPED HAOS media partition low"
message: >-
Only {{ states('sensor.haos_media_partition_free') }} GB free on /media
(sda8). Frigate add-on stopped to protect the system partition. Check
whether VAULT1 CIFS dropped (RB-001), clear space, then restart Frigate.
priority: max
tags: rotating_light,house