Looking for best approach to handing flipping switch several times to control light

I bought some modules that go inside your switch box that are zigbee control....so you can use the light switch OR control via hubitat. I automatically turn off the bathroom light if its been on for 20 mins.
The issue is that the light switch may be in the UP position when its turned off.
I want to come up with a webcore or some code,etc that would be able to detect when I flip the switch several times
For example the switch is
starting Up - off
flip down - goes on
flip up - goes off
flip down - goes on (but I want it to detect the 3 flips and turn off

Same for
starting Down - on
flip up - off
flip down - on
flip up - off (but detect the flips and go on).
Anyone have a good approach to this ?

You know you can replace the switch with a momentary and the modules have that option?


I hate having the wall switch in the 'wrong' position too.. but my solution was WAY over the top. I changed out everything to be Legrand Adorne Push switches. They are only 5x more than those momentary :smiley:

1 Like

Thanks for the idea... love the idea if it would work...and was inexpensive : ) I paid 3.50 for the zigbee module : )

  1. is the switch you provided, momentary ? I could not see anywhere it said momentary

  2. The item I bought 16a Zigbee 3.0 Diy Mini Switch For Tuya Smart Life Timing Wireless Control Relay Automation Work With Alexa Google Home Alice - Automation Modules - AliExpress
    does not seem to handle momentary ( I don't think).....I tried flipping the switch quick to simulate momentary and it didnt seem to work...but I wasn't 100 sure... do you know whether they handle momentary ?
    Thanks for the ideas !!

I think Google failed me.. I was offered wide selection after searching for "momentary wall switch" and then picked the cheap one.

Here's one with momentary in the title:

The module I'm using is a Qubino dual relay... same basic size, to fit inside and behind regular switches. The Driver has options for the type of switch connection:

Screen Shot 2022-07-12 at 5.07.35 PM

I don't have the module you have and I don't really know what Driver would be used. But that's where the secret sauce is found. :smiley: The Driver implements the features of the device.

nice solution....so given the modules I have I don't think i have the same options.... I am curious ..what does a qubino module cost... i could only find things in the $50-$60 price range...but I'm probably not looking in the right location

There are quite a few people that use Tuya around here. Maybe they haven't used that particular module either.

For other types of internal dual relays:

nice compilation of info on solutions that fit in the box.... I know from looking at some boxes w 4 switches it is VERY tight!

@tim.ocallag post the switch module model and manufacturer from the device web page β€˜data’ section.

  • endpointId: 01
  • application: 46
  • softwareBuild:
  • inClusters: 0003,0004,0005,0006,0702,0B04,E000,E001,0000
  • outClusters: 0019,000A
  • model: TS0001
  • manufacturer: _TZ3000_mx3vgyea
1 Like

A quick search shows that this switch should have the capability to be configured to work in 3 different modes - 'toggle', 'state', 'momentary'.

I will try to add this configuration in one of the Tuya drivers in the next few days.

OMG, you ROCK!!!
That is amazing....so i should be able to use a momentary switch ...i can't believe it
I'm close on a webcore piston that "might" do what I want but the momentary would be really cool...

Let's first see if the switch mode configuration will work, with these Tuya devices you never know.
This module fingerprint shows inClusters (0702, 0B04) that are typically used for energy monitoring, I don't believe this $3.50 device may have a precise current measurement shunt resistor inside.


@tim.ocallag please try the development branch link here : Zemismart Zigbee 1/2/3/4 gang light switches - #36 by kkossev


I've tested it with a similar switch ( Tuya Smart ZigBee Switch Kinetic Self Powered Wireless Switch (no battery) ) and it works OK for my device. Can't see a difference between 'toggle' and 'state', but 'momentary' works just fine.

1 Like

i dont see the switch type option ?

arg sorry...i dont know how but i had they prior version....i updated to the latest and i see the switch type....however I select it but cannot save it

before save

after save

1 Like

well ..got home and while i dont have a momentary switch i used the regular switch and emulated the momentary switch and it IS definitely working as momentary !!! Thanks !!
so although the panel doesnt reflect that it is momentary.

I tried switching to original mode (tried state or toggle)...same as before it doesnt reflect on the screen ...but it is still operating in momentary mode....cant get back to orig mode... not a huge deal but it will be confusing till i get a momentary switch

1 Like

This is a quick-and-dirty implementation of the switch type configuration - not as a preference (that you can save), but as a custom Command to HE. Unfortunately, in HE drivers it is not possible to select a Command default parameter other than the first one, hence the first from the list is always '--- Select ---' . You must select one of the 3 possible values from the drop-down menu and then pres the 'switchType' button above, No way to save the last selection, it will go back to ''--- Select ---".

You must examine the device Logs page. When changing the switch type, you should see Info logs like this:

[dev:2917]( 21:54:57.213 [info]( TS0001 _TZ3000_npzfdcof Switch Type is: momentary state
[dev:2917]( 21:41:09.551 [info]( TS0001 _TZ3000_npzfdcof Switch Type is: toggle

These may be buried into lots of other debug logs, so you may want to switch the Debug option off .

These logs are printed only when the device actually confirms the mode change. Please try again changing the switch mode and let me know if you see the confirmation messages in the logs page.

This is something that we must fix, if there is actually a problem.

YES! You are correct ...I confirmed that clicking the set switch DOES set it correctly and I could pick any of the options. After setting back to state or toggle (cant tell difference) I was able to verify my webcore piston that allows me to change the state of the light by flipping 3 times.
I could leave it like that but the momentary is way cooler.
In keeping with challenging myself to make this as cheap as possible, I found a momentary switch and 3d printed the button...this will replace my normal toggle switch (not paddle)
I can't thank you enough for making momentary work. So for around $5-$6 total this does what the Zooz switches do, that I paid $35 for. Note the switch inputs to the $3.50 module are low voltage.

1 Like

I redesigned the pushbutton to use a 50 cent switch and came up with

but in the end my wife didn't like the pushbutton so I came up with a momentary toggle switch that used 2 of the 50 cent switches.

If anyone is interested, I'm happy to share the onshape files or stl files.

1 Like