forked from mykhailog/hacs_waveshare_ups_hat
-
Notifications
You must be signed in to change notification settings - Fork 3
/
automations.yaml
61 lines (61 loc) · 1.39 KB
/
automations.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
- id: ina219_ups_hat_on_power_loss
alias: '[Hassio UPS] On Power Loss/Restored'
description: Send notification on power loss
trigger:
- platform: state
entity_id:
- binary_sensor.hassio_ups_online
from: 'on'
to: 'off'
for:
hours: 0
minutes: 0
seconds: 5
- platform: state
entity_id:
- binary_sensor.hassio_ups_online
from: 'off'
to: 'on'
for:
hours: 0
minutes: 0
seconds: 5
action:
- if:
- condition: state
entity_id: binary_sensor.hassio_ups_online
state: 'off'
then:
- service: notify.notify
data:
message: Power outage detected
title: "\U0001F50C *Hassio UPS*"
else:
- service: notify.notify
data:
message: Power restored
title: "\U0001F50C *Hassio UPS*"
mode: single
- id: ina219_ups_hat_on_charge_critical
alias: '[Hassio UPS] On Charge Critical'
description: Send notification & gracefully shutdown host
trigger:
- platform: numeric_state
entity_id: sensor.hassio_ups_soc
for:
hours: 0
minutes: 0
seconds: 20
below: 10
action:
- service: notify.notify
data:
message: Battery critical. Shutting down.
title: "\U0001FAAB *Hassio UPS*"
- event: set_shutdown_reason
event_data:
reason: ups_charge_critical
- service: hassio.host_shutdown
data: {}
enabled: true
mode: single