Zigbee Arduino Device question

Hi,
I have been experimenting with an Arduino hooked up to an Xbee and have had some success getting it recognised by the hub. I have performed a device announce, endpoint report and simple descriptor which then gets the device to show in smartthings as a device.

I now wish to query the device to get the state of connected things to the Arduino (such as buttons, light sensors, motion sensors etc) and I am currently using zigbee.readAttribute in my device handler.

When I call zigbee.readAttribute I get a match descriptor request, is this normal?
I was expecting to receive a read attribute request.

1 Like

Can you share the device type your using to make the call. When you say you get the match descriptor request is that what your seeing on your Arduino?

2 Likes

Thanks for the reply, but it turns out I was looking at the wrong request/response on the Arduino. Sorry!

I’d blame the hours spent trying to learn what I can from the Zigbee/ZCL specs, but I don’t think it would explain such a gaffe!

Now I shall attempt to decipher what I am actually getting.

1 Like

Let me know if I can help…

@JohnR and a couple others are the experts who saved me many hours of confusion and research; big boost up the learning curve…

But I figure I can at least try to “pay it forward”; and, heck, that’s the best way for me to learn more!

2 Likes

Thanks very much for the offer of help.

I’m enjoying tinkering around with this project, but as you say, the learning curve is quite steep. I guess it wouldn’t be as much fun if it was too easy :smile:

I have set up the Arduino as a switch with a single endpoint of 0x08 and cluster types of 0x0000, 0x0003 and 0x0006.

In my Device Handler, i am performing a zigbee.readAttribute(0x0006, 0x01) to see what gets sent to the Arduino.

What I receive on the Arduino is a message with the following payload:

D0 52 A8 90 FC 06 00 01 00 00 01 08 00 06 01 04 01 10 78 00 01 00

What I have found so far:

The 78 appears to be the sequence number and changes every request.

I’m guessing the 01 00 is the 16 bit little endian version of the 0x01 I am using in the readAttribute call.

I don’t know what the previous zero byte means as it it not mentioned in the Read Attributes Command frame format.
This then throws doubt in my mind that I am even looking at the right request type in the spec and that maybe it is not a Read Attribute Command.

Any help is gratefully received!

1 Like

Mathew, can you paste the entire packet in hex like you did above but for all bytes received. When the xBee is in API mode it will send your microprocessor data through the serial port as API data frames (packets of data with a check sum at the end). They all start with the hex number 0x7E. You will have to decipher what is in these packets to figure out what is going on. For example on page 155 and 156 of the xBee manual you can see the format of two of the common RX data packets.

2 Likes

Hi John,

Here is the full packet:

7E 00 17 91 D0 52 A8 90 FC 06 00 01 00 00 01 08 00 06 01 04 01 10 3A 00 01 00 B1

Thanks in advance for anything you can tell me about it

1 Like

That is exactly what is getting sent to your xBee so everything is working as it should. Now you have some code to write :grinning:

3 Likes

Thanks for the detailed reply, it has helped no end.
Things seem a lot clearer now.

Now I just have to read up on how to properly respond to the request and I’ll be one step closer to a working device.

Thanks again for all the help.

2 Likes