-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-4.2-xmas-countdown.yaml
152 lines (152 loc) · 4.37 KB
/
automation-4.2-xmas-countdown.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
alias: Epaper Tags - Xmas Advent Countdown 4.2 Inch Version
description: >-
Count down the days till Christmas Day! All images are pulled down from an external server
(https://www.chunkymedia.co.uk) - to keep you surprised (don't look!)! All images are royalty
free from Pixabay, or AI generated (apart from Grinch!). The text used is 'Days 'til Christmas', 'Day 'til
Christmas', and 'Merry Christmas'. Days of the week and months (4.2 version) can be found in the
variables section below - adjust according to your local language.
Edit in YAML!
triggers:
- at: "00:01:00"
trigger: time
conditions: []
actions:
- data:
background: white
rotate: 0
dry-run: false
payload:
- type: dlimg
url: |-
{% if days_until_xmas <= 25 %}
https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-{{ days_until_xmas | string }}_42.jpg
{% else %}
https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-grinch_42.jpg
{% endif %}
x: 0
"y": 0
xsize: 400
ysize: 300
rotate: 0
- type: text
value: "{{ weekdays[now().weekday()] }}"
font: ../../media/GothamRnd-Bold.ttf
x: 80
"y": 20
size: 24
color: black
anchor: mt
stroke_width: 1
stroke_fill: white
- type: text
value: "{{ today_at().day | int }}"
font: ../../media/GothamRnd-Bold.ttf
x: "{{ 87 if today_at().day | int > 10 else 82 | int }}"
"y": 50
size: 50
color: white
anchor: rt
align: right
y_padding: 0
spacing: 2
stroke_width: 2
stroke_fill: black
- type: text
value: |-
{%- set d = {1:'st',2:'nd',3:'rd'} %}
{%- set num = today_at().day | int %}
{%- if 10 < num % 100 <= 20 %}
th
{%- else %}
{{ d.get(num % 10, 'th') }}
{%- endif %}
font: ../../media/GothamRnd-Bold.ttf
x: "{{ 90 if today_at().day | int > 10 else 85 | int }}"
"y": 48
size: 24
color: white
anchor: lt
align: left
y_padding: 0
spacing: 2
stroke_width: 2
stroke_fill: black
- type: text
value: "{{ months[now().month -1] }}"
font: ../../media/GothamRnd-Bold.ttf
x: 80
"y": 95
size: 24
color: black
anchor: mt
stroke_width: 1
stroke_fill: white
- type: text
value: "{{ '' if days_until_xmas<=0 else days_until_xmas }}"
font: ../../media/GothamRnd-Bold.ttf
x: 80
"y": 215
size: "{{ 60 if days_until_xmas > 99 else 84 | int }}"
color: red
anchor: mb
y_padding: 0
spacing: 2
stroke_width: 2
stroke_fill: white
- type: text
value: |-
{% if days_until_xmas > 0 %}
{{ ("Days" if days_until_xmas > 1 else "Day") | string + " 'til"}}
{% else %}
Merry
{% endif %}
font: ../../media/GothamRnd-Bold.ttf
x: 80
"y": 230
size: 24
color: black
anchor: mt
stroke_width: 1
stroke_fill: white
- type: text
value: Christmas
font: ../../media/GothamRnd-Bold.ttf
x: 80
y_padding: 5
size: 24
color: black
anchor: mt
stroke_width: 1
stroke_fill: white
target:
entity_id:
- open_epaper_link.UPDATE_YOUR_TAG_MAC_HERE
action: open_epaper_link.drawcustom
mode: restart
variables:
days_until_xmas: >-
{% set days_until = (today_at().replace(day=25, month=12) | as_local -
today_at()).days | int %} {% if days_until < 0 %}
{{(today_at().replace(day=25, month=12, year=now().year+1) | as_local -
today_at()).days | int }} {% else %} {{days_until}} {% endif %}
months:
- January
- February
- March
- April
- May
- June
- July
- August
- September
- October
- November
- December
weekdays:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday