-
Notifications
You must be signed in to change notification settings - Fork 0
/
automation-2.9-xmas-countdown.yaml
67 lines (67 loc) · 2.41 KB
/
automation-2.9-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
alias: Epaper Tags - Xmas Advent Countdown
description: "Count down the days till Christmas Day! The date of Christmas is set in the variable days_until_xmas and shouldn't need altering year on year. All images are pulled down from an external server (https://www.chunkymedia.co.uk) - keep you surprised! All images are royalty free from Pixabay. The text used is 'Days 'til Christmas', 'Day 'til Christmas', and 'Merry Christmas' - adjust according to your local language. Edit in YAML."
trigger:
- platform: time
at: "00:05:00"
action:
- service: open_epaper_link.drawcustom
data:
background: white
rotate: 270
payload:
- type: text
value: "{{ '' if days_until_xmas<=0 else days_until_xmas }}"
font: ../../media/GothamRnd-Bold.ttf
x: 64
"y": >-
{{ 168 if days_until_xmas > 99 else 160 | int }}
size: >-
{{ 60 if days_until_xmas > 99 else 84 | int }}
color: red
anchor: mt
y_padding: 0
spacing: 2
- type: dlimg
url: >-
{% if days_until_xmas <= 25 %}
https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-{{ days_until_xmas | string }}.jpg
{% else %}
https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-grinch.jpg
{% endif %}
x: 0
"y": 0
xsize: 128
ysize: "{{ 220 if days_until_xmas<=0 else 156 }}"
rotate: 0
- 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: 64
"y": 230
size: 24
color: black
anchor: mt
- type: text
value: Christmas
font: ../../media/GothamRnd-Bold.ttf
x: 64
size: 24
color: black
anchor: mt
target:
entity_id:
- open_epaper_link.000002123456ABC
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 %}