Start and stop dimming with one click

Hi

Had my Homey Pro (early 2023) for two weeks now and want to share a refelctions and a flow for dimming lights

REFLECTION
I started with some easy flow and automations but got stuck when it came to something as common as dimming a light. (why is this not a function by it self?) Inititaly I couln’t get it to work with Advanced flow so I added Homeyscript. If “normal” flows is to crawl and Advanced flows is to walk then scrips is not to run it’s more like flying an airplan so had to turn back to advanced flows.

FLOW FOR DIMMING LIGHT
After some experimenting I finaly got it working by pressing button to start dimming and when I press it again it stops at present dim level. I also added a logic to always dim by steps of 5% regardles of where the dim level is when starting.

Some of it is in Swedish so I’ll take you through it.

On top of the first picture is a basic turn on turn off function setting the light at a fixed din and (light-) temparature level.

Then to the acctual dimmin process. There are two identical flows, one for dimming up and one for dimming down (well not exactely identical but you get it) it check if light is on and if there is a dimming loop already runing (this to be able to use the same button to stop the dimming loop) and for dimming up it checks if the dim level is less than 1 (=100%) and if all true it start a second flow for the actual dimming process. Same for dimming down but there I check if dim level is more than 0,01 (=1%).

Now to be able to do this I added two apps, “Better Logic Library” and “Loops”…

-= Before I continue I just need to give a BIG thanks to all antusiasts that makes these greate apps to andvance the funtionality and suport all other users! =-

… okay, so there is one flow for dimming up and one for dimming down, again that are the same but with oposit function so I’m just showing the one for dimming up.

It checks that light is on and then setts the logic for getting a 5% increase. [1 – present dimming level x 100 /5] will give the number of steps needed to get to 100%. (for diming down the calculation is just [present dimming level x100/5]) Then we have the steps for starting, running (iterates) and finishing the loop.

The last step is the function to stop the loop when you are at your disired dimming level. When you press the buttong again it check to see if the loop is runing and if so stops it.

PS. There might be better and smarter ways to do this but I’m just a newbie

4 Likes

Thank you for sharing your flows!

This sound interesting, I have an ikea styrbar that I was planning to use as a dimmer for my ceiling lights that are connected to a qubino dimmer. But I never thought it would be so difficult to make it work. Perhaps I can send you a PM when I have the time to program this. (I’m also from Sweden )

Did you make it work?

Hi
Yes it works just fine.
Please let me know if you want some more details.

Hope 2024 gets us many more functions and updates

Hi, if it were posible for you, Could you share some more details, i am trying to recreate it on my Lights at home, but failing. idk what i am doign wrong.

1 Like