Homey Community Forum

Easiest flow for button held dim

#1

Hello.
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?
Thanks

0 Likes

#2

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:

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#7

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.

0 Likes

#8

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:

0 Likes

#9

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,
Matthieu

0 Likes