SmartThings Community

Reverse engineering a Zigbee device


(Jared) #1

Hi,

You may know me from my work that I’ve done with my MiLight Controller.

I’m back at the Chinese HA products again, this time with a Zigbee device. The ultimate goal is to publish a device type that everyone can use.

So, first thing first – is there a way to view all the Zigbee data being “read” by the hub? I’m not even able to pair the device yet, and from reading through the docs, it seems I need to know the input/output clusters before I can proceed.


#2

When you pair the device you should see a zbjoin event that has all the relevant information:

If you can’t even get it to pair I’d start there. Is it ZigBee HA 1.2?


(Jared) #3

I haven’t had success pairing it, yet. I’m not sure how to pair a device that ST doesn’t even have a device for. Ideally I would like to choose just a generic “zigbee device” and then grab its data that way.


#4

Pairing happens before we assign a Device Type Handler. If you pair a ZigBee device that doesn’t have a system fingerprint it’ll pair as a “Thing” of type “Unknown”. This way you can inspect the zbjoin event and modify your Device Type Handler appropriately.

So - step 1 is to get the device to pair. Do you have any specs that you can share? I’d recommend performing a factory reset on the device within a foot or two of your SmartThings Hub while it’s searching for a device. That usually kickstarts the pairing process.


(Jared) #5

I’ll give that a shot.

Here’s a screenshot from the hub events list when I attempt to do the “pair”

http://imgur.com/A4yjpWL


#6

That’s unrelated.

You should see:

  1. an “include search” event showing that your hub is looking for devices
  2. a “zbjoin” event with all of the information about your ZigBee device
  3. potentially a “Thing added” and “Thing updated” event

If you aren’t seeing #1, your hub isn’t going into pairing mode.

If you aren’t seeing #2, your device isn’t pairing to the hub at all.

Example of the whole flow:


(Jared) #7

Alright @Tyler, thanks. I did manage to pair this sucker up. I’m not sure how I did it, but that’s for another thread.

I didn’t see the zbjoin event, but I did get this.

Should I try and re-pair?


#8

No - if you go to the Devices view you should see a Thing now. All the information should be on that page.


(Jared) #9

Sorry to keep chain posting, I’ll eventually figure this out. Just need a nudge.


#10

Once you do get it paired, you can get started on the next steps. As it happens, this exact topic, onboarding a new zigbee device, was covered in a session at this year’s Samsung developers conference. That session is available on YouTube if it’s of any help.

My favorite example of someone in the community adding a previously unknown ZHA device to SmartThings is the following thread. It might also be of help.


New Zigbee HA1.2 Dimmer Device Identified as Unknown
(Jared) #11

Thanks @JDRoberts, this thread is a gold mine.


(Jared) #12

I’ve smashed my face into the keyboard all night.

So far, from what I can tell, the device actually connects to the hub. SmartThings, however, doesn’t see it properly during the search.

Once I create a device and assign it the deviceId, I can see the device working in the live logs:

descmap: [raw:F8B003000C1805FF21F40155003914AEC1C1, dni:F8B0, endpoint:03, clusterInt:12, cluster:000C, size:18, attrInt:65285, attrId:ff05, encoding:21, value:c1c1ae1439005501f4]

So, the question is, why isn’t SmartThings pairing with my device properly?

We can even see here:

01 0104 5F01 01 04 0000 0003 0019 0012 06 0000 0004 0003 0005 0019 0012

that the device is Zigbee HA (0104)


#13

Tagging @johnr @erocm1231 @Sticks18


(John Rucker) #14

Looks to me like your device is paired to the hub and its time to create a custom device type for it. There are tons and tons of examples of how to do that on this forum as well as great SmartThings documentation.


(Darren) #15

@Jared this thread may be of some use. It relates to how to find the Zigbee ID of a device in this case an Xiaomi Zigbee Outlet Xiaomi Zigbee Outlet (Steps to Pair any Xiaomi Zigbee device!)


(Jared) #16

Dude!! The master @DroidSector did a FANTASTIC job on the Mi Cube already! It is bad ass. [RELEASE] Xiaomi Mi Cube / Magic Controller