I’m not sure if I’m using the correct terminology, but I want to make an automation that defines a few loops for my lights to gradually change over a span of time.
Change 3 starts at 23:00 and gradually dims the lights over a span of 60 minutes to 2200K and 10% brightness
Change 2 starts at 20:00 and gradually dims the lights over a span of 180minutes to 2600K and 20% brightness
Change 1 starts at 16:00 and gradually dims the lights over a span of 240 minutes to 3000K and 30% brightness
Now how I’d like to use the automation, is when I get home before Change 1 starts, it reaches the target brightness+temperature in a duration that is calculated by: time I get home - 16:00
If I get home at a specific time, it should find the next Change that would happen, and change the lights accordingly.
So for example, if I get home at 17:30, it should gradually change the lights by:
variables:
duration: "{{ next_change_start - current time }}" #current time has to be defined
current_bright: "{{ state_attr(target_light, 'brightness') | default(255) }}"
current_kelvin: "{{ state_attr(target_light, 'kelvin') | default(3500) }}"
target_bright: "{{ next_change_target_bright }}"
target_kelvin: "{{ next_change_target_kelvin }}"
intervals: "{{ duration * 12 }}"
Then it changes the lights temperature and brightness every Interval and activates the next change at the relevant start time.
Is this possible for a newbie?