-
Notifications
You must be signed in to change notification settings - Fork 3
/
nightclock_awtrix.yaml
338 lines (306 loc) · 11.4 KB
/
nightclock_awtrix.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
blueprint:
name: "AWTRIX Night Clock"
description: >
## AWTRIX Night Clock
This blueprint provides a night clock mode for AWTRIX Light. It allows you to personalize various aspects of the clockface to suit your preferences.
### Screenshot
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/SCR-nightclock.png)
### Features
- This blueprint features a night clock mode, which displays a customized color, and you have the possibility to disable app transitions, automatic brightness, and the color of the night clock.
### Prerequisites
AWTRIX v0.72
domain: automation
input:
awtrix:
name: AWTRIX Light
description: Select the Awtrix light
selector:
device:
integration: mqtt
manufacturer: Blueforcer
multiple: true
sleep_time:
name: Night mode time
description: At what time does the clock need to activate night mode?
selector:
time: {}
default: "23:00:00"
wake_up_time:
name: Day mode time
description: At what time does the clock need activate day mode?
selector:
time: {}
default: "08:00:00"
sleep_settings_atrans:
name: Enable automatic app transition in night mode.
description: >
This setting allows you to enable or disable automatic transition of apps in night mode.
selector:
boolean:
default: false
sleep_settings_bri:
name: Night mode brightness setting
description: >
What is the brightness for night mode?
selector:
number:
min: 0
max: 255
default: "1"
sleep_settings_abri:
name: Enable automatic brightness when the night mode is active.
description: >
This setting allows you to enable or disable automatic brightening in night mode.
selector:
boolean:
default: false
sleep_settings_color:
name: Color setting for the night mode clock
description: This setting allows you to change the color of the night mode clock.
selector:
color_rgb:
default: [255, 0, 0]
sleep_weekday_bar:
name: Enable the weekday bar for the night mode clock
description: >
This setting allows you to enable or disable the weekday bar for the night mode clock.
selector:
boolean:
default: false
sleep_time_format:
name: Select the time format for the night mode clock
description: >
Select the time format for the night mode clock
selector:
select:
options:
- label: "13:30:45"
value: "%H:%M:%S"
- label: "1:30:45"
value: "%l:%M:%S"
- label: "13:30"
value: "%H:%M"
- label: "13:30 with blinking colon"
value: "%H %M"
- label: "1:30"
value: "%l:%M"
- label: "1:30 with blinking colon"
value: "%l %M"
- label: "1:30 PM"
value: "%l:%M %p"
- label: "1:30 PM with blinking colon"
value: "%l %M %p"
default: "%H:%M"
wakeup_settings_atrans:
name: Enable automatic app transitions in day mode?
description: >
This setting allows you to enable or disable the automatic transition of apps in day mode.
selector:
boolean:
default: true
wakeup_settings_bri:
name: Day mode brightness setting (1-255)
description: >
This setting allows you to adjust the brightness for day mode, pick a value between 1 and 255.
selector:
number:
min: 1
max: 255
default: "127"
wakeup_settings_abri:
name: Enable automatic brightness in day mode
description: >
This setting allows you to enable or disable automatic brightening in day mode.
selector:
boolean:
default: false
wakeup_settings_color:
name: Color setting for the day mode clock
description: This setting allows you to change the color of the day mode clock.
selector:
color_rgb:
default: [255, 255, 255]
wakeup_settings_calendar_color:
name: Color setting for the day mode calendar
description: This setting allows you to change the color of the day mode calendar.
selector:
color_rgb:
default: [255, 0, 0]
wakeup_settings_calendar_text_color:
name: Color setting for the day mode calendar text
description: This settings allows you to change the color of the day mode text in the calendar.
selector:
color_rgb:
default: [0, 0, 0]
wakeup_weekday_bar:
name: Enable the weekday bar for the day mode clock
description: >
This setting allows you to enable or disable the weekday bar for the day mode clock.
selector:
boolean:
default: false
wakeup_active_weekday_maker_color:
name: Color setting for the active weekday marker color
description: This settings allows you to change the active weekday marker color.
selector:
color_rgb:
default: [255, 255, 255]
wakeup_inactive_weekday_maker_color:
name: Color setting for the inactive weekday marker color
description: This settings allows you to change the inactive weekday marker color.
selector:
color_rgb:
default: [55, 57, 59]
wakeup_calendar_style:
name: Select the time/calendar style for the day mode clock
description: >
Select the time/calendar style
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/tmode-0.svg) `Style 0`
---
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/tmode-1.svg) `Style 1`
---
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/tmode-2.svg) `Style 2`
---
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/tmode-3.svg) `Style 3`
---
![](https://raw.githubusercontent.com/RDG88/Homeassistant_Blueprints/main/thumbnails/tmode-4.svg) `Style 4`
selector:
select:
options:
- label: Style 0
value: "0"
- label: Style 1
value: "1"
- label: Style 2
value: "2"
- label: Style 3
value: "3"
- label: Style 4
value: "4"
default: "1"
wakeup_time_format:
name: Select the time format for the day mode clock
description: >
Select the time format for the day mode clock
selector:
select:
options:
- label: "13:30:45"
value: "%H:%M:%S"
- label: "1:30:45"
value: "%l:%M:%S"
- label: "13:30"
value: "%H:%M"
- label: "13:30 with blinking colon"
value: "%H %M"
- label: "1:30"
value: "%l:%M"
- label: "1:30 with blinking colon"
value: "%l %M"
- label: "1:30 PM"
value: "%l:%M %p"
- label: "1:30 PM with blinking colon"
value: "%l %M %p"
default: "%H:%M"
variables:
device_ids: !input awtrix
wake_up_time: !input wake_up_time
sleep_time: !input sleep_time
wakeup_weekday_bar: !input wakeup_weekday_bar
sleep_weekday_bar: !input sleep_weekday_bar
wakeup_settings_atrans: !input wakeup_settings_atrans
wakeup_settings_color: !input wakeup_settings_color
sleep_settings_atrans: !input sleep_settings_atrans
sleep_settings_color: !input sleep_settings_color
sleep_settings_abri: !input sleep_settings_abri
sleep_settings_bri: !input sleep_settings_bri
sleep_time_format: !input sleep_time_format
wakeup_settings_bri: !input wakeup_settings_bri
wakeup_settings_abri: !input wakeup_settings_abri
wakeup_calendar_style: !input wakeup_calendar_style
wakeup_settings_calendar_color: !input wakeup_settings_calendar_color
wakeup_settings_calendar_text_color: !input wakeup_settings_calendar_text_color
wakeup_inactive_weekday_maker_color: !input wakeup_inactive_weekday_maker_color
wakeup_active_weekday_maker_color: !input wakeup_active_weekday_maker_color
wakeup_time_format: !input wakeup_time_format
awtrix_devices: >-
{%- set ns = namespace(awtrix = []) -%}
{%- for device_id in device_ids -%}
{%- set device_name = iif(device_attr(device_id, 'name_by_user') != none, device_attr(device_id, 'name_by_user'), device_attr(device_id, 'name')) -%}
{%- set entity = expand(device_entities(device_id)) | select('search', 'device_topic') | map(attribute='entity_id') | first -%}
{%- set topic = states(entity) -%}
{% set ns.awtrix = ns.awtrix + [{"device": device_name, "entity": entity, "topic": topic}] -%}
{%- endfor -%}
{{ ns.awtrix }}
payload_sleep_switch: >-
{
"name": "Time"
}
payload_sleep_settings: >-
{ "ATRANS": {{ sleep_settings_atrans | lower }},
"BRI": {{ sleep_settings_bri }},
"ABRI": {{ sleep_settings_abri | lower }},
"TMODE": 0,
"TFORMAT": "{{ sleep_time_format }}",
"WD": {{ sleep_weekday_bar | lower }},
"TIME_COL": {{ sleep_settings_color }}
}
payload_wakeup_settings: >-
{ "ATRANS": {{ wakeup_settings_atrans | lower }},
"BRI": {{ wakeup_settings_bri }},
"ABRI": {{ wakeup_settings_abri | lower }},
"CHCOL": {{ wakeup_settings_calendar_color }},
"CTCOL": {{ wakeup_settings_calendar_text_color }},
"TMODE": {{ wakeup_calendar_style }},
"TFORMAT": "{{ wakeup_time_format }}",
"WD": {{ wakeup_weekday_bar | lower }},
"TIME_COL": {{ wakeup_settings_color }},
"WDCA": {{ wakeup_active_weekday_maker_color }},
"WDCI": {{ wakeup_inactive_weekday_maker_color }}
}
trigger:
- platform: time
at: !input wake_up_time
id: wakeup_timer
- platform: time
at: !input sleep_time
id: sleep_timer
condition: []
action:
- repeat:
for_each: "{{ awtrix_devices }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >
{{ states(repeat.item.entity) not in ['unavailable', 'unknown'] }}
sequence:
- if:
- condition: trigger
id:
- wakeup_timer
then:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ repeat.item.topic ~ '/settings'}}"
payload: "{{ payload_wakeup_settings }}"
- if:
- condition: trigger
id:
- sleep_timer
then:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ repeat.item.topic ~ '/settings'}}"
payload: "{{ payload_sleep_settings }}"
- service: mqtt.publish
data:
qos: 0
retain: false
topic: "{{ repeat.item.topic ~ '/switch'}}"
payload: "{{ payload_sleep_switch }}"