For inspiration; create an automation that repeatedly calls a script, each time passing higher brightness. Then stop the automation when the desired value is reached. It might be triggered by an input boolean, that you disable when the last brightness is reached.
I don’t have it in code, but perhaps this is something you can run with?
you gotta have a service with a delay between each brightness level for this to work. Your best option is a python script or hardcode each brightness level as a ramp up in a single script. With your current automation, your light will just turn on to 246 without any progression.
Thanks for the link but I think python is too advanced for me at this point. I need to better understand yaml before taking the python step.
Without knowing the details this should be possible to do in yaml, combining automation and script as you propsed above?
Is it too much to ask that you write an automation and script example for me? That I would be able to understand and modify myself. For example I dont get how to pass information between the automation and script. As pedro points out there needs to be a delay as well.
Agree, delay is needed. Hardcoded wont work since I want to start at current brightness that will differ over time. Was hoping to find a solution without python.
I like a good challenge. Plus I also have an automation that could use a step by step brightness increase. Currently it’s just a giant script, every step written out without looping.
Can you explain in words what you are trying to achieve? If I’m interpreting correctly, around sunrise you want the brightness to increase to 250, in steps of 20, starting from the current brightness. But only if the current brightness is less than 50. Is that your intention? The trigger time of 23:15 does not seem to fit the profile
It is prototype code so I understand it does not make sense
What I want could be desceibed as; one hour before sundown I want a light to stepwise increase its brightness starting at the current brightness and stop at maximum brightness. The increase should be slow, it could take in total 60 seconds so that a person in the room hardly notices that it is increased.
It is kind if the same functionality as transition: provides but my light source does not support it.
It would be great if the transition time could be changed in the code to select something else than 60 seconds. It would also be great if the end brightness could be chosen in the code to be something else than maximum brightness.
Okay, those two things would have taken me a long time to figure out.
I tried the automation and scripts but get strange behavior, first brightness step is 15 and second is 5. After that the brightness does not change. I need to look into the details further.
For troubleshooting purposes is it possible to print values somewhere while the scripts is running so that I can see what is happening?
Is it possible to see if a script is running, to make sure it is not stuck in an endless loop or something?
What’s so advanced about it? Copy the example to your system and use it. It’s far better than diddling with delays and scripts to create a clumsy version of looping.
If you need help using the suggested python_script, let us know and we’ll walk you through it.
Your example works great after some minor modification. Unfortunately I have found that my light sources need 10 seconds between commands which makes a small step ramp-up of brightness very time consuming, especially if multiple lights are included.
Another question; if I want to do this for say five lights in one automation, do I need to write two scrips per light according to your example or are there better ways not to repeat code over and over? Send the identity ID to the script through template?