Script that incriments Dimmer brighness_pct value from 1 to 255?

Hi Everyone,
I just purchased a Zigbee dimmer module in which have discovered that the ‘Transition’ parameter is not compatible with my dimmer module :frowning:

I am trying to achieve an effect when press the ‘Play’ button on my remote, the lights gradually fade down, and similar, when l press the ‘Pause’ button, the lights will gradually fade up.

Would someone be able to kindly share a basic script(s) that they have used to gradually increase the brightness and similar, decrease the brightness interval e.g. 0-255 over 30 seconds?

The other alternative is to find another dimmer module that supports the Transition parameter for light globes which l have been unable to find i.e. only LED dimmer modules available here in Australia.

Thanks in advance!

Here is a thread that should help

https://community.home-assistant.io/t/wake-up-alarm-with-music-and-light-sunrise-sound/150892

Thanks! however, in this script that you have kindly linked, he is using the ‘Transition’ parameter which does not work / not compatible with my dimmer module, therefore this script will not work in my case

I am totally new to HA but l would have thought there be some sort of script that do something like this

For x = 1 to 255
light_turn_on
Brightness_pct = X
Delay 400 ms
Next

I know the above is not possible for HA but l would have thought there is another way to increment the brightness without using the inbuilt (non-compatible) Transition parameter

Thanks

There is and it involves using repeat

FWIW, given a choice, it would be better to have lights that support transition natively. Home Assistant sends far fewer commands to the device compared to the technique you’re considering to use.

brightness_pct ranges from 0 to 100 (because it‘s percent).

1 Like

Thanks and agreed, it would be great if my new module did support the Transition feature as would make things much easier

3A Smart Home DE LXN56-DS27LX1.3
Model: HGZB-02A +
3A Nue Smart Light Dimmer (HGZB-02A) - Zigbee Device

Thanks for reap link
Funny enough, l saw this yesterday and inputted the first script into my HA and got the light to turn on and off 3 times. However, being totally new to HA (3 days in now) l can seem to work out how to reconvert this increment (or decrement) the brightness_pct value over a 30 second period- Would this be something that you could help with please? I am happy to shout you a virtual beer :slight_smile:

You might want to examine this script which is designed to fade a light that doesn’t support transition. You can specify the desired brightness level and transition period and the script takes care of the rest. To be clear, I didn’t invent it, I just simplified it (and converted it from an automation to a script).


NOTE

The reason why it’s more complex than merely a simple repeat is because it can compute the appropriate number of steps, and their duration, in order to perform a fairly smooth transition from any existing brightness level to any desired brightness level.

Excellent!! Thanks for share this

It kind of worked but l found in my case similar another poster that doesn’t increase the bright to 100% and the same for the decrease in brightness i.e. it does reach to zero. I found that if l clicked on the ‘Call Service’ a number of times it eventually reached to end.