-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToothbrushBlueprint.yaml
More file actions
146 lines (142 loc) · 4.43 KB
/
ToothbrushBlueprint.yaml
File metadata and controls
146 lines (142 loc) · 4.43 KB
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
blueprint:
name: Evening Brushing System
description: A full-system blueprint to track evening toothbrushing and send a random reminder.
domain: automation
author: Your Name (or leave blank)
homeassistant:
min_version: '2023.11.0'
input:
system_id:
name: System ID
description: A unique ID for this system (e.g., 'evening_brushing'). Used for entity names.
default: 'evening_brushing'
selector:
text:
toothbrush_entity:
name: Toothbrush State Sensor
description: The 'state' sensor of your Oral-B toothbrush.
selector:
entity:
domain: sensor
reminder_time:
name: Reminder Time
description: The time of day to send the reminder.
default: '21:00:00'
selector:
time:
evening_check_start_time:
name: Evening Check Start Time
description: The time to start checking for a brushing session.
default: '17:00:00'
selector:
time:
brushing_duration:
name: Brushing Duration (minutes)
description: The length of a valid brushing session.
default: 5
selector:
number:
min: 1
max: 10
step: 1
mode: box
min_random_delay:
name: Minimum Random Delay (minutes)
description: The minimum number of minutes for the random delay.
default: 0
selector:
number:
min: 0
max: 60
step: 1
mode: slider
max_random_delay:
name: Maximum Random Delay (minutes)
description: The maximum number of minutes for the random delay.
default: 10
selector:
number:
min: 0
max: 60
step: 1
mode: slider
notification_device:
name: Notification Device
description: The mobile device to send the notification to.
selector:
device:
integration: mobile_app
notification_title:
name: Notification Title
description: The title of the reminder notification.
default: 'Friendly Reminder'
notification_message:
name: Notification Message
description: The message for the reminder notification.
default: 'Hey, it''s getting late! Don''t forget to brush your teeth.'
automation:
- id: '{{ system_id }}_set_flag'
alias: '{{ system_id | replace("_", " ") | title }} - Set Flag'
description: Turns on helper when toothbrush is used in the evening.
trigger:
- platform: state
entity_id: !input 'toothbrush_entity'
to: 'running'
for:
minutes: !input 'brushing_duration'
condition:
- condition: time
after: !input 'evening_check_start_time'
before: '23:59:59'
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.{{ system_id }}
mode: single
- id: '{{ system_id }}_send_reminder'
alias: '{{ system_id | replace("_", " ") | title }} - Send Reminder'
description: Sends the reminder notification if helper is off.
trigger:
- platform: time
at: !input 'reminder_time'
condition:
- condition: state
entity_id: input_boolean.{{ system_id }}
state: 'off'
action:
- delay:
minutes: "{{ range(states('input_number.{{ system_id }}_min_delay') | int, (states('input_number.{{ system_id }}_max_delay') | int) + 1) | random }}"
- service: notify.mobile_app_{{ device_id(notification_device) }}
data:
title: !input 'notification_title'
message: !input 'notification_message'
mode: single
- id: '{{ system_id }}_reset_flag'
alias: '{{ system_id | replace("_", " ") | title }} - Reset Flag'
description: Resets the helper flag at midnight.
trigger:
- platform: time
at: '00:00:00'
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.{{ system_id }}
mode: single
helper:
- name: '{{ system_id | replace("_", " ") | title }} Toggle'
entity_id: input_boolean.{{ system_id }}
platform: input_boolean
- name: '{{ system_id | replace("_", " ") | title }} Min Delay'
entity_id: input_number.{{ system_id }}_min_delay
platform: input_number
min: 0
max: 60
step: 1
mode: slider
- name: '{{ system_id | replace("_", " ") | title }} Max Delay'
entity_id: input_number.{{ system_id }}_max_delay
platform: input_number
min: 0
max: 60
step: 1
mode: slider