I wrote a script that sets a percentage to my blinder every 30 minutes.
alias: Fechamento gradual persiana escritório
description: Fecha a persiana escritório gradualmente
triggers:
- at: "14:30:00"
trigger: time
- at: "15:00:00"
trigger: time
- at: "15:30:00"
trigger: time
- at: "16:00:00"
trigger: time
- at: "16:30:00"
trigger: time
- at: "17:00:00"
trigger: time
- at: "17:30:00"
trigger: time
- at: "18:00:00"
trigger: time
- at: "18:30:00"
trigger: time
conditions:
- condition: state
entity_id: input_boolean.persiana_automatica_escritorio
state: "on"
- condition: not
conditions:
- type: is_not_open
condition: device
device_id: df15be24bd85a9f8acae6ce3d53974ca
entity_id: ff8160e90429a35e3ec83ff6aa8c0a4f
domain: binary_sensor
actions:
- data:
device_name: persiana escritorio
position: >-
{% set current_time = now().strftime("%H:%M") %} {% if current_time ==
"14:30" %} 15 {% elif current_time == "15:00" %} 30 {% elif
current_time == "15:30" %} 35 {% elif current_time == "15:45" %} 45
{% elif current_time == "16:00" %} 55 {% elif current_time == "16:30"
%} 60 {% elif current_time == "17:00" %} 65 {% elif current_time ==
"17:30" %} 75 {% elif current_time == "18:00" %} 85 {% elif
current_time == "18:30" %} 92 {% endif %}
action: script.persiana_quarto_patch
mode: single
here’s the trace:
Executed: May 16, 2025 at 4:32:13 PM
Error: Error rendering data template: TypeError: Type is not JSON serializable: LoggingUndefined
Result:
params:
domain: script
service: persiana_quarto_patch
service_data:
device_name: persiana escritorio
position: ''
target: {}
running_script: true
child_id:
domain: script
item_id: persiana_quarto_patch
run_id: bd87511bf417307f351a3fdb36b6ec81
it’s sending no position. The only way this can happen is if the script triggers 1 or more minutes after the current_time, as in that case the position is going to be undefined. Is it possible to happen? Could it be that my raspberry pi 5 is so slow that it takes more than 1 minute to trigger?