"Better Double Tap" -- A version that works

Let me begin this post by saying you should first check out my “Off as Toggle” app here:

If it suits your needs, “Off as Toggle” is superior in every possible way to “Better Double Tap” because it is 100% reliable. That said, there might be people that still want to try this, so here we go.

I found the built-in Double Tap app to be inadequate, it just didn’t work well for me. I did some debugging and found three problems:

  1. The original developer hard-coded a 4 second window during which the taps must occur. That sounds generous, but, given cloud processing, it’s not. It’s almost impossible to get it to work.

  2. Related to #1, fast double taps will flat-out not get sent to the cloud. If you double tap in the way you’d expect (< 1 second), only a single tap event will ever make it to the ST site. As a result, you are forced to wait between taps (for a solid 2 seconds, in my testing) which results in the 4 second window in #1 being totally inadequate

  3. The default Zwave Dimmer device type suppresses redundant switch events, so it flat-out can’t work if you use that device type. You need to customize it by setting the variable “canBeCurrentState” to true in the device type. I will post my custom device type below.

So, how is “Better Double Tap” better? Well, all I did was add the ability for the user to select a “window” (in seconds) during which the presses will be registered to trigger your event. Due to cloud processing, this window should be BIG, I’d recommend 20 seconds or more. Unfortunately, I can’t do anything about the fact that you still need to wait between presses. So, make a big window like 20+ seconds, and then “double tap” by doing the following: Tap, count 2 Mississippi, Tap again – then it should work. It’s unwieldy and annoying IMO, especially if it doesn’t work because you accidentally pressed too fast, hence why I recommend using “Off as Toggle” instead. Nevertheless, I present to you, “Better Double Tap” (all credit to the ST developer, I hardly did anything to the code other than the custom window and a bunch of debugging/documentation)

https://github.com/pranalli/SmartThingsPublic/blob/dev/smartapps/pranalli/better-double-tap.src/better-double-tap.groovy

And here’s the custom dimmer device type that will work with it:

https://github.com/pranalli/SmartThingsPublic/blob/dev/devicetypes/pranalli/dimmer-switch-always-report-events.src/dimmer-switch-always-report-events.groovy

2 Likes

Strange, ST has their own Double Tap app… I submitted a support ticket and their fix was a link to this code?

Guess I’ll give it a shot since theirs is aweful… with Hub V2 Local Processing wouldn’t you think they would white list this app to eliminate any network delays…

1 Like

After reading the full description, I think I’ll pass. Upping the response time to from 4 to 20 secs really makes to me, I’m not going to wait up to 20 seconds for a response from ST cloud. My experience is a one-two count (slow but firm) works best for me. Thats saying “1 and 2”, one (press) and (release) two (press), if no response then simply do “and 3”. Usually 95% on 2 and the final 5% on 3.

Would be nice to have a dimmer work, but not at the cost of a custom driver, custom driver = not local on V2 Hub, thus no local processing and then a loss of other characteristics of other ooerations of the dimmer.

As for double off, not sure I’d like to be in a room with a light on, only to have to turn it off then back on to toggle another device, prefer the 3 count above for the low percentage of failures.

I seem to only have major failures when STs backbone is having issues, although this has been almost everyday this month, I’m ok with the 95% on most days.

Support did say they are working on their DT app, so can only hope its high on their list. I think thier best fix is to make this a local app on the V2 Hub, this function requires timing, thus must be done locally and not in the ST cloud.

I think you misunderstood the documentation. The window that you set is not for a response from the ST cloud, it is the window in which two presses can occur and be registered as a “double tap”. The ST cloud is slow, so the 4 second window of the default Double Tap app is inadequate. A 20ish second window gives a big enough buffer that it will at least work. The way you described your taps (1, pause, 2) should work perfectly.

The actual amount of time for the ST cloud to respond varies, but it should generally be within a few seconds.

