-
Notifications
You must be signed in to change notification settings - Fork 0
/
garbage-notificaltion-ReCollect.yaml
66 lines (65 loc) · 2.36 KB
/
garbage-notificaltion-ReCollect.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
blueprint:
name: Garbage reminder for ReCollect Waste
domain: automation
input:
reminder_time:
name: Reminder time
description: At what time the day before do you want to be reminded
default: '18:00:00'
selector:
time: {}
day_offset:
name: Day offset
description: Amount of days to be added to the triggers date to check for sensor
value matches. E.g. 1 to be notified the day before or 0 for notification
on the garbage collection day.
default: 1
date_format:
name: Date format
description: Valid strftime date format. Default %Y-%m-%d
default: '%Y-%m-%d'
reminder_title:
name: Reminder title
description: Shown as title in the notification
default: Garbage reminder
reminder_message:
name: Reminder message
description: Accompanying text in the notification
default: 'The following garbage will be picked up tomorrow: '
notifier:
name: Notifier
description: Name of integration you prefer to use for notifications. E.g. notify.notify
default: notify.notify
garbage_sensor_1:
name: Garbage sensor 1
description: Sensor should be a date string formatted according to the date format input
default: ''
selector:
entity:
domain: sensor
garbage_sensor_2:
name: Garbage sensor 2
description: Sensor should be a date string formatted according to the date format input
default: ''
selector:
entity:
domain: sensor
variables:
garbage_sensor_1: !input 'garbage_sensor_1'
garbage_sensor_2: !input 'garbage_sensor_2'
reminder_title: !input 'reminder_title'
reminder_message: !input 'reminder_message'
day_offset: !input 'day_offset'
date_format: !input 'date_format'
sensors_tomorrow: '{{ [(state_attr(garbage_sensor_1, ''pickup_types''), states(garbage_sensor_1)), (state_attr(garbage_sensor_2, ''pickup_types''), states(garbage_sensor_2))] | selectattr(''1'', ''eq'', (now() + timedelta(days = day_offset | int)).strftime(date_format)) | join('', '', attribute=0) }}'
trigger:
platform: time
at: !input 'reminder_time'
condition:
condition: template
value_template: "{{ sensors_tomorrow != '' }}"
action:
service: !input 'notifier'
data:
title: '{{ reminder_title }}'
message: '{{ reminder_message }}{{ sensors_tomorrow }}'