mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2026-04-23 08:37:26 +00:00
165 lines
6.9 KiB
YAML
Executable File
165 lines
6.9 KiB
YAML
Executable File
######################################################################
|
|
# @CCOSTAN - Follow Me on X
|
|
# For more info visit https://www.vcloudinfo.com/click-here
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
# -------------------------------------------------------------------
|
|
# Process Monitor - Disk pressure alerting + Joanna dispatch
|
|
# Tracks Home Assistant root filesystem usage from the System Monitor integration.
|
|
# -------------------------------------------------------------------
|
|
# - Blog: https://www.vcloudinfo.com/2026/04/joanna-agent-engineer-home-assistant-infrastructure-dispatch.html
|
|
# Notes: Uses `sensor.disk_use_percent` for the root (`/`) filesystem.
|
|
# Notes: 80% usage writes an immediate activity note; Joanna reviews only after 10 minutes above threshold.
|
|
# Notes: Phone alerts happen only after Joanna dispatch and a short unresolved grace period.
|
|
# Notes: 90% usage opens a Repairs issue and dispatches Joanna for urgent triage.
|
|
######################################################################
|
|
|
|
automation:
|
|
- alias: "Self Heal Disk Use Alarm"
|
|
id: b16f2155-4688-4c0f-9cf8-b382e294a029
|
|
description: "Log elevated root disk usage immediately so transient pressure shows up in the digest."
|
|
mode: single
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
above: 80
|
|
variables:
|
|
mount_path: "/"
|
|
disk_use: "{{ states('sensor.disk_use_percent') | float(0) | round(1) }}"
|
|
action:
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "SYSTEM"
|
|
message: "Disk usage exceeded 80% ({{ mount_path }}: {{ disk_use }}%). Monitoring for sustained pressure."
|
|
- service: tts.clear_cache
|
|
|
|
- alias: "Self Heal Disk Use Joanna Review"
|
|
id: processmonitor_disk_use_joanna_review
|
|
description: "Dispatch Joanna when elevated root disk usage remains above 80% for 10 minutes."
|
|
mode: single
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
above: 80
|
|
for:
|
|
minutes: 10
|
|
variables:
|
|
mount_path: "/"
|
|
disk_use: "{{ states('sensor.disk_use_percent') | float(0) | round(1) }}"
|
|
trigger_context: "HA automation processmonitor_disk_use_joanna_review (Self Heal Disk Use Joanna Review)"
|
|
condition:
|
|
- condition: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
below: 90
|
|
action:
|
|
- service: script.joanna_dispatch
|
|
data:
|
|
trigger_context: "{{ trigger_context }}"
|
|
source: "home_assistant_automation.processmonitor_disk_use_joanna_review"
|
|
summary: "Home Assistant root disk usage remained above 80% for 10 minutes"
|
|
entity_ids:
|
|
- "sensor.disk_use_percent"
|
|
diagnostics: >-
|
|
mount_path={{ mount_path }},
|
|
disk_use={{ disk_use }},
|
|
threshold=80,
|
|
sustained_for=10m
|
|
request: >-
|
|
Review Home Assistant disk growth and recommend safe cleanup actions.
|
|
Check recorder/database size, logs, cache, backups, and temporary files.
|
|
Do not restart Home Assistant or remove data unless explicitly requested.
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "SYSTEM"
|
|
message: >-
|
|
Disk usage remained above 80% for 10 minutes ({{ mount_path }}: {{ disk_use }}%).
|
|
Joanna review requested.
|
|
- delay: "00:05:00"
|
|
- condition: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
above: 80
|
|
below: 90
|
|
- service: script.notify_engine
|
|
data:
|
|
value1: "Hard Drive Monitor:"
|
|
value2: "Joanna is reviewing sustained Home Assistant disk usage at {{ mount_path }}:{{ states('sensor.disk_use_percent') | float(0) | round(1) }}%."
|
|
value3: "No phone alert was sent until the issue stayed unresolved."
|
|
who: "carlo"
|
|
|
|
- alias: "Disk Use Alarm"
|
|
id: 1ce3cb43-0e27-4c53-acdd-d672396f3559
|
|
description: "Open a Repairs issue and dispatch Joanna when root disk usage becomes critical."
|
|
mode: single
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
above: 90
|
|
variables:
|
|
issue_id: "processmonitor_disk_use_critical"
|
|
mount_path: "/"
|
|
disk_use: "{{ states('sensor.disk_use_percent') | float(0) | round(1) }}"
|
|
trigger_context: "HA automation 1ce3cb43-0e27-4c53-acdd-d672396f3559 (Disk Use Alarm)"
|
|
action:
|
|
- service: repairs.create
|
|
data:
|
|
issue_id: "{{ issue_id }}"
|
|
title: "Home Assistant disk usage critical"
|
|
severity: "error"
|
|
persistent: true
|
|
description: >-
|
|
Home Assistant detected critical disk pressure on {{ mount_path }}.
|
|
|
|
disk_use: {{ disk_use }}%
|
|
entity_id: sensor.disk_use_percent
|
|
- service: script.joanna_dispatch
|
|
data:
|
|
trigger_context: "{{ trigger_context }}"
|
|
source: "home_assistant_automation.disk_use_alarm"
|
|
summary: "Home Assistant root disk usage exceeded 90%"
|
|
entity_ids:
|
|
- "sensor.disk_use_percent"
|
|
diagnostics: >-
|
|
issue_id={{ issue_id }},
|
|
mount_path={{ mount_path }},
|
|
disk_use={{ disk_use }},
|
|
threshold=90
|
|
request: >-
|
|
Investigate critical Home Assistant disk usage and recommend or perform safe remediation if available.
|
|
Check recorder/database size, logs, cache, backups, and temporary files first.
|
|
Do not restart Home Assistant or prune/delete data unless explicitly requested.
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "SYSTEM"
|
|
message: >-
|
|
Disk usage exceeded 90% ({{ mount_path }}: {{ disk_use }}%).
|
|
Repair {{ issue_id }} opened and Joanna investigation requested.
|
|
- delay: "00:05:00"
|
|
- condition: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
above: 90
|
|
- service: script.notify_engine
|
|
data:
|
|
value1: "Hard Drive Monitor:"
|
|
value2: "Critical Home Assistant disk usage is still active at {{ mount_path }}:{{ states('sensor.disk_use_percent') | float(0) | round(1) }}%."
|
|
value3: "Joanna has already been dispatched to investigate."
|
|
who: "carlo"
|
|
|
|
- alias: "Disk Use Alarm Recovery"
|
|
id: processmonitor_disk_use_alarm_recovery
|
|
description: "Clear the disk pressure repair once root filesystem usage has recovered."
|
|
mode: single
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.disk_use_percent
|
|
below: 85
|
|
for:
|
|
minutes: 10
|
|
action:
|
|
- service: repairs.remove
|
|
continue_on_error: true
|
|
data:
|
|
issue_id: "processmonitor_disk_use_critical"
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "SYSTEM"
|
|
message: "Disk usage recovered below 85% on /. Repair processmonitor_disk_use_critical cleared."
|