I think the solution isn’t as straightforward, but there has to be some workaround.
I currently have 7 scripts based on the same blueprint, with the same variables:
variables:
previous_time: >
{% set time = states('input_datetime.previous_script_end') %} {{ time[:8] }}
start_time: !input start_time
end_time: !input end_time
steps_per_minute: !input steps_per_minute
start_kelvin: !input start_kelvin
end_kelvin: !input end_kelvin
start_bright: !input start_bright
end_bright: !input end_bright
manual_override: !input manual_override
reminder_continue_change: !input reminder_continue_change
duration: >
{% set start = strptime(start_time, '%H:%M:%S') %} {% set end =
strptime(end_time, '%H:%M:%S') %} {% if start > end %}
{% set end = end + timedelta(days=1) %}
{% endif %} {{ (end - start).total_seconds() / 60 }}
intervals: "{{ duration * steps_per_minute | int }}"
step_kelvin: "{{ ((end_kelvin - start_kelvin) / intervals) }}"
step_bright: "{{ ((end_bright - start_bright) / intervals) }}"
Now I want to retrieve some of the values (start_time, end_time, start_kelvin, start_bright, steps_per_minute) outside of the scripts.
To solve this, I created 3 helpers for each script (helper_start_kelvin, helper_start_bright and helper_start_time).
This obviously is not ideal.
For start_time, I’m trying to acomplish an automation that finds the start time that is closest to the current time and then runs the script that is associated with that start_time.
Does anyone have an idea how to solve this and make this more efficient?