-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathvacuum_maintenance_reminder.yaml
233 lines (216 loc) · 7.18 KB
/
vacuum_maintenance_reminder.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
blueprint:
name: Vacuum maintenance reminder
description: Get a notification when your vacuum needs maintenance
domain: automation
input:
reminder_time:
name: Reminder time
description: At what time do you want to be reminded
selector:
time: {}
notify_device:
name: Notification
description: Device needs to run the official Home Assistant app to receive notifications
selector:
device:
integration: mobile_app
vacuum_entity:
name: Vacuum entity id
selector:
entity:
domain: vacuum
vacuum_dirty_entity:
name: Vacuum sensor dirty entity id
selector:
entity:
domain: sensor
vacuum_filter_entity:
name: Vacuum sensor filter entity id
selector:
entity:
domain: sensor
vacuum_main_brush_entity:
name: Vacuum sensor main brush entity id
selector:
entity:
domain: sensor
vacuum_side_brush_entity:
name: Vacuum sensor side brush entity id
selector:
entity:
domain: sensor
notification_title:
name: Notification title (Optional)
description: "Default: Vacuum maintenance reminder!"
default: "Vacuum maintenance reminder!"
notification_message_sensors:
name: Notification message for sensors (Optional)
description: "Default: Please clean sensors"
default: "Please clean sensors"
notification_message_filter:
name: Notification message for filter (Optional)
description: "Default: Please replace filter"
default: "Please replace filter"
notification_message_main_brush:
name: Notification message for main brush (Optional)
description: "Default: Please replace main brush"
default: "Please replace main brush"
notification_message_side_brush:
name: Notification message for side brush (Optional)
description: "Default: Please replace side brush"
default: "Please replace side brush"
notification_action_done:
name: "Notification action: Done (Optional)"
description: "Default: Done"
default: "Done"
notification_action_skip:
name: "Notification action: Skip (Optional)"
description: "Default: Skip"
default: "Skip"
optional_action:
name: Optional action
description: Run an action like notify a speaker at the same time that the mobile notification
selector:
action: {}
default: []
trigger:
- platform: time
at: !input reminder_time
mode: restart
action:
- alias: "Check Sensor dirty state"
choose:
- conditions:
- condition: numeric_state
entity_id: !input vacuum_dirty_entity
below: 0
sequence:
- choose:
- conditions: "{{ true }}"
sequence: !input optional_action
- device_id: !input notify_device
domain: mobile_app
type: notify
title: !input notification_title
message: !input notification_message_sensors
data:
actions:
- title: !input notification_action_done
action: "sensor_done"
- title: !input notification_action_skip
action: "skip"
tag: "vacuum-maintenance-reminder"
- alias: "Check Filter time state"
choose:
- conditions:
- condition: numeric_state
entity_id: !input vacuum_filter_entity
below: 0
sequence:
- choose:
- conditions: "{{ true }}"
sequence: !input optional_action
- device_id: !input notify_device
domain: mobile_app
type: notify
title: !input notification_title
message: !input notification_message_filter
data:
actions:
- title: !input notification_action_done
action: "filter_done"
- title: !input notification_action_skip
action: "skip"
tag: "vacuum-maintenance-reminder"
- alias: "Check main brush time state"
choose:
- conditions:
- condition: numeric_state
entity_id: !input vacuum_main_brush_entity
below: 0
sequence:
- choose:
- conditions: "{{ true }}"
sequence: !input optional_action
- device_id: !input notify_device
domain: mobile_app
type: notify
title: !input notification_title
message: !input notification_message_main_brush
data:
actions:
- title: !input notification_action_done
action: "main_brush_done"
- title: !input notification_action_skip
action: "skip"
tag: "vacuum-maintenance-reminder"
- alias: "Check side brush time state"
choose:
- conditions:
- condition: numeric_state
entity_id: !input vacuum_side_brush_entity
below: 0
sequence:
- choose:
- conditions: "{{ true }}"
sequence: !input optional_action
- device_id: !input notify_device
domain: mobile_app
type: notify
title: !input notification_title
message: !input notification_message_side_brush
data:
actions:
- title: !input notification_action_done
action: "side_brush_done"
- title: !input notification_action_skip
action: "skip"
tag: "vacuum-maintenance-reminder"
# handle results
- wait_for_trigger:
platform: event
event_type: mobile_app_notification_action
timeout:
hours: 1
- choose:
- conditions: "{{ wait.trigger.event.data.action == 'sensor_done' }}"
sequence:
- service: vacuum.send_Command
target:
entity_id: !input vacuum_entity
data:
command: reset_consumable
params: ["sensor_dirty_time"]
- choose:
- conditions: "{{ wait.trigger.event.data.action == 'filter_done' }}"
sequence:
- service: vacuum.send_Command
target:
entity_id: !input vacuum_entity
data:
command: reset_consumable
params: ["filter_work_time"]
- choose:
- conditions: "{{ wait.trigger.event.data.action == 'main_brush_done' }}"
sequence:
- service: vacuum.send_Command
target:
entity_id: !input vacuum_entity
data:
command: reset_consumable
params: ["main_brush_work_time"]
- choose:
- conditions: "{{ wait.trigger.event.data.action == 'side_brush_done' }}"
sequence:
- service: vacuum.send_Command
target:
entity_id: !input vacuum_entity
data:
command: reset_consumable
params: ["side_brush_work_time"]
- device_id: !input notify_device
domain: mobile_app
type: notify
message: "clear_notification"
data:
tag: "vacuum-maintenance-reminder"