-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestart-notifier.yaml
68 lines (59 loc) · 1.8 KB
/
restart-notifier.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
---
# SPDX-License-Identifier: MIT
blueprint:
name: Restart Notifier (v0.1)
description: |
Sends a notification when Home Assistant restarts
domain: automation
input:
notify_service:
name: Zulip Notify
description: |
Notify service name to send to. Should be a Zulip (or compatible)
notify service
default: "zulip"
notify_topic:
name: Notification topic
description: |
The topic that will be used in the Zulip stream
default: "{{ state_attr('zone.home', 'friendly_name') }} restart"
notify_message_prelude:
name: Notification message prelude
description: |
The flavor text to prelude schedules with
default: "{{ state_attr('zone.home', 'friendly_name') }} "
mode: single
triggers:
- event: shutdown
id: shutdown
trigger: homeassistant
- event: start
id: startup
trigger: homeassistant
variables:
# inputs
input_notify_service: !input notify_service
input_notify_topic: !input notify_topic
input_notify_message_prelude: !input notify_message_prelude
# yamllint disable-line rule:line-length
notify_target: "{{ input_notify_service | lower | replace('notify.', '') | replace(' ', '_') }}"
condition: []
actions:
- choose:
- conditions:
- condition: trigger
id: shutdown
sequence:
- data:
message: "{{ input_notify_message_prelude }} shutting down"
title: "{{ input_notify_topic }}"
action: notify.{{ notify_target }}
- conditions:
- condition: trigger
id: startup
sequence:
- data:
message: "{{ input_notify_message_prelude }} has started"
title: "{{ input_notify_topic }}"
action: notify.{{ notify_target }}
default: []