Last active
January 29, 2025 19:09
-
-
Save g4bri3lDev/d1b133d74430a64b3b73d0f2c5eb008d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: OEPL Todo List | |
description: > | |
Displays uncompleted tasks from a to-do list on an OpenEPaperLink display. | |
domain: automation | |
author: g4bri3lDev | |
source_url: https://gist.githubusercontent.com/g4bri3lDev/d1b133d74430a64b3b73d0f2c5eb008d/raw | |
input: | |
todo_list: | |
name: To-do List | |
description: "Select your to-do list entity" | |
selector: | |
entity: | |
filter: | |
domain: todo | |
display_device: | |
name: EPaper Display | |
description: "Select your OpenEPaperLink display(s)" | |
selector: | |
device: | |
filter: | |
integration: open_epaper_link | |
multiple: true | |
max_items: | |
name: Maximum number of tasks | |
description: "Show only this many tasks on the display" | |
default: 5 | |
selector: | |
number: | |
min: 1 | |
max: 20 | |
mode: slider | |
step: 1 | |
trigger: | |
- trigger: state | |
entity_id: !input todo_list | |
variables: | |
todo_list_entity: !input todo_list | |
display_device_id: !input display_device | |
max_items: !input max_items | |
action: | |
- action: todo.get_items | |
target: | |
entity_id: !input todo_list | |
data: | |
status: needs_action | |
response_variable: raw_items | |
- variables: | |
# The service returns a dict with a key for the entity, and inside that a dict with "items" | |
# e.g. { "todo.shopping_list": { "items": [ {summary:..} ] } } | |
tasks: > | |
{% set list_id = todo_list_entity %} | |
{% if list_id in raw_items and 'items' in raw_items[list_id] %} | |
{{ raw_items[list_id]["items"] }} | |
{% else %} | |
[] | |
{% endif %} | |
- action: open_epaper_link.drawcustom | |
target: | |
device_id: !input display_device | |
data: | |
background: white | |
rotate: 0 | |
payload: | |
- type: text | |
x: 10 | |
y: 10 | |
value: "{{ state_attr(todo_list_entity, 'friendly_name') }}" | |
size: 20 | |
color: black | |
- type: multiline | |
x: 20 | |
y: 50 | |
value: |- | |
{% for task in tasks[:max_items] or [] %} | |
- {{ task.summary }} | |
{%- if not loop.last %}|{% endif %} | |
{% endfor %} | |
delimiter: "|" | |
offset_y: 15 | |
size: 16 | |
color: black | |
- type: text | |
x: "98%" | |
y: 10 | |
anchor: "rt" | |
value: "Updated: {{ now().strftime('%H:%M') }}" | |
size: 12 | |
color: black |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment