Trying to setup a dashboard button that only works if HELD for 2 seconds (Panic button for alarm)

I guess the title explains it. I want a panic button on our alarm (which is entirely based in Hubitat). I created one and it works, but it's too easy to accidentally tap. Is there any way to set this up so that the button must be held for a set time before it triggers? I already tried creating the button on the dashboard, and it gives you the option to specify the command that it sends, but I don't think the dashboard is advanced enough to detect time held.....

I don't think it can tell how long it is pressed. Would something like two presses in quick succession work?

With a couple of rules you could probably make that work. If the button is pressed, increment a variable. Have a 'panic' rule triggered when the variable changes that checks if it is above one, and if it is, run your actions. Have another rule reset the variable to zero five seconds after it changes. This way if you press the button two or more times within five seconds it would trigger your 'panic' automation.

That might be a work around.

1 Like

I was thinking about doing this as plan B (hold is preferable since our ring keypad panic buttons work this way). Thank you for the rule breakdown - that does help me get it done faster!

A couple of other options...

There is a trigger for "button held," I just don't know how long "held" is and my search skills have failed me. It appears to be configurable for some device drivers but not the virtual button. It may default to 1 second.

You could also have a trigger on button pressed that sets a boolean to true and another one on button released that sets the boolean to false. Another trigger could check for the boolean turning true and staying true for 2 seconds...

1 Like

I had tried the 'button held' trigger without any success (maybe my fault?)

I will try the boolean idea! Thanks for all of this legwork you've done!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.