1

I am trying to create a zigbee HA device. So far I have used https://nzfalco.jimdofree.com/electronic-projects/xbee-to-smartthings/ as well as the zigbee ZCL spec to get me to the point where I am sending commands on the HA Basic cluster. I am using the Digi XBee3 along with their xbee-java-library-1.3.0 library.

After sending the response to the SimpleDescriptor, my SmartThings hub sends me, what I think is a HA Read request for the version:

[Thread-2] DEBUG com.digi.xbee.api.DataReader - [COM6 - 9600/8/N/1/N] Packet received: 
Packet: 7E001791286D97000206071B0000010800000104110017000100E1
Start delimiter: 7E
Length: 00 17 (23)
Frame type: 91 (Explicit RX Indicator)
64-bit source address: 28 6D 97 00 02 06 07 1B
16-bit source address: 00 00
Source endpoint: 01
Dest. endpoint: 08
Cluster ID: 00 00
Profile ID: 01 04
Receive options: 11
RF data: 00 17 00 01 00
Checksum: E1

I interpret this to be:

Profile 260 (HA), Cluster 0, frameControl=0, seq=97, command=0, attributes={1}

I am responding with version 0x20:

[Thread-0] DEBUG com.digi.xbee.api.ZigBeeDevice - [COM6 - 9600/8/N/1/N] 0013A20041B76396 (Fred) - Sending XBee packet: 
Packet: 7E001C1110286D97000206071B000001088000010400000017010100002020A1
Start delimiter: 7E
Length: 00 1C (28)
Frame type: 11 (Explicit Addressing Command Frame)
Frame ID: 10 (16)
64-bit dest. address: 28 6D 97 00 02 06 07 1B
16-bit dest. address: 00 00
Source endpoint: 01
Dest. endpoint: 08
Cluster ID: 80 00
Profile ID: 01 04
Broadcast radius: 00 (0)
Transmit options: 00
RF data: 00 17 01 01 00 00 20 20
Checksum: A1

The spec is a bit confusing at this point. What should be in the ZCL Payload to respond with? The hub just ignores my response and tries the read again.

wdtj
  • 4,554
  • 3
  • 17
  • 20
  • Areas in the zcl spec that are confusing: 2.4.1.1.3 Direct ion Sub- field The direction sub-field specifies the client/server direction for this command. If this value is set to 1, the command is being sent from the server side of a cluster to the client side of a cluster. If this value is set to 0, the command is being sent from the client side of a cluster to the server side of a cluster. This is set to 0 on the message from the hub (the server) to my XBee (the client). – wdtj Apr 20 '20 at 14:18
  • My first attempt (not shown) was to set the command on my response, to the command on the request. Then I read Table 2-3: 0x00 Read Attributes 0x01 Read Attributes Response So I have it set to 0x01 on the response. – wdtj Apr 20 '20 at 14:22
  • If you understand C code, you could look at the Zigbee-related source of https://github.com/digidotcom/xbee_ansic_library to figure out how to format your frames. As far as the direction field, you typically just flip that bit in your response. There's a sample (Zigbee Walker) included in that codebase that uses ZDP/ZCL discovery to enumerate endpoints/clusters/attributes and dump their values. You could enable verbose (`#define XBEE_SERIAL_VERBOSE`, I believe) output and see exactly what it's sending and receiving to generate that output. – tomlogic Apr 22 '20 at 23:07
  • Didn't realize the Digi C library had more functionallity than the Java library. I'll check it out. From my brief look, it looks like this code is for the server side, whereas I was looking at the client side. Maybe I can get the two projects to talk to each other. Thanks. – wdtj Apr 23 '20 at 17:37
  • The Zigbee-related code in the C library should perform well as either a client (reading remote attributes) or server (having readable attributes) and back when I wrote it we were using it in both contexts. It might be one of the few Open Source implementations of a significant chunk of ZDP and ZCL protocols. I have not worked with Zigbee much in the past decade, but it would be good to see a writeup of how one can add an XBee3 Zigbee module to a Zigbee HA network. Feel free to open issues on that GitHub project if the ZCL is lacking in some way. – tomlogic Apr 24 '20 at 18:08
  • Always nice to talk with an OSS contributor. Thanks. – wdtj Apr 24 '20 at 22:41

0 Answers0