ADD in system Monitor stuff to watch hard drives.

This commit is contained in:
CCOSTAN
2017-02-10 16:00:15 +00:00
parent 6d48831190
commit 2502d74e95
2 changed files with 83 additions and 58 deletions

View File

@@ -75,3 +75,26 @@
- service: script.Voice_notify - service: script.Voice_notify
data_template: data_template:
value1: "There has been a new device detected on the network. Be sure to appropriately catagorize it within Circle." value1: "There has been a new device detected on the network. Be sure to appropriately catagorize it within Circle."
##############################################################################
- alias: "Disk Use Alarm"
trigger:
- platform: numeric_state
entity_id: sensor.disk_use_percent
above: 30.4
action:
- service: script.Voice_notify
data_template:
value1: 'Your harddrive has run out of Space! /dev/root:{{ states.sensor.disk_use_.state }}%!'
- service: script.ifttt_notify
data_template:
value1: 'Hard Drive Monitor:'
value2: "Your harddrive has run out of Space! /dev/root:{{ states.sensor.disk_use_.state }}%!"
value3: ' '
- service: persistent_notification.create
data:
title: "Hard Drive Monitor:"
message: "Your harddrive has run out of Space! /dev/root:{{ states.sensor.disk_use_.state }}%!"
notification_id: "Critical Alert"

View File

@@ -1,59 +1,61 @@
- platform: systemmonitor - platform: systemmonitor
resources: resources:
# - type: last_boot # - type: last_boot
- type: since_last_boot - type: since_last_boot
- type: disk_use_percent
- platform: template arg: /
sensors:
since_last_boot_templated: - platform: template
value_template: >- sensors:
{%- set slb = states.sensor.since_last_boot.state.split(' ') -%} since_last_boot_templated:
{%- set count = slb | length -%} value_template: >-
{%- set hms = slb[count - 1] -%} {%- set slb = states.sensor.since_last_boot.state.split(' ') -%}
{%- set hms_trimmed = hms.split('.')[0] -%} {%- set count = slb | length -%}
{%- set hms_split = hms_trimmed.split(':') -%} {%- set hms = slb[count - 1] -%}
{%- set hours = hms_split[0] | int -%} {%- set hms_trimmed = hms.split('.')[0] -%}
{%- set minutes = hms_split[1] | int -%} {%- set hms_split = hms_trimmed.split(':') -%}
{%- set seconds = hms_split[2] | int -%} {%- set hours = hms_split[0] | int -%}
{%- set minutes = hms_split[1] | int -%}
{%- if count == 3 -%} {%- set seconds = hms_split[2] | int -%}
{{ slb[0] ~ ' ' ~ slb[1] ~ ' ' }}
{%- endif -%} {%- if count == 3 -%}
{%- if hours > 0 -%} {{ slb[0] ~ ' ' ~ slb[1] ~ ' ' }}
{%- if hours == 1 -%} {%- endif -%}
1 hour {%- if hours > 0 -%}
{%- else -%} {%- if hours == 1 -%}
{{ hours }} hours 1 hour
{%- endif -%} {%- else -%}
{%- endif -%} {{ hours }} hours
{%- if minutes > 0 -%} {%- endif -%}
{%- if hours > 0 -%} {%- endif -%}
{{ ', ' }} {%- if minutes > 0 -%}
{%- endif -%} {%- if hours > 0 -%}
{%- if minutes == 1 -%} {{ ', ' }}
1 minute {%- endif -%}
{%- else -%} {%- if minutes == 1 -%}
{{ minutes }} minutes 1 minute
{%- endif -%} {%- else -%}
{%- endif -%} {{ minutes }} minutes
{%- if seconds > 0 -%} {%- endif -%}
{%- if hours > 0 or minutes > 0 -%} {%- endif -%}
{{ ', ' }} {%- if seconds > 0 -%}
{%- endif -%} {%- if hours > 0 or minutes > 0 -%}
{%- if seconds == 1 -%} {{ ', ' }}
1 second {%- endif -%}
{%- else -%} {%- if seconds == 1 -%}
{{ seconds }} seconds 1 second
{%- endif -%} {%- else -%}
{%- endif -%} {{ seconds }} seconds
{%- endif -%}
- platform: rest {%- endif -%}
resource: http://ip.jsontest.com
name: External IP - platform: rest
value_template: '{{ value_json.ip }}' resource: http://ip.jsontest.com
name: External IP
- platform: template value_template: '{{ value_json.ip }}'
sensors:
ipchange: - platform: template
entity_id: sensor.external_ip sensors:
ipchange:
entity_id: sensor.external_ip
value_template: "{%- if is_state('sensor.external_ip', '!secret external_ip') -%} False {%- else -%} True {%- endif %}" value_template: "{%- if is_state('sensor.external_ip', '!secret external_ip') -%} False {%- else -%} True {%- endif %}"