Homey Community Forum

[HOWTO][PRO] Dim lights with buttons using transitions

This topic is to explain how you can use long press/release with a button to dim lights. Note that if you use z-wave associations you do not need this tutorial, and dimming will be smoother. But for all other cases, this will do the trick.

For this tutorial I implemented one-button dimming, where the lights dim up and down until the button is released. The simpeler version: dim up with one button, dim down with another can be created using the same building blocks with ease if you get this one.

For this example I use the Chronograph - Adds precise timer, stopwatch and transition functionality to Homey app to create a transition. A transition is a change from one value to another in steps. This app requires Homey Pro.

Here I use transitions to gradually change from low dimming to high. When the transition is done, I start one in reverse. I look at the dimming level of the light to see which way the transition should go:

This flow creates the transitions, but does not yet specify what to do when a step is reached. For that you need a flow to set the value from the transition in the dimming level of the light:

So now we need a flow to start this off on a long press of a button, and stop the transitions once the button is released. However, these flows will juggle the dim level up and down infinitely once started. So just to be sure, I also ad a timer that stops the juggling after a while if the button is not released or the release was not registered. This is also done using the Chronograph app, this time using a timer. The final flows needed:

A note to this tutorial: I purposely did not use the current dim level as a starting point for the transition. It can be done, but it will require math to calculate the right transitions, which I felt was too complicated for this tutorial. If the light supports stepwise changing of the dim level, that can be implemented easier using that, but as I also wanted to demonstrate the use of the transition value, so I created the flows as shown above.

Also note: if you set the transitions faster, Homey might decide to disable your flows because they fire too much. And because Homey isn’t precise with its timings, the chances are the dimming changes a lot after you let go of the button.

5 Likes

…and if you don’t like, or don’t have, long press you can also create a flow that starts the dimming on the first press, and stops on the second press of a button:

1 Like

You could also use the “set relative dimming” card from e.g. Fibaro. Skips the use of an extra app like Transitions

Yes, I mentioned this, but thanks for elaborating because I wasn’t really clear about it. Unfortunately not all lights support this, and this was also intended as a transitions tutorial. Quite usefull, and not always properly understood.

Basically, the Fibaro have commands to start a dim transition, and it also has a command to stop it. You can put those in place of the transitions in the above tutorial. But for one button dimming you will also need to detect when end of the range was reached.

The Set relative dimming only does one step AFAIK, so you can use that for e.g. a 10% increase per click.

True, but I restart the flow for as long as the button is pressed and kill the flow when long button pressed is stopped. Same outcome I suppose :-). Works like a charm here! (with LIFX lights)

Still: good tutorial for when there’s no relative dimming available!

1 Like

If the dimming speed is not to your liking you could still use transitions for more control. I guess you do this using the dimming increment, but you are reliant on the speed that Homey executes your flows. You could use transitions as a pulse generator and ignore the transition value. But indeed, restarting the flow does the job just fine.

1 Like

As I see, I can still learn a lot how to build pro flows.

But both ways only work if the switch supports the “released” function, right?

Yep, but normally if the button/switch has a “long pressed” card then it should also have a “long pressed stop” card.

No, e.g. the Walli Switch:
1x (pressed)
2x (pressed)
3x (pressed)
Hold

EDIT

According manual:

Bildschirmfoto 2021-08-02 um 12.54.09

So I don’t know if it’s possible.

This is a single click solution - first click starts, second click stops. Any other way that can be executed quickly can act as a stop command.

You can have variations on this approach too. e.g. long press starts dimming, short press checks for a running transition and chooses between stopping the transition or do on/off.

What are the options when you create a flow? WHEN button pressed … (probably with scenes)

As I mentioned above:

Strange. According to the manual it should have the release functionality:

Perform following actions on one of the buttons to:

  • 3xClick – start learn mode to add/remove to/from Z-Wave network,
  • 1,2,3xClick/hold/release – activate scene in the controller for specific action (requires configuration using parameters 40 and 41),
  • 3xClick then press and hold – enter the menu.

Perhaps ask support@athom.com on how to configure this for the Walli?

I know, maybe it’s just a translation issue, but I don’t know and I didn’t tried it yet.

You don’t really want to know how many requests because of missing features and bugs for several different devices Athom already received. I am getting tired of writing to Athom because in most cases nothing happens… :disappointed:

I’m having a good experience with support for Fibaro devices so maybe give it a try! :slight_smile:
But we’re wandering off topic now…

@DidierVU try to follow your idea.
what is image
good for?

And i guess you need an extra flow whichs fires “badkmmer dimmen” wenn button is pressed and holded?

This is just to be sure the status of the Switch is correct, when you press the button the status goes on or off. So when you press the button to dim it does the same, and since you dim the light when it’s already on the status would be off.

What do you mean? This is just “when button is long pressed” THEN “start flow dim”

Thanks a lot. at the end it worked, but not perfectly, very often received Z-Wave queue Full…

But taking your logiv with the variable i found another way which works better in my situation

and

“Stop dim level change” isn’t available in most devices unfortunately :slight_smile: .
But it looks like you use all Fibaro devices? You could use associations for this then, works even better and faster!

@DidierVU : THanks for the hint. Can i use assoziations in parallel to homey?