Homey Community Forum

One button to activate different flow

Hi,

I have a SmartButton from Phillips hue. Each time I press it, it increase a variable X (with better logic).

I have several flows wich start when X is equal to a certain number. With that way I can activate an unlimited number of scene.

But…

If I want to activate the 3rd flow, it will first active the 1 then 2 then 3.

I want to press X time on the button and activate only the Xth flow.
How can I do that ?

Is there a way to wait 2s before checking the value ?

Thanks for your help.

Use a timer.

At the first push of the button you start the timer, when the timer is emty u start a flow and check the velue of the variable

I’m not sur to understand.

Flow 1 : button pressed, then start a timer
Flow 2 : When the timer is over Then “check the variable” ? How do check the value to start a specific flow ?

My english is not very good but i try to explane.

FLOW1:

IF
Button is pressed
THEN
Start a timer of X seconds
Presses counter +1

So, when u pressed the button the timer wil start and de couter increse with +1. If u press the button within two seconds the timer start again and te counter increase again with +1

Then FLOW 2 (one push)

IF
Timer is emty
AND
Value of counter is 1

THEN
Do the one push thing

FLOW 3 (2 pushes)
IF
Timer is emty

AND
value is 2
THEN
do the 2 pushes ting u want…

Small improvement: the explained flow will trigger the timer every time its pressed.
Tip: split the counter and the timer in 2 flows. Disable the flowmtriggering the timer after the 1st press and enable it when the counter is finished.

Small improvement2: dont know how many flows you have. But if you have ten, you always need to wait ~10 seconds for the flow to run
Tip: keep the timer at a low number and reset it every time the button is pushed

Small improvement 3:
Get another button!
Now who wants to wait 10 seconds (minimum, if it works at all) to start a flow?

2 Likes

Awesome, thank you a lot for all your advice. I only have 3 flow for now so I will not wait 10s ^^

Thanks !

You only have to wait 2 seconds after the last push…

And if u have 10 flows, like @FKey mentioned, and add the time u have to push the button u will count 12 seconds! How fast is the button anyway @Noctoyo ? Can u push 3 times within a second to increase the variable with 3?

At first I couldn’t believe it either and had been working on another solution, but @Jan_Willem_Visser is right. His flow works flawless and you only have to wait 2 seconds (with a timer of 2 seconds) after the last push.
However, it must be mentioned that the card for the timer must be a “start or replace” card. This card is available in the Chronograph app. Whether other timer apps have these options as well, I don’t know.

2 Likes

Every time u push the button the timer start again with only 2 seconds… When the timer is emty al the flows triggert at the same time but only the flow where the AND part is true whil be executed.

I heave no idea how fast te button wil be… And heave also no idea if homey kan handel u push every second or so…

It’s possible with 1 sec timer.

These are the flows:

In the 2. Flow the summary of the pushes will be set into another variable, just to show that it works.

Push

First I reset the variables with a third flow. Then I pushed the button (Philips Smart Button) 7 times. Every time within 1 sec. After the 7. push I don’t pushed anymore.
When the timer Push2 is expired, the value of the variable TV_Count will set into the variable TV_Execute.

That’s it. Very simple but effective, thx @Jan_Willem_Visser. :+1:t3:

5 Likes

I noticed that the button is not super fast. I don’t know how it really works. I created flows as you say but sometimes it works, sometimes I think I press the button too fast. It is not very stable.

I will try with chronograph.

1 Like

Thank you, it really helps.

But now I realised that the smartbutton from philips hue kinda suc**. I have to wait 1s (or more sometime) before it increases the variable.

As you can see in the video it works flawless with the Philips Hue SmartButton.

How is your SB paired with Homey? With the Hue Bridge or directly with the Philips Hue, without the bridge app? Mine SB is paired without the Hue bridge.
With the Hue bridge I guess there will be definitely a delay.

BTW, the solution of your question is from @Jan_Willem_Visser not from me… :wink:

Yes, My smartbutton is paired with the Hue Bridge.
I’ll try without it.