Homey Community Forum

Easiest flow for button held dim

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

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

2 Likes

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?

Cheers,
Matthieu

@Matthieu_Oostveen

I’m trying to duplicate what you suggest but can’t get it working. I have it set up and dimming down and then letting go works and it stops as expected, but going in the oposite direction it always goes to 100% regardless of when I let go of the button.

My flows:
LongPress
When
Button1 scene activated Held down
And
DimVariable = Yes
Then
Start transition name DHU (CurrentDimLevel-100,5s,0.5s)
Lamp1 Dim to 100% during 5s
Else
Start transition name DHD (CurrentDimLevel-0,5s,0.5s)
Lamp1 Dim to 0% during 5s

Release
When
Button1 scene activated Released
Then
Stop Transition DHD
Stop Transition DHU
Flip DimVariable

TransitionDownStopped
When
Transition DHD stopped
Then
Dim Lamp1 to value

TransitionUpStopped
When
Transition DHU stopped
Then
Dim Lamp1 to value

Is this something you have experienced? Are my flows identical to yours?

1 Like

Hello @LogicalShrapnel

I have not worked on this for a long time, so not sure it all still works actually :slight_smile:

However looking at your flows, there is one difference which seems to be significant;

Here I have “CurrentDimLevel - 1”.

Cheers,
Matthieu

1 Like

Thanks! I think I got confused by the apps suggestion of 0-100 instead of relying on the value form the lamp. It’s working perfectly now. Or at least as perfect as possible with the current limitations.

Btw, I threw together a quick flow to change the temperature on double click if you (or anyone else) is interested.

Create variable Color and set it to 0.3

When
Scene activated Pressed 2x
And
Color is exactly 0.9
Then
Lamp1 Set a temperature 0%
Set Color to 0.3
Else
Calculate color as {{color+0.3}}
Set a temperature Color after 1 sec

I needed the 1 sec for some strange reason. Otherwise it failed when setting it to 0.9

1 Like

@Matthieu_Oostveen it might be good to mention in your post that this flow will only work with a remote that supports the long press release event. This might save some of us some time. I have a IKEA Tradfri E1810 laying around. This model does not support the release event unfortunately. Making it impossible to implement this flow setup.

So this is not possible?

@Rocodamelshekima correct. See also IKEA Tradfri Remote E1810 button release events missing?

Ow. Was talking about scene master and screenie was just taken. Tested and working with the scene master.

1 Like

@Rocodamelshekima I stand corrected. I missed that this had to be configured through the “scene activated” event. I have edited my my earlier post

1 Like