#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
#-------------------------------------------
# homeassistant:
#   customize:
#     sensor.process_mosquitto:
#       friendly_name: 'Mosquitto'
#
#  Uses SYSTEMMONITOR integration
#-------------------------------------------


#-------------------------------------------
##############################################################################
###  Automations - Detect when things are not right. Like any Good Watchdog.
##############################################################################

automation:

  - alias: "Self Heal Disk Use Alarm"
    id: b16f2155-4688-4c0f-9cf8-b382e294a029
    trigger:
      - platform: numeric_state
        entity_id: sensor.disk_use_percent
        above: 80
    action:
      - service: script.notify_engine
        data:
          value1: 'Hard Drive Monitor:'
          value2: "Your harddrive is running out of Space! /dev/root:{{ states.sensor.disk_use_percent.state }}%!"
          value3: 'Attempting to clean'
          who: 'carlo'
      - service: tts.clear_cache

  - alias: "Disk Use Alarm"
    id: 1ce3cb43-0e27-4c53-acdd-d672396f3559
    trigger:
      - platform: numeric_state
        entity_id: sensor.disk_use_percent
        above: 90
    action:
      - service: script.notify_engine
        data:
          value1: 'Hard Drive Monitor:'
          value2: "Your harddrive is running out of Space! /dev/root:{{ states.sensor.disk_use_percent.state }}%!"
          who: 'carlo'