hello i have probleme with my action is dont write my value
target:
entity_id: input_number.pompe_next_trigger_in_minutes
data:
value: >
{% set times = ['06:00:00', '10:00:00', '17:00:00'] %}
{% set now = now() %}
{% set now_stamp = as_timestamp(now) %}
{% set next_time = 0 %}
{% for time in times %}
{% set time_stamp = as_timestamp(strptime(time, '%H:%M:%S')) %}
{% if time_stamp > now_stamp %}
{% set next_time = time %}
{% break %}
{% endif %}
{% endfor %}
{% if next_time %}
{% set next_time_stamp = as_timestamp(strptime(next_time, '%H:%M:%S')) %}
{% set minutes = (next_time_stamp - now_stamp) / 60 %}
{{ minutes | round(0) }}
{% else %}
1440 # Si après 17h, mettre 1440 minutes (24h)
{% endif %}
action: input_number.set_value