Light Fader by Transition Time

Hi All
I’ve noticed that I am no longer able to run this light fader python script (after a recent home assistant update?). Has anyone had similar issues recently?

Previously, it would work like a charm.
Thanks!

It still works for me, although the first time I ran it the response was delayed.

I haven’t had time to debug yet, but I did just post a way to achieve pretty much the same effect, entirely in YAML. Won’t work so well for quick transitions, less then 15 seconds, but seems to work fine for slower transitions. YAML Light Fader for light entities that don’t support “transition”

Hi, can you make it so it calculates how much steps_pct is has to do instead of the default 1.
Like maybe have it calculate based on transition time and remaining pct? Like if I want to have it go from 1 to 100 in 15sec that it will calculate that is has to take steps of 6.67 now I have to have a minimum of 100seconds transition for 1-100 to work. If I do less than 100seconds for a 1-100 transition it will not go to 100pct but stop before it reaches 100.

Or am I missing something?

Hi. The script is just an example I have shared so others can do with it what they will. You could certainly make changes along the lines of what you suggested, although you might have to do some rounding on those percent changes.

Ah okay, thank you for the reply.

I have never worked with python before but it didn’t look that hard to understand. I’ve added a data get into the step_pct and added the option to rgb_color , color_temp to be able to change the colors/white.

Works like a charm, thanks for the code!

There you go! … and you’re welcome.

first of all: thanks for your script!

I have a lutron system in my house as well. I tried your automation and your python script, but the brightness never changes to more then 5% when i use it with a lutron light. it works with hue lights though, any ideas on what the issue could be?

Possibly because the Lutron integration doesn’t like receiving a stream of commands?

All that this python_script does (and the other version you tried in the other thread), is send a stream of light.turn_on commands containing increasing values of brightness. The number of commands, the time between each command and the amount of each brightness increase is calculated by the script.

You can manually simulate it using Developer Tools > Services. Call the light.turn_on service for a Lutron light using a brightness value of 125. Immediately call the same service with a value of 130. Increment and repeat as fast as you can (on the order of 1-5 seconds between service calls). That’s what the script does. By doing this manually, you will quickly discover if the Lutron integration supports this kind of operation.

If you want something non-blocking here’s something I made using pyscript and it’s async sleep:

1 Like

Thanks for this script… it’s a great idea that fills a great need. I am struggling to get this to work, and am finding that it sets the starting brightness correctly, but stays there. I am new to Python but don’t see any flaws in the code. I’ve tried this with several devices, particularly Z-wave dimmer switches. My goal is to be able to (say) fade a light from 20% to 100% over about an hour, and vice versa. So far my testing has been shorter durations (e.g. 30-60 seconds) if that makes a difference.