Xiaomi Aqara Zigbee Switch DTH--help needed

I just purchase a few units of Xiaomi Aqara Zigbee Switch for development. Plan to replace all my Broadlink TC2 switch with it. I am in the process of writing a device handler for it and having trouble getting the cluster information during join process for this device.

I can only see the bunch of raw message in the hub log after the add device process completed.


Most of them does not look valid except for the first raw message.

raw:F4690000158D00013E6CC2, dni:F469, errorCode:00, ieee:00158D00013E6CC2

Which appear to be Device Network ID and Zigbee ID

I keep reseting the switch and somehow the following message appear in the hub log,

ep_cnt:2, ep:01 02
desc: 01 0104 019A 00 01 0000 00
desc: 02 FC01 019A 00 00 00

It appear to have two endpoint with a generic cluster 0x0000 at endpoint 0x01
Endpont 2 doesn’t look like it have any valid cluster.

I’m using using this fingerprint to bind the switch to my DTH

fingerprint profileId: “0104”, deviceId: “019A”, deviceVersion: “00”, inClusters: “0000”, outClusters: “00”, manufacturer: “LUMI”, model: “lumi.ctrl_neutral1”, deviceJoinName: “Xiaomi Aqara Switch”

It still does not bind automatically during join process and I have to manually add the Device Network ID F469

def parse(String description) {
log.debug “Parsing ‘${description}’”
// send event for heartbeat
def now = new Date().format(“yyyy MMM dd EEE h:mm:ss a”, location.timeZone)
sendEvent(name: “lastCheckin”, value: now)

def results =
if (description?.startsWith('on/off: '))
results = parseCustomMessage(description)
if (description?.startsWith(‘catchall:’))
results = parseCatchAllMessage(description)

return results;
}

Because it is a toggle switch
To turn on the light
Switch press will return “on/off: 1” in the IDE log
Switch release release will return “on/off: 0” in the IDE log

To turn off the light
Switch press will return “on/off: 0” in the IDE log
Switch release release will return “on/off: 0” in the IDE log

Then catchall log start appearing in the IDE Log.

catchall: 0104 0000 01 01 0100 00 F469 00 04 115F 0A 01 01FF42296410006510006E20006F20FF0121E40C03281F05211800082111260A2100009923000000009B210000

Great I can get physical switch press event, but I no idea how to progress from here to turn on and off the light via write to cluster.
Is any command I can use to get more detail of the Zigbee Cluster. Any Zigbee expert here can show me some pointers? This is my first Zigbee DTH and I am totally lost here after spending two days working on this.

3 Likes

Tagging @erocm1231

IDE Log with catchall

@aronteh

@simic may be willing/able to provide assistance, he has created two switch DTH in the past

@KellyDarren Thanks for the direction, I will look into it.

your endpoint ID is 0x01

To test it out, try my kudled DH. Everywhere u see 0x12, change it to 0x01.

0x12 was the first endpoint of my 3 switch kudled. followed by 0x11 and 0x10.

I have try out your suggestion. There are no response from endpoint 0x01 cluster 0x0006

I am trying to sent a simple descriptor request command to Zigbee Device Object at endpoint 0x00 cluster 0x0000, anybody know the exact ZDO command to do this?

I have also try sending active endpoint request but not getting any response “zdo active 0x${device.deviceNetworkId}”

Finally manage to get the Active Endpoint and Cluster:-
ep_cnt:7, ep:01 02 03 04 05 06 08
desc: 01 0104 0006 02 06 0000 0003 0001 0002 0019 000A 02 0019 000A
desc: 04 0104 0000 02 02 0012 0006 00

Which endpoint and cluster should I be focusing on?

I not sure I got the right On/Off Cluster. I am sending On and Off command to endpoint 4 cluster 6
"st cmd 0x${device.deviceNetworkId} 4 6 1 {}"
“st cmd 0x${device.deviceNetworkId} 4 6 0 {}”

The switch does not switch On or Off, but I do get the same catchall response as below for both On and Off command.
Parsing ‘catchall: 0104 0006 04 01 0100 00 5438 00 00 0000 0B 01 0100’

Hi Aronteh, how’s your progress? Any luck to create a DH for this?
I have bought this too and the product looks great in build quality, hopefully i can switch from my TC2 to this as well

Hello there.
How is this coming along? if you open up your project on github i would be willing to help. I got a couple of xiaomi aqara incoming soon.

2 Likes

Hi I’ve got a few wireless dual buttons version. I do however have some questions. I used catchall method to add the device without any problems. And I do receive on/off: 1 response when pressing the button. However, I do not receive on/off:0 release response nor can I tell which button I’m pressing as the response are all the same: on/off: 1. I hope someone can help me to understand the protocol behind and get around it.

the on/off problem is because smarthings is parsing the the return results.

there is no way to know the button state short of doing a force poll after you receive a on/off response.

and you cannot issue a query command in the parse section of the code… Grrr.

I encounter that when i wrote code for another china wall switch.

Anyway, i find that my use case revolves around switching switches on/off based on motion or other inputs. commanding the switch on and off directly should work ok, if you manage to figure out the endpoint ID.

Hardly do I use the app to toggle the switches. hence keeping the switch state updated in the GUI is not important to me.

My question has nothing to do with the state since all I need to know is the button is toggled. It’s about parsing the result with the response of actually pressing the button on the physical device. The state is not really important to me at all. But knowing which button fires the event is rather important. And as previously stated by the OP, it should also send response for both the press event and release event.

  1. Do some reading up on sending a bind command to the switch. This will
    instruct the switch to send updates to hub when buttons are pressed.

Bind commands are usually tied to the configure button on the DH

  1. If this behaves like the atsmart switch I worked on. after u bind, u
    will get on/off:1 or 0…

But u won’t know which endpoint Id. Becoz the back end had masked or parsed
the catch-all.

Smartthings is not good at handling multiple endpoints on a single device…
hence the kludge of virtual switch and smartapps to bind virtual switch to
endpoint 2…3…4 etc.

The behavior is totally unlike the kudled switch where I had the raw
catch-all to work with. (i.e. I know what state + what endpoint )

You don’t quite follow what I’m talking about do you? It does send on/off: 1 but not on/off: 0 as I stated in the very begining. Correct me if I’m wrong, I don’t think binding is an issue here.

shrugs. Then i dunno. you could try to contact @sticks18.

he is the guru that pointed me in the correct direction when I was writing DH for kudled and atsmart.

Have you seen this thread? There are DH for Xiaomi sensors. The original temp sensor DH works with the Aqara temp sensor.

1 Like

Any updates on the development of a handler? Wish I could help but I’m a coding n00b