Device Handler for Aqara Wired Wall Switch

Hello @aonghusmor

I’ve updated the DHT with your latest release and first of all I noticed the new more friendly user interface which it’s great.After that I’ve noticed that there are some good improvement in terms of quickness of the unwired button.
The only problem that I’ve encountered was the fact that on some switches the right switch (always the wired one) sometimes enters in an ON-OFF loop. When I set it OFF it comes again ON and OFF and so on…After this problem I’ve decided to go back to the old DHT :smiley: It suits me better for now.

About the temperature, after setting the offset on each device, on some it’s showing the “real” temperature and on some devices it’s always showing the “wrong” temperature.

Thank you for your work,

Thanks for the feedback. Can you tell me whether the on-off looping happens when you use it as a hard or a soft switch, i.e. when the actual button is pressed or when it is done by software. If it’s intermittant it’s probably a timing issue. I’ll try to reproduce it.


It happens Both ways, it starts with hardware push then it does the same thing on soft push.


@aonghusmor Hi, I’m about to buy some Aqara wall switches. Thanks for your good dth for it with the holding and releasing functions.
But, I thought your DTH is for without-neutral version switches. Is it possible to apply this into the with-neutral version switches with just changing the model number in your dth? I just want to use releasing and holding button but it’s hard to find any DTH for the with-neutral aqara switch.

Hi! I see no reason why this shouldn’t work unless there is a significant difference between the firmware on the no neutral and with neutral versions. I have no way of testing this.

There are some differences.

See post number 45 in the thread above.

If that’s the only difference it shouldn’t be difficult to tweak my code to work for both. I’ll try to find time to look at it
Just to clarify: you say that the command that goes to endpoint 3 on the no neutral switch goes to endpoint 1 on the with neutral one. That means 1 and 2 refer to the right and left switches respectively? Is that correct?
I assume that also applies to the messages received from the switches, 1 and 2 refer to right and left (instead of 3 and 2).
What about the message received on endpoints 4 and 5?

I have no more info beyond that.

But my friend bought and installed the version with neutral wire required and I had to modify my code in that way to make it work for his installation.

I’m current don’t have any Aqara switches in my house to do verification tests either.

I never had looked at the returned messages as in prior versions of hub firmware, the catchall messages were filtered.

Unfortunately, this means that I haven’t, so far, been able to obtain the information needed to modify my DH for the with neutral switch. If you find it please let me know.

I haven’t been able to reproduce this condition, but I did find an error which affects the left hand switch only and might be the cause. I’ve now posted a corrected version.

Hi @aonghusmor

I will test it as soon as I can and I will return with a feedback.


Hi @aonghusmor

I’ve tested your new DHT, now it works good (the ON/OFF loop it’s solved), but encountered another problem.The DHT works just fine for the Smartthings Classic App, but it does not work with the new Connect App;pressing the ON button does nothing, it spins and goes back to OFF.

Once again made rollback to the old stable one :smiley:
Sorry for making you only trouble :))

Thank you,


I’m afraid I haven’t been invited to use the new App yet. A few months ago I tried using both apps in parallel, but it caused chaos, which I had to get Samsung to sort out for me. I suspect part of the reason for that is the fact that I have written a couple of my own device drivers. So I have to wait until Samsung gives me he go ahead.





Thanks @aonghusmor - your DHT is working nicely with my QBKG03LM (Aquara Wired Wall Switch Dual Button no neutral) on the SmartThings Classic app.

I have both buttons wired to the mains and initially had trouble binding the individual buttons to virtual switches so that I could use them with routines and Alexa. I tried both the Kudled and Advancrd Button Controller SmartApps wiothout any luck (probably user error) but eventually got it working with the Virtual Device Sync SmartApp thanks to @erocm1231 that comes with it’s own “Simulated Device” Device Handler:

Thanks to you (and other contributors) for the effort :clap:

1 Like

That is what I would expect. Perhaps I should write some notes on that. There’s a difference between a switch and a button, whether it has an on/off state. When a switch is hard wired, it has such an on/off state and I agree that @erocm1231 's app works well. When a switch is not hard-wired it is easier to use it as a button, as otherwise there are issues about keeping it in sync with the state of the lamp. Then ABC is more useful.

@aonghusmor I just updated my DTH to your latest version and now my single-gang no neutral switches stopped functioning correctly, these are the following behaviours:

  • If I try to toggle the switch in the ST Classic app, it works. But the switch always appears unresponsive in Alexa. Also ST Classic shows the switch has 2 buttons now?
  • If I create a Virtual Switch using Virtual Device Creator and map it to my actual switch using Aqara Wall Switch Binder 1.1, the Virtual Switch does not toggle the actual switch when pressed. Alexa detects the Virtual Switch and toggles it, but the actual switch never gets toggled.
  • These issues are not present in the two-gang switches, although for the two-gang switches that problem where sometimes the switch gets stuck in an infinite loop of turning on and off endlessly (can only be resolved by removing the device and re-adding it to ST) is back.

It’s not the switch, both my single-gang ones have the same issue after updating. Any idea what’s causing it?

My DTH was never designed for the single gang switch, only for the double gang one. I haven’t got a single gang switch at the moment, so I’m not in a position to clarify this.
I redesigned the app’s interface to give the 2 switches equal weight.
See the previous comment by @daveymonkey. The @erocm1231 app seems to work. It is designed to get round a deficiency in the smartthings API, when dealing with devices which have more than one endpoint, i.e. switch.
I’ve just tried to use the switch with Alexa. It works fine using the virtual switches created by @erocm1231’s app. I did notice that I had several duplicate versions of these switches on the Alexa app, which I had to delete before I could get it to work properly.

Ah, I started out with @simic’s DTH way back which seemed to work with both single and double gang so I just assumed both can run off the same DTH. Anyway, I rolled back to your previous update which worked for single gang switches, probably gonna leave it at that for my single gang ones.

I’ll try using Virtual Device Sync to see if it can solve the random on/off loop issue. Thanks!

I’m slightly puzzled as the last message from @Sterian_Vlad suggested that the loop issue had been solved in may last update.

Maybe he did rollback to the DHT where the on/off loop was present :smiley: