-
Notifications
You must be signed in to change notification settings - Fork 185
/
Copy pathsystem.yaml
115 lines (109 loc) · 3.45 KB
/
system.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
#-
# _
# ___ _ _ ___| |_ ___ _ __ ___
# / __| | | / __| __/ _ \ '_ ` _ \
# \__ \ |_| \__ \ || __/ | | | | |
# |___/\__, |___/\__\___|_| |_| |_|
# |___/
#
#- from github.com/basnijholt/home-assistant-config
- alias: "System: warning about high CPU usage"
triggers:
trigger: numeric_state
entity_id: sensor.processor_use
above: 70
for:
hours: 4
actions:
action: notify.iphone_bas
data:
title: "System"
message: "CPU usage has been above 70% for 4 hours! ⚠️🖥"
- alias: "System: warning about high CPU temperature"
triggers:
trigger: numeric_state
entity_id: sensor.cpu_temperature
above: 70
for:
hours: 4
actions:
action: notify.iphone_bas
data:
title: "System"
message: "CPU temperature has been above 70 °C for 4 hours! ⚠️"
- alias: "System: warning about high Xbox temperature"
triggers:
trigger: numeric_state
entity_id: sensor.temperature_xbox
above: 50
actions:
- action: notify.iphone_bas
data:
title: "System"
message: >
Temperature in the Xbox cabinet is {{ states("sensor.temperature_xbox") }} °C! ⚠️
- condition: state
entity_id: media_player.tv
state: "on"
- action: notify.tv
data:
message: >
Temperature in the Xbox cabinet is {{ states("sensor.temperature_xbox") }} °C! ⚠️
- alias: "System: update DNS"
description: Update the DNS at Gandi to point my domain to my Home Assistant instance.
triggers:
trigger: time_pattern # XXX: trigger on IP change
minutes: "/15"
actions:
action: script.update_dns
- alias: "System: run chores"
description: Run shell and Python scripts in utils folder.
triggers:
trigger: time_pattern
minutes: "/15"
actions:
action: shell_command.chores
- alias: "System: MQTT sensors are not updating"
description: Check whether we are receiving messages over MQTT from my other HA instance.
triggers:
trigger: time_pattern
minutes: "/5"
conditions: "{{ (as_timestamp(now()) - as_timestamp(states.sensor.power_consumption.last_changed)) > 20 * 60 }}"
actions:
- action: notify.iphone_bas
data:
title: "System"
message: "Not receiving MQTT updates, maybe reboot the other HA instance! ⚠️"
- delay: "03:00:00" # don't tell me again for three hours
- alias: "System: battery level low"
triggers:
trigger: time
at: "14:30:00"
variables:
min_battery_level: 50
notify_service: notify.iphone_bas
battery_ids: ""
current: ""
actions:
- variables:
battery_ids: >
{% set ns = namespace(battery=[]) %}
{% for s in states.sensor if 'battery_level' in s.entity_id %}
{% set ns.battery = ns.battery + [s] %}
{% endfor %}
{{ ns.battery | map(attribute='entity_id') | list }}
- alias: Repeat
repeat:
count: "{{ battery_ids | length }}"
sequence:
- variables:
current: "{{ battery_ids[repeat.index - 1] }}"
- condition: template
value_template: "{{ 'iphone' not in current and 'ipad' not in current }}"
- condition: template
value_template: "{{ 0 < (states(current) | float) < (min_battery_level | float ) }}"
- action: "{{ notify_service }}"
data:
title: "System"
message: "Battery level low of {{ current }}: {{ states(current) }}%! ⚠️"