Wouldnt opening the time between presses also add to compte turnaround time? If I setup the window to 20 seconds and press a button, why would I want to stand around and delay the request for a double tap up to 20 secs (wether it is me pressing with long delays or st is slow to complete the processing).

Etherway you put it, giving the user more time to actually press twice or st to process, what user is going to stand around and wait up to 20 secs for a result. If I double tap to turn a light on in the next room, I’m not going to just walk into the dark room or whatever the task was until the requested action occurs. I must be really not understanding it.

With 1-2-3 count, or just pressing till it works, seems faster than 2 press and wait up tp 20 secs for st to process.

Again, the fix is local hub processing (Hub V2), just need ST to enable it. Response time would probably be micro secs then.

Anyone using this or the double off code seeing improvement in the end result?

Hey @jimmay3

I’m going to be as respectful but assertive as I can here. You don’t seem to have a grasp of what is going on and how these things work – which is totally fine – except that you are making things up instead of just asking. I will address as best as I can.

No. They are two totally different things.

I don’t know why you keep writing that, it is not accurate at all. The 20 second window isn’t there to force you to sit there for 20 seconds, it is there to allow for lag time from the ST cloud so that your presses WORK instead of NOT WORKING. The original Double Tap app only has a 4 second window which was often missed even if you pushed the buttons fast enough. In other words, it accounts for HIDDEN lag time behind the scenes that you may not be aware of as a user.

In other words, you might do you two presses in 2 seconds but they may get registered, say, 6 seconds apart. The old app would then ignore it and never work, but this one will work.

Again, this isn’t how it works. I named this app “Better Double Tap” for a reason: because it ENHANCES the original app and takes nothing away. This version is identical except that it works more reliably.

That may help marginally, but not significantly. The bigger issue, IMO, isn’t just the cloud: it’s also that events get clobbered when the switch is pressed too fast. Local processing can’t fix that. I can code around “slow” response times, but I can’t code around events that never get reported.

HTH

2 Likes

Thanks for your time.

I noticed the Github code has been removed (I got a 404). Thanks for putting this together. Can you point me in the direction of the latest code?

@pranalli, is this code still available? I also got a 404. Would love it if so. Thanks!

Did this time change fix the rouge nature of the switch turning on and off randomly?

I haven’t been keeping up with the platform because I got really discouraged by the weaknesses of the cloud. What time change are you referring to?

This app was replaced by a better one called Double Duty, please go here to get it:

Keep in mind that the ST platform, unfortunately, makes apps like this inherently unreliable in a way that is impossible for developers to compensate for. But you’ll see the discussion regarding that in that thread.

Hello All, with some effort in last few days, I made my own version for double tap to toggle another light. It works for me like a charm. I am glad to share with every one here and hope you enjoy it. Please let me know if there are any issues.

1 Like

Couldn’t add your code to Smartthings. Gave me an error about syntax or missing }

Sorry, I was syncing with my linux client and got it messed up. I reverted
it to a good version already. Please try again.

Mike, what’s different about your code vs the others? Does it work with GE dimmers?

I don’t have GE dimmers. It should work better in event handling. No need to search back into the event log.

Hi Mike,

Complete newcomer to smartthings and I’m not getting this to work and may be missing some steps…
Created a smartapp with your code, published it, and added it from the mobile app under my apps. I configured the master switch (GE dimmer) and tried various other switches and outlets as slaves. Doubletapping has no effect on the slaves.

Please let me know if I missed something.

Thanks!

Some tips are:

When your master switch is on, tap the upper side of the switch (on
position) twice, otherwise, tap the down side of the switch (off position)
twice. And you should not tap too fast, probably 1 second in between the
taps. Or you feel you fully released the first tap before you tap next.
Good luck.

Btw, I don’t have dimmer switch to test with so I can’t guarantee it works
with it. Anyway, I’ll try to get one and tune it later.

1 Like

will this work with leviton switches/dimmers? DZMX1 and DZS15