zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

AQARA WXKG02LM (new Hardware Rev)?

Open k3erg opened this issue 8 years ago β€’ 16 comments

Somehow my changes to device.js don't get picked up by my zigbee2mqtt, i.e. after adding the code below, I don't get WARN No converter available for it is still WARN Device with modelID 'lumi.remote.b286acn01' is not supported. when I click a button. Maybe an invisible Unicode char in the modelID?

So here we go with this ticket for another reincarnation of WXKG02LM (edited to refelct now corrected values):

    {
        zigbeeModel: ['lumi.remote.b286acn01\u0000\u0000\u0000'],
        model: 'WXKG02LM',
        vendor: 'Xiaomi',
        description: 'Aqara double key wireless wall switch',
        supports: 'left, right and both click',
        fromZigbee: [
            fz.xiaomi_battery_3v, fz.WXKG02LM_click_multistate, fz.ignore_basic_change, fz.ignore_multistate_change
        ],
        toZigbee: [],
    },

It does support left click, double left click, long left click, double right click, long right click, both click, double both click, long both click, so I guess it would need something like

WXKG02LM_click_multistate: {
        cid: 'genMultistateInput',
        type: 'attReport',
        convert: (model, msg, publish, options) => {
            let ep;
            let lu; 
            const value = msg.data.data['presentValue'];
            const lookupEp = {
                1: 'left',
                2: 'right',
                3: 'both',
            };
            const lookup = {
                0: {click: ' long'}, // long click
                1: {click: ''}, // single click
                2: {click: ' double'}, // double click
            };
            if ((ep = lookupEp[msg.endpoints[0].epId]) && (lu = lookup[value])) {
                lu.click = ep + lu.click;
                return lu; 
            }
            return null;
         },
    },

in fromZigbee.js as I did not find a matching genMultistateInput for the Events in the Logs.

Judging by the log, xiaomi_battery_3v should do for the battery voltage.

Logs for clicks: https://pastebin.com/qprUTe0V

Logs for state (battery) https://pastebin.com/KZg08mBV

k3erg avatar Sep 01 '18 20:09 k3erg

Further down the rabbit hole, it turns out the modelID really hast Unicode chars: lumi.remote.b286acn01\u0000\u0000\u0000... now it shows up and I can start adding coverters :) – I leave the issue open, until I come up with a solution / pullrequest for now.

=> I got the real modelID out of the data/database.db, maybe that could help others, too, to have it in the wiki.

k3erg avatar Sep 02 '18 07:09 k3erg

Because of the UniCode Problem .. we got it here too https://github.com/Koenkk/zigbee2mqtt/issues/286

BTW: Please post your database.db content ..

tb-killa avatar Sep 02 '18 09:09 tb-killa

I paired the device, took the posted ieeeAddr from the log to grep the database: cat /opt/zigbee2mqtt/data/database.db | grep 0x00158d00027c0d08

{"id":13,"type":"EndDevice","ieeeAddr":"0x00158d00027c0d08","nwkAddr":51894,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.remote.b286acn01\u0000\u0000\u0000","epList":[1,2,3],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":24321,"inClusterList":[0,3,18,25,65535],"outClusterList":[0,3,4,5,18,25,65535],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":2},"attrs":{}},"genScenes":{"dir":{"value":2},"attrs":{}},"genMultistateInput":{"dir":{"value":3},"attrs":{}},"genOta":{"dir":{"value":3},"attrs":{}},"manuSpecificCluster":{"dir":{"value":3},"attrs":{}}}},"2":{"profId":260,"epId":2,"devId":24322,"inClusterList":[3,18],"outClusterList":[3,4,5,18],"clusters":{"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":2},"attrs":{}},"genScenes":{"dir":{"value":2},"attrs":{}},"genMultistateInput":{"dir":{"value":3},"attrs":{}}}},"3":{"profId":260,"epId":3,"devId":24323,"inClusterList":[3,12],"outClusterList":[3,4,5,12],"clusters":{"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":2},"attrs":{}},"genScenes":{"dir":{"value":2},"attrs":{}},"genAnalogInput":{"dir":{"value":3},"attrs":{}}}}},"_id":"F74K4PsdTv7bywzA"}

I'm testing my the converter now... had to add a new lookup table for left, right, both (inkl. long, double). Hope to post in 1-2h.

k3erg avatar Sep 02 '18 09:09 k3erg

Could you please provide one full run with DEBUG=* npm start and post this log via pastebin or other ?

tb-killa avatar Sep 02 '18 10:09 tb-killa

Pull request is out... do I need to name the model different than "WXKG02LM"?

Log will follow shortly... new log format for me, got the check what needs to be sanitized. If you are looking for particular entries, I can post that quickly.

k3erg avatar Sep 02 '18 13:09 k3erg

Here is the log from DEBUG=* start https://pastebin.com/sdP5CqRW

k3erg avatar Sep 02 '18 13:09 k3erg

In your logfile i doesnΒ΄t see any informations of your lumi device .. search failed . please do following: stop zigbee2mqtt , rename database.db to something else and restart zigbee2mqtt with debug=* npm start .. after that pair again your lumi device. please report with full log from start to stop.

If search for this: Identified Device: { manufacturer: %s, product: %s }'

your posted log show actually only Identified Device: { manufacturer: IKEA of Sweden, product: TRADFRI bulb E27 opal 1000lm } +4ms ;)

tb-killa avatar Sep 02 '18 18:09 tb-killa

@k3erg The previous revision allegedly only supports click events for left/right/both. So this new revision sounds pretty interesting. Is there any clue on how to spot this new revision on Gearbest/Aliexpress?

cybe avatar Sep 02 '18 19:09 cybe

@tb-killa lol, yes, because I had my new model and converters already in place. https://paste.ee/p/eRJnJ

@cybe My mandarin is not very good, so I stick with the numbers and signs :) It is branded as AQARA and carries the same SKU and Model Number as noted on the old box. But if you compare the two boxes the new one has references to Apples HomeKit on it (not very prominent, dough). The new AQARA Gateway is HomeKit compatible. This led to changes in certification policy for compatible products. So the most noticeable change on the new box is the CE and RoHS Logo. There are also different EAN-13 codes on the boxes: OLD: 6 970504 210049 NEW: 6 970504 210516

Not sure if this goes with the policy to directly link the product I ordered: http://s.click.aliexpress.com/e/cpldVy5w I order from that seller quite often, they delivered fast an reliable to me. Hope they come up with new CE certified wired wall switches, too.

Hope this helps.

k3erg avatar Sep 03 '18 06:09 k3erg

@k3erg Much appreciated!

cybe avatar Sep 03 '18 06:09 cybe

Hi, is this device currently working on Home Assistant using zigbee2mqtt?

I have installed Home Assistant in a rapsberry 2 and I can not find the file "device.js" to add the code. How can I configure zigbee-shepherd-converters to add the new WXKG02LM?

Thank you.

emiliojose91 avatar Sep 22 '18 18:09 emiliojose91

The code can be usually found in /opt/zigbee2mqtt/node_modules/zigbee-shepherd-converters/devices.js and /opt/zigbee2mqtt/node_modules/zigbee-shepherd-converters/converters/fromZigbee.js

As of writing this, the working code is not yet merged, but can be found in this PR https://github.com/Koenkk/zigbee-shepherd-converters/pull/62

k3erg avatar Sep 23 '18 04:09 k3erg

The code can be usually found in /opt/zigbee2mqtt/node_modules/zigbee-shepherd-converters/devices.js and /opt/zigbee2mqtt/node_modules/zigbee-shepherd-converters/converters/fromZigbee.js

As of writing this, the working code is not yet merged, but can be found in this PR Koenkk/zigbee-shepherd-converters#62

I can not find this path. I use docker, I think this may be the problem. Is there any way to modify the docker image to modify devices.js?

emiliojose91 avatar Sep 23 '18 07:09 emiliojose91

@emiliojose91 Switch inside the running container first, like docker exec -ti zigbee2mqtt sh. If you use the official Docker image, those files are are located in /app/node_modules/zigbee-shepherd-converters/

cybe avatar Sep 23 '18 07:09 cybe

@k3erg and @cybe Thanks for the answers. I do not know docker, I try to run "docker exec -ti zigbee2mqtt sh" from command line but can not find docker. The installation of Home Assistant was done following the steps of https://www.home-assistant.io/hassio/installation/ in my Raspberry 2. Do I have to install docker to execute this?

emiliojose91 avatar Sep 23 '18 08:09 emiliojose91

Code has been merged - txs for this great project!

k3erg avatar Sep 26 '18 21:09 k3erg