Device Handler for Aqara Wired Wall Switch

dth_lighting

(James Scholes) #82

:+1: I’m actually doing something similar in a couple of places, albeit with Lifx bulbs and arduino-based switches.

The issue is in the rooms with 6 or 8 GU10s for lighting (bathroom, kitchen, etc) where it’s not practical or cost effective to switch out all the lamps - I also have fairly stringent requirements on the beam width, and to my knowledge almost all smart GU10s are 36-40 degree spots, rather than the 90-110 degree floods I’ve got at the moment.

I’m not personally a fan of battery-powered switches, and I found the latency to be a bit high, but it’s certainly a valid alternative. Glad it works for you.


(Antony Pugh) #83

Totally worth it! I need to replace the bathroom with a pull down momentary and a fibaro or similar.

Its all motion but some idiot will want to still use it!


(Antony Pugh) #84

Totally. if I cant automate it Alexa manages it!


(Jeremiah Lim) #85

Any idea if this is the right thing guys? I’ve been trying for hours but can’t figure it out unfortunately

[{“simple”:“01 0104 000
rawDescription zbjoin: {“dni”:“029B”,“d”:“00158D00022B84F4”,“capabilities”:“84”,“endpoints”:[{“simple”:“01 0104 0006 02 06 0000 0003 0001 0002 0019 000A 03 0000 000A 0019”,“application”:“12”,“manufacturer”:“LUMI”,“model”:“lumi.ctrl_neutral1”},{“simple”:“02 0104 0100 02 04 0010 0006 0004 0005 00”,“application”:”",“manufacturer”:null,“model”:null},{“simple”:“03 0104 0100 02 04 0010 0006 0004 0005 00”,“application”:"",“manufacturer”:null,“model”:null},{“simple”:“04 0104 0000 02 02 0012 0006 00”,“application”:"",“manufacturer”:null,“model”:null}],“parent”:“0000”,“joinType”:1}


(Ty Fairclough) #86

I have two wall switches (1 single with neutral and 1 double with neutral). They both paired automatically through the discovery process.

The double switch will turn 1 light on through the app. The single switch is unresponsive.
I don’t understand how the virtual switch stuff works, they’re currently not installed.

A youtube walk-through would be awesome if someone would do the honours


(Jeremiah Lim) #87

Mine paired automatically too (single switch, no neutral), but as you say, doesn’t work.

Any thoughts on handler making it work (i.e. changing the discovered device to a custom handler)?


(Jeremiah Lim) #88

The issue is whenever I try either Simic or John Doyle’s DHs it says can’t connect to device on the smartthings app.


#89

I use John Doyle’s DHs , it work very well ( need some code modify for corresponding device, for 2 button version, only 1 output could control on/off in Apps )

I have two wall switches (1 single and 1 double, all with neutral).


(Jeremiah Lim) #90

Thanks for all your help, managed to get it to work.

For noobs like me who have never used Smartthings before, I’ve written below the steps I took to troubleshoot (basically a very very long version of what Simic wrote above).

  1. Buy Aqara Wallswitch (I got mine from link below) - make sure you get the relevant version with or without neutral line
  2. Install Aqara Wallswitch into correct socket
  3. Long press Aqara Wallswitch for 5 secs (until flashing lights at the bottom turn from red to blue) and search for devices in the Smartthings App
  4. Go to IDE (https://graph-eu01-euwest1.api.smartthings.com/), then My Hub > List Events. You should see Z-Wave include search started. One of 4 things could happen:
    i. Nothing happens and search ends - don’t be disheartened, happened to me many times too. Try again, bringing your Smartthings hub close to the switch helps.
    ii. Error Code appears - if this happens long press again until you get either (iii) or (iv). This looks something like: raw:0000000000000000000000, dni:0000, errorCode:00, ieee:0000000000000000
    iii. Device is detected and automatically registered - yay, skip to step (6). This looks like: [{“simple”:“01 0104 000
    rawDescription zbjoin: {“dni”:“029B”,“d”:“00158D00022B84F4”,“capabilities”:“84”,“endpoints”:[{“simple”:“01 0104 0006 02 06 0000 0003 0001 0002 0019 000A 03 0000 000A 0019”,“application”:“12”,“manufacturer”:“LUMI”,“model”:“lumi.ctrl_neutral1”},{“simple”:“02 0104 0100 02 04 0010 0006 0004 0005 00”,“application”:”",“manufacturer”:null,“model”:null},{“simple”:“03 0104 0100 02 04 0010 0006 0004 0005 00”,“application”:"",“manufacturer”:null,“model”:null},{“simple”:“04 0104 0000 02 02 0012 0006 00”,“application”:"",“manufacturer”:null,“model”:null}],“parent”:“0000”,“joinType”:1}
    iv. Catchall is detected - go to step (5). This looks like: Parsing ‘catchall: 0104 0000 01 01 0100 00 A8B2 00 04 115F 0A 01 01FF42296410016510006E20016F20000121E40C0328’
  5. Create device with the 7th set of numbers (A8B2 in example above) as the Network ID and Zigbee ID. The type doesnt matter now, you will change it in step (7)
  6. Create Device Handler - go to My Device Handlers under IDE, then create it from code using either Andy (Simic) or John Doyle’s code above. Save then publish.
  7. Change your newly created Device Type to your newly created Handler (should be at the bottom of the list of Type List)
  8. Create SmartApp using either Andy (Simic) or John Doyle’s code, note this is different from (6). Andy’s code link is here (KUDLED - UK 1/2/3 Gang Switch).
  9. Link newly created SmartApp to Device in Smartthings App

Really hope this helps! Weekend of pain has paid off!

https://m.lightinthebox.com/en/p/original-xiaomi-smart-home-aqara-smart-light-control-zigbee-wireless-key-switch-and-wall-switch-smarphone-app-remote-zigbee-version_p5714214.html?prm=1-2.5.1.1


(Andy Chan) #91

Congrats!

I’m glad that you have contributed to the body of knowledge!


#92

OK so I now have 1 double witch and two singles.

The issues with the double I have explained before; in that I can turn the lights on and off from the app but the app does not reflect the true status of the switch if physically pressed etc.

For the single switches I have the opposite issue, the device handler correctly shows the status of the switch when physically turned on and off, plus temperature etc …BUT the app never succeeds in turning the switch ON or OFF - it just pauses on ‘Turning ON’ (or off)

any ideas please ?


(Jeremiah Lim) #93

Had that issue with other handlers it could do with your internet connect (phone to hub or hub to switch) or the endpoint of your switch being a different number from the standard one in Simic’s code. I’ve linked another thread where some problem solving on this was done. Xiaomi Aqara Zigbee Switch DTH--help needed


#94

For the double
Does the right button can on/off not the left one ?
I am not sure your meaning of not reflect the true status, as previous post said, ST have mask something, so on/off status can’t show for 2 button individual ( in fact, on/off only a squre icon not in two ).

For the single
It is enpoint no. issue, just change 2 to 1 should be OK
if (device.endpointId == null) device.endpointId = 2 ------>
if (device.endpointId == null) device.endpointId = 1


(Andy Chan) #95

Repeating from my 2nd post.

“Note: The state of the buttons for the 2 gang switch will NEVER be able to be in sync. This is because smartthings masks the endpoint end when it returns the on/off status. Hence the DH will never know the on/off returned is for which button.”

Smartthings backend sends back a message to tell the DH that the switch has changed state (from on to off or vice versa). But it removes information about which switch. Is it switch 1 or 2?

Hence the DH cannot update the GUI properly.

Do not worry about the state in the GUI. For me, i just make use of motion and contact sensors to hard on/off switches based on actions detected.

I hardly interact with the individual switches in the GUI.

If I had to use the app, its more to call routines, to turn on a group of lights, or switch off a group (aka Welcome Home/ Goodbye/ Goodnight style routines)

Hope this gives you some inspiration to work around the limitations.


#96

Yes totally thanks - took on board your 2nd post , am content with how the double switch operates, I just found it ironic that the single switch had the exact opposite traits ! but will try Ziot’s suggestions for a fix.

Thanks all.


#97

Question regarding this step:

What to do exactly in the smartapp setting on the phone in regards to the virtual switch? So there are three virtual switch settings in my smartapp.

a) “select a virtual switch to bind to outlet 1”. Shall I use outlet 1 or outlet 2 or both? (3 in total)
b) More important what to select in “which?”? The same device as in the first question “which aqara wall switch is used”?


#98

I see the state of the switch in the app but I can´t execute any on/off from the app. I am sure the problem is somewhere in my setup. What I use:

DH: johndoyle : Xiaomi Zigbee Mains Toggle Switch
Device: Xiaomi Zigbee Mains Toggle Switch

In the app:

  • I see the state on or off in realtime updating when I press the physical button. Good!
  • Clicking on on or off does nothing :frowning:

Virtual devices:
I don´t get really what that is nor why it´s needed. I added two virtual devices from the default virtual device creator in the app automation.

Than I added them in the smartapp where it asks:
“select a virtual switch to bind to outlet 1/2”.

Also after that nothing happens when I click the on/off in the app…


(Jeremiah Lim) #99

The device handler just makes the device recognised, its the virtual switches that enable smartthings to “control” it if that makes sense.

You need to assign the device to the switch by:

  1. Go into smartapps and create new smartapp via the virtual switch code from Simics Kudos code I linked above. Copy in, save then publish.
  2. In the Smartthings mobile app (has to be Smartthings Classic, the new one didn’t work for me) under automation > smartapps > light on, assign your aquara device to the first outlet.

If above fails maybe try using Simics device handler instead of John Doyle’s? The latter didn’t work for me for some reason (I might have done something incorrect)


(Norbert Zsolt Gecse) #100

Hi!

i have a really interesting problem, maybe someone can help me.

i had an US region hub, (it was 3 weeks ago, the hub died)
i used the the aqara single switch wired no neutral outlets with it
i had to pair it with catch/call every-time , it never recognised as a “thing”
BUT! with the device handler alone, it worked perfectly, (without the virtual switch or anything) it was in synchrone the on/off switching phisically and programatically as well!

Right now i changed hubs and decided to use the UK region HUB
With this, whenever i pair a switch the hub recognise is it as a thing (same switch) !
but right now it seems that the device handler not working alone i have to use this virtual switch
nothing changed just my hub (all other devices remained built in the house)

my question is, is it possible to get the same functionality as the us hub? why is the two hub works quiet different ?


(Jeremiah Lim) #101

Good question - from what I understand the US and UK hubs use different frequencies for the Zigbee, but given you are able to detect the switch in both hubs, that doesn’t seem like the problem.

I could be due to a change in the device ID when you changed hubs? Have you tried looking at the catchall in your new hub and changing the Network ID to the new device ID?