Homey Community Forum

Easiest flow for button held dim

I have a button that have 3 triggers.
Button pressed, button held and button released.
I want to create a flow that will dim my light with 10% intervals as long as the button is pressed and stop dimming when I release the button.
What’s the easiest way of doing this?

1 Like

Hi @Kjettern

I don’t think this is (very easily) possible.

Your button will probably only send one signal after x seconds that the button was ‘held’.
I think it is highly unlikely that the button will send a continuous signal while holding the button.

Off course it will also send a signal ‘button released’.

If you are able to correctly count the seconds between ‘button held’ and ‘button released’ you might be able to figure out how to dim the light accordingly, but in my (at this moment, still) really limited knowledge about Homey Flows, you need to create a logic flow that adds a value every second to a logic value. Then use that value to calculate the dim factor. And let those flows run in a loop continuously until the ‘button released’ has been received.

All in all, this could be quite a thing to build, but nice if you achieve this.

Let me know if you where able to do it. :wink:

For the button held, use a dim over x duration card if the bulb supports it or use the transitions app to dim.
On button release flow, Use the global tag of that bulb’s dim level and set that dim level on that bulb as the action?

Transitions app

I saw such a flow a couple of month ago, but can’t find it back.

My Fibaro dimmer have a card function that is called “start brightness transition” and “stop brightness transition”
you can then choose between up or down and the transition time

But my Ikea bulbs do not have this function,

I think that this may depend on whether this function is supported by the device or app

You figured this out? I am having trouble with this too.

Well I haven’t tried it yet, but I figured out something else. Maybe I’m deciding to go with button held for light on / off and then button pushed for dimming. You can create a flow that will dim your light 20% every time you press down until its only 20% left. The same with button up, 20% increase until its 100%.

Flow will be something like: If button pressed, and variable xxx isn’t 100, then increase variable xxx 20. Same for decrease except with and variable xxx not 20.

That’s actually how I have it now, as I could not figure the real dimming flow out for hold out. I just have two buttons instead, so it was really easy to do it that way, because I did not need conditions for what way it dims :slight_smile:

I have actually been working on this for a bit of late, so maybe what I have done can be of use for you.

I am using a Xiaomi button that has the long-press function and an IKEA Tradfri bulb, I am also using the transitions app that @viix suggested.

On long-press, I check what the DimUP boolean is saying (true = dim UP), if it is true I start a transition from the current dimlevel of the bulb to 1 in 5 seconds with 0.5s steps. If it is false, I go to 0.
At the same time I tell the bulb to start dimming to 100% (or 0%) in 5 seconds as well.

This only dims to full or off, so to stop the dimming something needs to happen when the button is released. Which is my next flow; I stop the transition and toggle the up/down so next time I dim the other way. (Forget the paper trail card, I need to tak ethat out still)

Now for the actual setting of the final dim-level, I created a third flow that takes the value that is in the transition and set it as the dim-level, only this time I dim to that immediately;

Initially, I had another flow to change the dim-level immediately every time the transition value changed but that meant that the dimming level would “jump” to the next value which I didn’t like; this way it is a lot smoother and there is only a small “jump” when you release the button.

Hope that helps,

Hi @Matthieu_Oostveen, like @Kjettern this is also something i am looking to do and your setup looks promissing and capble to do with my setup (Remotec Scene master & Hue lights).

However your explantion is still a bit too complicated for me. I fully understand the idea, but do not understand all steps you did, so is it maybe possible to break it down a bit more?

Hi @Matthieu_Oostveen i tried to copy your screenshots.
Something is happening indeed, but it is not flawless unfortuately.

Hi @Rob_Verboven,

Flawless is always a challenge so in these cases I try to aim for acceptable instead :slight_smile:

So what do you have now and what is still missing, maybe we can figure out how to make it a little better for you?