Skip to content

Instantly share code, notes, and snippets.

@g4bri3lDev
Created December 10, 2025 19:13
Show Gist options
  • Select an option

  • Save g4bri3lDev/d5eb8fd945428a7b4bcab15827da1f29 to your computer and use it in GitHub Desktop.

Select an option

Save g4bri3lDev/d5eb8fd945428a7b4bcab15827da1f29 to your computer and use it in GitHub Desktop.
Xmas Advent Countdown Universal Blueprint
blueprint:
name: Xmas Advent Countdown
description: >
Count down the days till Christmas Day on your 2.9" or 4.2" e-paper displays!
This blueprint automatically detects your display size and shows the appropriate layout.
All images are pulled from an external server (https://www.chunkymedia.co.uk) to keep
you surprised - don't peek! Images are royalty free from Pixabay or AI generated.
Features multi-language support (English, German, Dutch, French, Spanish, Polish,
Croatian, Swedish) with automatic Christmas date selection based on your language.
The 2.9" version shows a simple countdown, while the 4.2" version includes the current
date with weekday and month in your chosen language.
domain: automation
homeassistant:
min_version: 2024.6.0
author: g4bri3lDev
input:
displays:
name: E-Paper Displays
description: >
Select one or more OpenEPaperLink displays to show the Christmas countdown.
Works with both 2.9" (296x128) and 4.2" (400x300) displays - the blueprint
automatically detects your display size and adjusts the layout accordingly.
selector:
device:
filter:
- integration: open_epaper_link
multiple: true
language:
name: Language
description: >
Choose your preferred language for all text elements. This affects weekday names,
month names, and Christmas greetings. Also sets the default Christmas celebration
date (Dec 24th for German/Polish, Dec 25th for others).
default: "en"
selector:
select:
options:
- label: "English"
value: "en"
- label: "German"
value: "de"
- label: "Dutch"
value: "nl"
- label: "French"
value: "fr"
- label: "Spanish"
value: "es"
- label: "Polish"
value: "pl"
- label: "Croatian"
value: "hr"
- label: "Swedish"
value: "sv"
optional_settings:
name: Optional Settings
icon: "mdi:cog"
collapsed: true
input:
christmas_day:
name: Christmas Day (Optional)
description: >
Override the default Christmas celebration date. Leave empty to automatically
select December 24th for German/Polish or December 25th for other languages.
Only change this if your cultural tradition differs from the language default.
selector:
select:
options:
- label: "December 24th"
value: "24"
- label: "December 25th"
value: "25"
multiple: false
default: ""
font_file:
name: Font file
description: >
Custom font file (default: ppb.ttf). For better visual quality, use
[`GothamRnd-Bold.ttf`](https://github.com/chunkysteveo/OpenEPaperLink-HA-Christmas-Countdown/raw/refs/heads/main/GothamRnd-Bold.ttf) or another TrueType font
default: ppb.ttf
selector:
text: {}
variables:
displays: !input displays
font_file: !input font_file
christmas_day_input: !input christmas_day
language: !input language
christmas_day: >
{% if christmas_day_input and christmas_day_input != "" %}
{{ christmas_day_input | int }}
{% else %}
{{ iif(language in ['de', 'pl'], 24, 25) }}
{% endif %}
days_until_xmas: >-
{% set days_until = (today_at().replace(day=christmas_day, month=12) | as_local - today_at()).days | int %}
{% if days_until < 0 %}
{{(today_at().replace(day=christmas_day, month=12, year=now().year+1) | as_local - today_at()).days | int }}
{% else %}
{{days_until}}
{% endif %}
language_map: >
{% set map = {
"en": {
"weekdays": ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
"months": ["January","February","March","April","May","June","July","August","September","October","November","December"],
"days": "Days",
"day": "Day",
"til": "'til",
"merry": "Merry",
"christmas": "Christmas"
},
"de": {
"weekdays": ["Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],
"months": ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
"days": "Tage",
"day": "Tag",
"til": "bis",
"merry": "Frohe",
"christmas": "Weihnachten"
},
"nl": {
"weekdays": ["Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag","Zondag"],
"months": ["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],
"days": "Dagen",
"day": "Dag",
"til": "tot",
"merry": "Vrolijk",
"christmas": "Kerstmis"
},
"fr": {
"weekdays": ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"],
"months": ["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],
"days": "Jours",
"day": "Jour",
"til": "avant",
"merry": "Joyeux",
"christmas": "Noël"
},
"es": {
"weekdays": ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"],
"months": ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],
"days": "Días",
"day": "Día",
"til": "para",
"merry": "Feliz",
"christmas": "Navidad"
},
"pl": {
"weekdays": ["Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota","Niedziela"],
"months": ["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],
"days": "Dni",
"day": "Dzień",
"til": "do",
"merry": "Wesołych",
"christmas": "Świąt"
},
"hr": {
"weekdays": ["Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota","Nedjelja"],
"months": ["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],
"days": "Dana",
"day": "Dan",
"til": "do",
"merry": "Sretan",
"christmas": "Božić"
},
"sv": {
"weekdays": ["Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag","Söndag"],
"months": ["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],
"days": "Dagar",
"day": "Dag",
"til": "till",
"merry": "God",
"christmas": "Jul"
}
} %}
{{ map }}
trigger:
- trigger: time
at: "00:05:00"
action:
- repeat:
for_each: !input displays
sequence:
- action: open_epaper_link.drawcustom
target:
device_id: ["{{ repeat.item }}"]
data:
background: white
rotate: >
{{iif(device_attr(repeat.item, 'hw_version') == "296x128", 270, 0)}}
dry-run: false
payload: >
[
{% if device_attr(repeat.item, 'hw_version') == "296x128" %}
{
"type": "dlimg",
"url": "{{ 'https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-' ~ iif(days_until_xmas <= 25, days_until_xmas|string, 'grinch') ~ '.jpg' }}",
"x": 0,
"y": 0,
"xsize": 128,
"ysize": {{ iif(days_until_xmas <= 0, 220, 156) }}
},
{
"type": "text",
"value": "{{ iif(days_until_xmas <= 0, '', days_until_xmas) }}",
"font": "{{ font_file }}",
"x": 64,
"y": {{ iif(days_until_xmas > 99, 168, 160) }},
"size": {{ iif(days_until_xmas > 99, 60, 84) }},
"color": "accent",
"anchor": "mt",
"spacing": 2
},
{
"type": "text",
"value": "{{ iif(days_until_xmas > 0, iif(days_until_xmas > 1, language_map[language]['days'], language_map[language]['day']) ~ ' ' ~ language_map[language]['til'], language_map[language]['merry']) }}",
"font": "{{ font_file }}",
"x": 64,
"y": 230,
"size": 24,
"color": "black",
"anchor": "mt"
},
{
"type": "text",
"value": "{{ language_map[language]['christmas'] }}",
"font": "{{ font_file }}",
"x": 64,
"size": 24,
"color": "black",
"anchor": "mt"
},
{% elif device_attr(repeat.item, 'hw_version') == "400x300" %}
{
"type": "dlimg",
"url": "{{ 'https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-' ~ iif(days_until_xmas <= 25, days_until_xmas|string, 'grinch') ~ '.jpg' }}",
"x": 0,
"y": 0,
"xsize": 128,
"ysize": {{ iif(days_until_xmas <= 0, 220, 156) }}
},
{% else %}
{
"type": "rectangle",
"x_start": 0,
"y_start": 0,
"x_end": 400,
"y_end": 300,
"fill": "white",
"outline": "black",
"width": 1
},
{
"type": "dlimg",
"url": "{{ 'https://www.chunkymedia.co.uk/epaper-xmas/dither_it_epaper-xmas-' ~ iif(days_until_xmas <= 25, days_until_xmas|string, 'grinch') ~ '_42.jpg' }}",
"x": 0,
"y": 0,
"xsize": 400,
"ysize": 300
},
{
"type": "text",
"value": "{{ language_map[language]['weekdays'][now().weekday()] }}",
"font": "{{ font_file }}",
"x": 80,
"y": 20,
"size": 24,
"color": "black",
"anchor": "mt",
"stroke_width": 1,
"stroke_fill": "white"
},
{
"type": "text",
"value": "{% set num = today_at().day | int %}{% set d = {1:'st',2:'nd',3:'rd'} %}{{ num }}{{ iif(language == 'en', iif((num % 100 > 10) and (num % 100 <= 20), 'th', d.get(num % 10, 'th')), '.') }}",
"font": "{{ font_file }}",
"x": 80,
"y": 50,
"size": 50,
"color": "white",
"anchor": "mt",
"stroke_width": 2,
"stroke_fill": "black"
},
{
"type": "text",
"value": "{{ language_map[language]['months'][now().month - 1]}}",
"font": "{{ font_file }}",
"x": 80,
"y": 95,
"size": 24,
"color": "black",
"anchor": "mt"
},
{
"type": "text",
"value": "{{ iif(days_until_xmas <= 0, '', days_until_xmas) }}",
"font": "{{ font_file }}",
"x": 80,
"y": 215,
"size": {{ iif(days_until_xmas > 99, 60, 84) }},
"color": "accent",
"anchor": "mb",
"y_padding": 0,
"spacing": 2,
"stroke_width": 2,
"stroke_fill": "white"
},
{
"type": "text",
"value": "{{ iif(days_until_xmas > 0, iif(days_until_xmas > 1, language_map[language]['days'], language_map[language]['day']) ~ ' ' ~ language_map[language]['til'], language_map[language]['merry']) }}",
"font": "{{ font_file }}",
"x": 80,
"y": 230,
"size": 24,
"color": "black",
"anchor": "mt",
"stroke_width": 1,
"stroke_fill": "white"
},
{
"type": "text",
"value": "{{ language_map[language]['christmas'] }}",
"font": "{{ font_file }}",
"x": 80,
"size": 24,
"color": "black",
"anchor": "mt",
"y_padding": 5,
"stroke_width": 1,
"stroke_fill": "white"
},
{% endif %}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment