Xiaomi Aqara double key wireless wall switch (WXKG02LM)
The sniffer seems not to find this device / pair with it. Others also have the same problem, as reported in the HA forum.
Pairing is a little bit more difficult for this device, keep both buttons pressed until the 2 lights on the bottom start blinking. After some time it should pair.
@ciB89,
Well as @Koenkk said, it can be a bit difficult and I just completed pairing all mine last night. The best way I figured out was to follow the following steps:
- Ensure the switch is close to it. I already had mine mounted so had to remove them all and place them within like 50-100cm of the sniffer (well maybe case I had mine somewhere at the corner).
- Press the left one down and hold it down
- Wait until both lights starts flashing
- Keep holding it down and don't release until both stops flashing and the left LED flashes once
- Wait and take a chill and let the stuff do its magic
There was the temptation to keep pressing the button to "keep it alive", especially after the nightmare of pairing my Mija sensors which required it. but don't do this, as I think it made matters worse. Just leave it once you see the message pop up ..._lock[] (sorry can't remember exactly what it says)
Hope it helps. Cheers
@Koenkk,
That said, please can you add within the MQTT messages, status update of the pairing process? For example if one was to activate the add devices over mqtt, it will be nice to be able to get the status of the pairing process over mqtt.
Basically the same messages sent over the console as follows:
2018-05-22T18:00:47.197Z - info: Zigbee: allowing new devices to join.
2018-05-22T18:23:39.197Z - info: ..._lock[] (or whatever it is as its not in the logs)
2018-05-22T18:23:40.204Z - info: Connecting with device, please wait...
2018-05-22T18:23:43.409Z - info: Connecting with device, please wait...
2018-05-22T18:23:46.658Z - info: Connecting with device, please wait...
2018-05-22T18:23:49.882Z - info: Connecting with device, please wait...
2018-05-22T18:23:53.117Z - info: Connecting with device, please wait...
2018-05-22T18:23:56.353Z - info: Connecting with device, please wait...
2018-05-22T18:23:59.612Z - info: Connecting with device, please wait...
2018-05-22T18:24:02.838Z - info: Connecting with device, please wait...
2018-05-22T18:24:06.073Z - info: Connecting with device, please wait...
2018-05-22T18:24:09.310Z - info: Connecting with device, please wait...
2018-05-22T18:24:12.558Z - info: Connecting with device, please wait...
2018-05-22T18:24:15.775Z - info: Connecting with device, please wait...
2018-05-22T18:24:19.011Z - info: Connecting with device, please wait...
2018-05-22T18:24:22.233Z - info: Connecting with device, please wait...
2018-05-22T18:24:25.492Z - info: Connecting with device, please wait...
2018-05-22T18:24:25.506Z - info: New device joined the network!
2018-05-22T18:24:25.516Z - info: New device with address 0x00158d000xxxxxxx connected!
I will then pick them over mqtt. So that I can start and get status all via my GUI or Voice system.
Thanks
So, when I keep pressing the left button until it stops flashing, the led turns itself on and stays on - basically forever until I do something with it again. The debug log does not show anything. Or does it really take over an hour to connect?
It should take +- 1 minute, can you start and pair with DEBUG=* npm start?
I'm running the Hassio version, but I set debug to true. But except for my other zigbee device (so far got only one other) it shows me nothing when I try to pair..
Ok, I will make a video how to pair once I'm back from holiday.
Ok, thanks :). I don't feel like I'm making a mistake though, but who knows.. let's hope for the best (and that my switch isn't just broken).
One thing you also can try is changing the battery, I had one Xiaomi device which I couldnt pair, noticed that the blue pair light was quite dark, replacing the battery fixed the problem.
Battery seems fine, lights are quite bright.
So let me try this again. When I long press the left button until the lights start flashing (they are only flashing faintly here), then I continue pressing? What is supposed to happen next? The light simply turns itself on and stays on if I let go then.
Than it's very strange that you see nothing after a factory reset of the device when running with DEBUG=* npm start
This is what I tried: video
If I remember correctly, in my case both lights flashed. Can you try pressing both buttons?
Already tried that. Both LEDs turn on and stay on after the flashing, but still nothing on the debugger.
I'll try recplacing the battery.
Replacing the battery did the trick. But now it crashes everytime:
2018-5-27 22:23:40 INFO Connected to MQTT server
2018-5-27 22:23:40 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
2018-5-27 22:23:41 INFO MQTT publish, topic: 'homeassistant/sensor/0x00158d0002486c1c/action/config', payload: '{"icon":"mdi:cube","value_template":"{{ value_json.action }}","json_attributes":["battery"],"state_topic":"zigbee2mqtt/cube","availability_topic":"zigbee2mqtt/bridge/state","name":"cube"}'
/app/lib/homeassistant.js:238
const friendlyName = settings.getDevice(deviceID).friendly_name;
^
TypeError: Cannot read property 'friendly_name' of undefined
at discover (/app/lib/homeassistant.js:238:54)
at Object.discover (/app/lib/homeassistant.js:267:42)
at zigbee.getAllClients.forEach (/app/lib/controller.js:59:35)
at Array.forEach (<anonymous>)
at Controller.handleStarted (/app/lib/controller.js:57:41)
at mqtt.connect (/app/lib/controller.js:48:85)
at MqttClient.client.on (/app/lib/mqtt.js:26:13)
at emitOne (events.js:121:20)
at MqttClient.emit (events.js:211:7)
at MqttClient._handleConnack (/app/node_modules/mqtt/lib/client.js:891:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-05-27T20_23_41_064Z-debug.log
What's happening?
Ok, fixed it. Apparently I screwed up the pairing process and in the configuartion.yaml was the device still missing, so I added it manually, now it works.
Still need help with this. After adding the button in the configuration.yaml (I got the addresse from the database.db), it shows that it joins in the logs etc, the switch also thinks its paired, I receive "commands" when the buttons are pressed, but there is no MQTT publish happening - the sensor in HA is not updated. Depending on the buttons pressed, the logs only output:
Mon, 28 May 2018 10:01:53 GMT cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 13780, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 60, securityuse: 0, timestamp: 7392275, transseqnumber: 0, len: 11, data: <Buffer 18 21 0a 00 00 10 01 00 00 10 00> }
Mon, 28 May 2018 10:01:53 GMT zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
Mon, 28 May 2018 10:01:53 GMT cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 13780, srcendpoint: 2, dstendpoint: 1, wasbroadcast: 0, linkquality: 55, securityuse: 0, timestamp: 7393851, transseqnumber: 0, len: 11, data: <Buffer 18 22 0a 00 00 10 01 00 00 10 00> }
Mon, 28 May 2018 10:01:53 GMT zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
Mon, 28 May 2018 10:01:54 GMT cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 13780, srcendpoint: 3, dstendpoint: 1, wasbroadcast: 0, linkquality: 55, securityuse: 0, timestamp: 7395353, transseqnumber: 0, len: 11, data: <Buffer 18 23 0a 00 00 10 01 00 00 10 00> }
Mon, 28 May 2018 10:01:54 GMT zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
Is there a way to depair devices again so that I can repair it and see if that fixes it? Simply trying to start the paring process from the switch outputs ".. is already joined", deleting the switch from the database.db and config only results in the same error as above again.
Can you provide the whole log when running with DEBUG=* npm start after pressing some buttons?
When I manually added the switch to the configuration.yaml then this is all it does when pressing the buttons on the switch, it just keeps repeating itself depending on what I press (srcendpoint: 1 is left button, 2 is right, 3 is both). If I don't add it manually to the config then zigbee2mqtt crashes before I can press anything.
The cube works fine btw, it's just the switch. While it was pairing the switch, I accidentally initiated the paring process again or canceled it (can't really remember). That's what screwed it up I think.