What does the sensor look like in developer tools?
And what does the automation trace say?
The restful sensor seems to work
sensor.api_ninja_dad_jokes
API Ninja - Dad Jokes
OK joke: Where do elephants store luggage? In a trunk.
friendly_name: API Ninja - Dad Jokes
but the automation dosen’t! It says “anchor not supported for multiline text” as below.
Executed: November 8, 2024 at 12:07:00
Error: anchor not supported for multiline text
Result:
params:
domain: open_epaper_link
service: drawcustom
service_data:
background: white
rotate: 0
payload:
- type: icon
value: emoticon-lol
x: 1
'y': 1
size: 35
color: red
- type: icon
value: emoticon-confused
x: 260
'y': 92
size: 35
color: red
- type: text
value: Where do elephants store luggage? In a trunk.
font: ../../media/GothamRnd-Bold.ttf
x: 32
'y': 32
size: 26
color: black
anchor: lt
max_width: 232
y_padding: 0
spacing: 2
entity_id:
- open_epaper_link.00000335025f3e11
target:
entity_id:
- open_epaper_link.00000335025f3e11
running_script: false
So what happens if you remove the anchor?
lt
is the default anyway
Now it works, thanks!
alias: API Ninjas - Chuck Norris
description: Show an awesome Chuck Norris quote, joke, fact (mostly true!), every hour!
triggers:
- minutes: "8"
trigger: time_pattern
actions:
- data:
background: white
rotate: 0
payload:
- type: icon
value: comment-quote
x: 1
"y": 1
size: 35
color: red
- type: text
value: Chuck Norris
font: ../../media/GothamRnd-Bold.ttf
x: 38
"y": 10
size: 28
color: red
max_width: 200
y_padding: 0
spacing: 3
- type: icon
value: emoticon-confused
x: 240
"y": 110
size: 35
color: red
- type: dlimg
url: /config/media/chuck-icon.jpg
x: 240
"y": 100
xsize: 50
ysize: 50
rotate: 0
- type: text
value: "{{ state_attr('sensor.api_ninja_chuck_norris', 'joke') | string }}"
font: ../../media/GothamRnd-Bold.ttf
x: 5
"y": 50
size: >-
{% set string_len = state_attr('sensor.api_ninja_chuck_norris',
'joke') | length | int %} {% if string_len <= 50 %}
24 # Adjusted sizes for readability and fitting
{% elif string_len <= 60 %}
20
{% elif string_len <= 100 %}
18
{% elif string_len <= 150 %}
16
{% elif string_len <= 200 %}
14
{% else %}
12
{% endif %}
color: black
max_width: 200
y_padding: 2
spacing: 3
target:
entity_id:
- open_epaper_link.000003337A0B3E19
action: open_epaper_link.drawcustom
mode: restart