-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path10.2-calendar.yaml
More file actions
329 lines (329 loc) · 9.96 KB
/
10.2-calendar.yaml
File metadata and controls
329 lines (329 loc) · 9.96 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
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
alias: "960x640 캘린더 & 일정"
description: "10.2인치 960x640 E-Ink 디스플레이용 월간 달력 + 일정 보드"
triggers:
- trigger: time_pattern
hours: /1
actions:
- action: calendar.get_events
target:
entity_id:
- calendar.google
- calendar.holidays
data:
duration:
hours: 72
response_variable: agenda_response
- variables:
font_bold: fonts/GmarketSansTTFBold.ttf
font_med: fonts/GmarketSansTTFMedium.ttf
weather_entity: weather.tongbogdong
temp_sensor: sensor.hyeonjaeondo
day_num: "{{ now().strftime('%d') }}"
month_str: "{{ now().strftime('%B') | upper }}"
weekday_str: "{{ now().strftime('%A') | upper }}"
weather_state: "{{ states(weather_entity) }}"
temp_now: "{{ states(temp_sensor) | float(0) | round(0) }}"
weather_text: >-
{{ states(weather_entity) | replace('partlycloudy', 'Partly Cloudy') |
replace('sunny', 'Sunny') | replace('rainy', 'Rainy') |
replace('cloudy', 'Cloudy') | replace('snowy', 'Snowy') |
replace('lightning', 'Storm') | title }}
agenda_events: |
{% if 'calendar.google' in agenda_response %}
{{ agenda_response['calendar.google']['events'] | sort(attribute='start') }}
{% else %}
[]
{% endif %}
- action: gicisky.write
data:
payload:
- type: rectangle
x_start: 0
y_start: 0
x_end: 960
y_end: 640
fill: white
outline: white
- type: rectangle
x_start: 0
y_start: 0
x_end: 320
y_end: 640
fill: black
outline: black
- type: text
value: "{{ month_str }}"
x: 160
"y": 80
size: 40
font: "{{ font_med }}"
color: white
anchor: mm
- type: text
value: "{{ day_num }}"
x: 160
"y": 220
size: 200
font: "{{ font_bold }}"
color: red
anchor: mm
- type: text
value: "{{ weekday_str }}"
x: 160
"y": 340
size: 36
font: "{{ font_bold }}"
color: white
anchor: mm
- type: line
x_start: 60
x_end: 260
y_start: 400
y_end: 400
width: 2
fill: white
- type: icon
value: weather-{{ weather_state }}
x: 160
"y": 480
size: 100
color: white
anchor: mm
- type: text
value: "{{ temp_now }}°C"
x: 160
"y": 550
size: 40
font: "{{ font_bold }}"
color: white
anchor: mm
- type: text
value: "{{ weather_text }}"
x: 160
"y": 590
size: 24
font: "{{ font_med }}"
color: white
anchor: mm
- type: text
value: TASKS & EVENTS
x: 360
"y": 60
size: 28
font: "{{ font_bold }}"
color: black
anchor: lm
- type: line
x_start: 360
x_end: 920
y_start: 90
y_end: 90
width: 3
fill: black
- type: rectangle
x_start: 360
y_start: 110
x_end: 370
y_end: 180
fill: red
visible: "{{ agenda_events | length > 0 }}"
- type: text
value: |
{%- if agenda_events | length > 0 -%}
{%- set event = agenda_events[0] -%}
{%- set s = event.start -%}
{%- if s is mapping -%}
{%- if s.date -%}TODAY{%- elif s.dateTime -%}{{ as_timestamp(s.dateTime) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- else -%}{{ as_timestamp(s) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- endif -%}
x: 390
"y": 130
size: 32
font: "{{ font_bold }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 0 }}"
- type: text
value: |
{%- if agenda_events | length > 0 -%}
{{ agenda_events[0].summary | truncate(30, true, '..') }}
{%- endif -%}
x: 390
"y": 165
size: 28
font: "{{ font_med }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 0 }}"
- type: text
value: |
{%- if agenda_events | length > 1 -%}
{%- set event = agenda_events[1] -%}
{%- set s = event.start -%}
{%- if s is mapping -%}
{%- if s.date -%}ALL DAY{%- elif s.dateTime -%}{{ as_timestamp(s.dateTime) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- else -%}{{ as_timestamp(s) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- endif -%}
x: 360
"y": 220
size: 30
font: "{{ font_bold }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 1 }}"
- type: text
value: |
{%- if agenda_events | length > 1 -%}
{{ agenda_events[1].summary | truncate(38, true, '..') }}
{%- endif -%}
x: 480
"y": 220
size: 28
font: "{{ font_med }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 1 }}"
- type: line
x_start: 360
x_end: 920
y_start: 255
y_end: 255
width: 1
fill: black
visible: "{{ agenda_events | length > 1 }}"
- type: text
value: |
{%- if agenda_events | length > 2 -%}
{%- set event = agenda_events[2] -%}
{%- set s = event.start -%}
{%- if s is mapping -%}
{%- if s.date -%}ALL DAY{%- elif s.dateTime -%}{{ as_timestamp(s.dateTime) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- else -%}{{ as_timestamp(s) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- endif -%}
x: 360
"y": 290
size: 30
font: "{{ font_bold }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 2 }}"
- type: text
value: |
{%- if agenda_events | length > 2 -%}
{{ agenda_events[2].summary | truncate(38, true, '..') }}
{%- endif -%}
x: 480
"y": 290
size: 28
font: "{{ font_med }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 2 }}"
- type: line
x_start: 360
x_end: 920
y_start: 325
y_end: 325
width: 1
fill: black
visible: "{{ agenda_events | length > 2 }}"
- type: text
value: |
{%- if agenda_events | length > 3 -%}
{%- set event = agenda_events[3] -%}
{%- set s = event.start -%}
{%- if s is mapping -%}
{%- if s.date -%}ALL DAY{%- elif s.dateTime -%}{{ as_timestamp(s.dateTime) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- else -%}{{ as_timestamp(s) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- endif -%}
x: 360
"y": 360
size: 30
font: "{{ font_bold }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 3 }}"
- type: text
value: |
{%- if agenda_events | length > 3 -%}
{{ agenda_events[3].summary | truncate(38, true, '..') }}
{%- endif -%}
x: 480
"y": 360
size: 28
font: "{{ font_med }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 3 }}"
- type: line
x_start: 360
x_end: 920
y_start: 395
y_end: 395
width: 1
fill: black
visible: "{{ agenda_events | length > 3 }}"
- type: text
value: |
{%- if agenda_events | length > 4 -%}
{%- set event = agenda_events[4] -%}
{%- set s = event.start -%}
{%- if s is mapping -%}
{%- if s.date -%}ALL DAY{%- elif s.dateTime -%}{{ as_timestamp(s.dateTime) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- else -%}{{ as_timestamp(s) | timestamp_custom('%H:%M') }}{%- endif -%}
{%- endif -%}
x: 360
"y": 430
size: 30
font: "{{ font_bold }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 4 }}"
- type: text
value: |
{%- if agenda_events | length > 4 -%}
{{ agenda_events[4].summary | truncate(38, true, '..') }}
{%- endif -%}
x: 480
"y": 430
size: 28
font: "{{ font_med }}"
color: black
anchor: lm
visible: "{{ agenda_events | length > 4 }}"
- type: line
x_start: 360
x_end: 920
y_start: 465
y_end: 465
width: 1
fill: black
visible: "{{ agenda_events | length > 4 }}"
- type: text
value: You have a free day!
x: 640
"y": 300
size: 36
font: "{{ font_bold }}"
color: black
anchor: mm
visible: "{{ agenda_events | length == 0 }}"
- type: text
value: Enjoy your time.
x: 640
"y": 350
size: 28
font: "{{ font_med }}"
color: black
anchor: mm
visible: "{{ agenda_events | length == 0 }}"
- type: text
value: Make today count.
x: 920
"y": 600
size: 24
font: "{{ font_med }}"
color: red
anchor: rm
target:
device_id: b57204e610be646ecf56f8a8a12abb50