BKM for detecting multi-press sequence on a switch?

Does anyone have a good method to detect a multi-press sequence on a switch (to trigger an action)?

I have certain family members that don't run bath fan long enough to purge water vapor, and/or unpleasant odors. I have an aeotec nano sitting behind a mechanical timer fan switch, and have a webcore rule to turn fan back on if physical switch turns off before certain duration, as well as some logic for other purposes to turn on when HVAC ventilator is running, and to turn off after a maximum time.

There are times I would like to override the setting to force off, and would like to use a special off-on-off sequence or something like that on physical switch to override and force off. I can think of a couple ways to do it with variables and functions that reset them after certain time, but seems like I am making it more complicated than it needs to be.

Has anyone found an elegant solution to do something similar?

1 Like

@erktrek did something that sounds similar to your request. Unfortunately, he (& I) use Node Red for automations but it might be able to be translated to RM.

Here is an example where he helped me with similar:

1 Like

Thank you, Stephen.

Guts of what I need seem to be in "timed counter" code linked on github, which I cannot figure out. Based on the description I think it's doing what I had in mind:

  1. detect first switch trigger and set a timer variable on with a delayed off after certain time
  2. use triggers to accumulate on/off events in a variable a long as timer on
  3. trigger action when timer goes off based on number in variable, and reset to 0.

Maybe it is the easiest way to do it, but still seems like there should be a simpler way.

Giving up on this. Not getting z-wave off/on fast enough in hubitat to make this useful. Not sure if nanoswitch, hubitat or z-wave speed is limiting, but seems to be limited to 7-10 seconds per event.

Thanks anyway for the help.

1 Like

Over the past few weeks, I've been giving your "Switch Sequence" challenge some thought, and came up with this approach, which seems to work as intended. Namely, you turn the switch ON-OFF-ON at a leisurely pace (up to 10 seconds between steps), and when that happens, RM will perform the desired reaction (in this case, simply setting a local variable to true):

Note that I was able within 2.5s to complete the ON-OFF-ON sequence using an in-wall toggle switch, so the 10s allowance in my test rule is on the generous side:

If hardware/propagation limitations render this solution infeasible for your setup, so be it. I just wanted to share with you this working proof-of-concept. It could be extended/modified to allow for even more complex sequences, even involving more than one switch! :slight_smile:

1 Like

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