Device Handler for Aqara 2 Gang Wired Wall Switch no Neutral

Good to hear that.

There’s a function getNumButtons() which now contains the device specific information. I should probably change that name at some point :slight_smile:

I made some other changes, which should only affect the 3 button switch, namely replacing various calls to getChildDevices() with a new function getChild()

1 Like

Just to avoid any misunderstanding, I’d expect most events to appear in the logs for the main switch (the left hand switch). The child devices are simply a trick to enable software switching of the other 2 switches. As far as physical presses of the 2nd & 3rd switch are concerned, I’d expect to see something in the logs for the left hand switch in the first instance. If that is correctly received and interpreted, it should then trigger a change in the state of the corresponding child device.

That means there are at least 2 possible interpretations of the absence of any change in the child device. Either the switch isn’t sending a message to the hub that it has been pressed, or that message is not being correctly interpreted. The former could be a problem with the switch, the latter a problem with my code.

You are right, there must be something wrong with the switch, the switch is not sending a message to the hub when physically press the button, therefore not state change is updated

I did several tests , result are quite clear, I could not see any events showed up while physically press the button

following events were only showed when virtually

Date Source Type Name Value User Displayed Text
2020-12-13 3:35:14.000 PM EST
moments ago DEVICE button pushed Aqara Switch QBKG25LM button is pushed
2020-12-13 3:35:11.000 PM EST
moments ago DEVICE button pushed Aqara Switch QBKG25LM button is pushed
2020-12-13 3:34:49.000 PM EST
moments ago DEVICE button pushed Aqara Switch QBKG25LM button is pushed
2020-12-13 3:27:15.000 PM EST
8 minutes ago DEVICE button pushed Aqara Switch QBKG25LM button is pushed
2020-12-13 3:27:15.000 PM EST
8 minutes ago DEVICE switch on Aqara Switch QBKG25LM switch is on
2020-12-13 3:27:15.000 PM EST
8 minutes ago DEVICE button pushed Aqara Switch QBKG25LM button is pushed

It might be worth removing the switch from smartthings, doing a hard reset and then trying to reconnect it. I think the hard reset is done by holding a switch for more than 6 seconds, but it may be different for the new switches. I’d expect that to be covered in the, admittedly very limited, instructions that come with the switch.

Thanks for the advise @aonghusmor

Actually every time,you updated the code, I will hard reset to update the D1 switch,
So far I did not see the physical press being logged in the state update for the switch, Thank you for your helpful support.

Happy Holidays!

just installed both QBKG21LM and QBKG22LM… the IDE works for QBKG22LM but not QBKG21LM. the device is paired and I can see it records the temperature in the history but when I tried to turn on or off, it will just keep spinning and then show ‘a network or server error occurred. try again later’

the device is still online and the last activity is updated constantly.

i tried deleting it and pair it again multiple times, the behaviour is still the same, any idea what went wrong?

I’ve had a QBKG21LM on order since early December and it hasn’t arrived yet, so I’m struggling here. Are you able to access the IDE and tell me what the logging says when you try to switch it on or off? Also does this happen when you physically switch it on/off, or from the app, or both?

I’ve just posted a slightly amended version, which should work, but there is still some guesswork involved in setting the device dependent details.

Hi aonghusmor,
I am having trouble with my WXKG07LM wireless double switch.
I cannot workout how to set it up so i can use both left and right buttons indepedently.
Do you have any advice?

Have you tried @bspranger’s device handler for the older switch WXKG02LM? I have one of those older switches which I use in conjunction with the Smart Lighting smartapp. The switch appears in the smartapp as a series of buttons, which you can then link to lamps, etc.

I still have the same problem. I Use the Bspranger DTH but the app gives my only the options:

While the live log says the following when I press the buttons:

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:31:19: info switch: Both buttons were held (Button 3 held)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:31:17: info switch: Right button was held (Button 2 held)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:31:14: info switch: Left button was held (Button 1 held)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:31:08: info switch: Right button was pushed (Button 2 pushed)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:31:03: info switch: Right button was double-clicked (Button 5 pushed)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:30:46: info switch: Left button was double-clicked (Button 4 pushed)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:30:38: info switch: Right button was pushed (Button 2 pushed)

40d5b46f-f09b-4640-a62b-f6facdce0ba4 12:30:35: info switch: Left button was pushed (Button 1 pushed)

Crossed lines here. Ignore what it says in the Device Handler. Smartthings has difficulties with double, triple,etc switches. That is a known issue. For that reason bspranger’s device handler translates each action on the switch into a press of a virtual button. That is what you are seeing in the live log. The device handler hasn’t really been updated for the new SmartThings App and the screenshot you posted is misleading.

In the smartthings mobile app, click the 3 lines top left, then SmartApps, then +, then Smart Lighting. The Smart Lighting SmartApp allows you to link any of the virtual Button events you listed with a particular action, such as switching on a lamp. So, for example, a simple push of the left switch will appear as Button 1 pressed,

1 Like

Thanks @aonghusmor for the quick and clear reply! Unfortunatly my ST-app doesn’t have the Smart Lightning SmartApp anymore :flushed: So I’ll send in a ticket because I can’t find a solution online for the missing Smartapp…

These are all the Smartapps I still have…

Smartlighting is now region locked, and multiple forum members in Scandinavian countries have reported they do not have it. :disappointed_relieved:

You can see if support will add it for you.


I’ve found online an older version off the ST classic app and installed it; with the classic app i could install Smart Lightning and in the new app it appeared! Thanks all!!

1 Like

I have just posted an extensively revised version of my DH, Aqara Wired Wall Switch. This should eliminate most of the glitches reported.
The new version has its own child DH, Aqara Wired Wall Switch Child, rather than using the smartthings own child switch. It will be necessary to update both the main DH and the child.

The wired/unwired state of each switch is set by a boolean, true/false, variable in the preferences of the main DH, for the left hand or only switch, and the corresponding child DH for the right or middle switches.

The virtual buttons are now associated with the main or child switches as appropriate, rather than all being associated with the main switch. This may require revision of the settings of any software, such as “Smart Lighting” which makes use of these buttons.

The firmware has a facility to change the behaviour of each switch to behave directly as a button. I have chosen not to use this, as it made it impossible to register double presses or press and hold.

As before the virtual buttons will be generated irrespective of whether the switch is wired or unwired. This will occur both when the hardware is switched on or off.

Further notes can be found on the README on GitHub.

1 Like

Thanks for all the hard work on this handler!

I purchased a single gang Aqara switch (no neutral). The model is lumi.switch.b1laus01

It’s connected to my hub, I’ve installed your handler, and set the device type to Aqara Wired Wall Switch No Neutral, but I’m not able to control it.

Any help would be really appreciated! @aonghusmor

Link to the code?

Parent :

1 Like

I’ll attempt to add this, when I’ve found the relevant information.