Zigbee binding and CC2531

The Xiaomi devices are problematic to include into the network as they don’t tend to respect the ZigBee polling requirements, and go to sleep immediately. You need to keep pressing the button every few seconds for maybe 30 seconds or so - hopefully it will eventually work.

you mean pressing 5sec, release and press 5sec again for 30sec or longer??

I mean once you put the device into join mode (I forget how that’s done), then every 5 seconds, press the button once quickly - keep doing this for 30sec or a minute. This tries to prevent the device sleeping while the binding discovers the services.

until now, it does not work.

But one step back, to make sure the stick is working well. When I’m initialising the cc2531, i get the following log:

13-Aug-2018 00:07:19.228 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Configuration received (Coordinator).
13-Aug-2018 00:07:19.231 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_initialise >> false.
13-Aug-2018 00:07:19.233 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_channel >> 11.
13-Aug-2018 00:07:19.234 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_panid >> 24552.
13-Aug-2018 00:07:19.235 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_znp_magicnumber >> 239.
13-Aug-2018 00:07:19.236 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_extendedpanid >> 83B9EF869F07EC2F.
13-Aug-2018 00:07:19.236 [DEBUG] [ab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - null: Unhandled configuration parameter zigbee_networkkey >> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00.
13-Aug-2018 00:07:19.239 [DEBUG] [com.zsmartsystems.zigbee.ZigBeeNetworkMeshMonitor ] - Stopping mesh update task
13-Aug-2018 00:07:19.251 [DEBUG] [g.zigbee.internal.ZigBeeNetworkStateSerializerImpl] - Saving ZigBee network state: Start.
13-Aug-2018 00:07:19.258 [DEBUG] [g.zigbee.internal.ZigBeeNetworkStateSerializerImpl] - Saving ZigBee network state: Done.
13-Aug-2018 00:07:19.259 [DEBUG] [artsystems.zigbee.internal.ZigBeeNetworkDiscoverer] - Network discovery task shutdown

especially the line zigbee_initialise >> false. is confusing me.

@alex_knx
Where i can set up the stick? In openhab.cfg i can’t find section to setup prot of my cc2531 stick
I suupouse my stick use ttyACM0 device.
Where i can find coordinator setup section?

UPDATE: i have founf this place in paperUI Configurations - Things. I setup on ttyACM0 and 115200 baud rate.

This is part of my log:
2019-01-17 13:45:30.276 [DEBUG] [31.network.impl.CommandInterfaceImpl] - -> ZB_GET_DEVICE_INFO (Packet: subsystem=null, length=1, apiId=26 06, data=FE 01 26 06 06 27, checksum=27, error=false)
2019-01-17 13:45:30.269 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <- ZB_GET_DEVICE_INFO_RSP (FE 09 66 06 05 00 00 00 00 00 00 00 00 6C)
2019-01-17 13:45:30.141 [DEBUG] [31.network.impl.CommandInterfaceImpl] - -> ZB_GET_DEVICE_INFO (Packet: subsystem=null, length=1, apiId=26 06, data=FE 01 26 06 05 24, checksum=24, error=false)
2019-01-17 13:45:30.131 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - initializeNetwork is true
2019-01-17 13:45:30.112 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - initResponse is JOINED
2019-01-17 13:45:30.098 [DEBUG] [bee.internal.ZigBeeNetworkDiscoverer] - Network discovery task starting
2019-01-17 13:45:30.092 [DEBUG] [nal.ZigBeeNetworkStateSerializerImpl] - Loading ZigBee network state: File does not exist
2019-01-17 13:45:30.084 [DEBUG] [nal.ZigBeeNetworkStateSerializerImpl] - Loading ZigBee network state: Start.
2019-01-17 13:45:30.068 [DEBUG] [.cc2531.network.ZigBeeNetworkManager] - CC2531 version is Software=2.6 Product=0 Hardware=3 Transport=2
2019-01-17 13:45:30.062 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <- SYS_VERSION_RESPONSE (FE 05 61 02 02 00 02 06 03 63)
2019-01-17 13:45:29.921 [DEBUG] [31.network.impl.CommandInterfaceImpl] - -> SYS_VERSION (Packet: subsystem=null, length=0, apiId=21 02, data=FE 00 21 02 23, checksum=23, error=false)
2019-01-17 13:45:29.889 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=6, apiId=41 80, data=FE 06 41 80 00 02 00 02 06 03 C2, checksum=C2, error=false
2019-01-17 13:45:29.862 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- SYS_RESET_RESPONSE (FE 06 41 80 00 02 00 02 06 03 C2)
2019-01-17 13:45:28.425 [DEBUG] [31.network.impl.CommandInterfaceImpl] - -> SYS_RESET (Packet: subsystem=null, length=1, apiId=41 00, data=FE 01 41 00 01 41, checksum=41, error=false)
2019-01-17 13:45:28.319 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port [/dev/ttyACM0] is initialized.
2019-01-17 13:45:28.203 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Connecting to serial port [/dev/ttyACM0] at 115200 baud, flow control FLOWCONTROL_OUT_RTSCTS.
2019-01-17 13:45:28.115 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - CC2531 transport initialize
2019-01-17 13:45:28.087 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key initialise A5E1510156ECEAD83FD67D5D798DB8F5
2019-01-17 13:45:27.621 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising ZigBee coordinator
2019-01-17 13:45:27.600 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee network starting
2019-01-17 13:45:26.563 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Scheduling ZigBee start
2019-01-17 13:45:26.469 [DEBUG] [.zigbee.cc2531.handler.CC2531Handler] - ZigBee CC2531 Coordinator opening Port:’/dev/ttyACM0’ PAN:7902, EPAN:4ED0A1042F15CC18, Channel:-1
2019-01-17 13:45:25.947 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key final array A5E1510156ECEAD83FD67D5D798DB8F5
2019-01-17 13:45:25.923 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key initialised A5E1510156ECEAD83FD67D5D798DB8F5
2019-01-17 13:45:25.871 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key String 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2019-01-17 13:45:25.460 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Created random ZigBee extended PAN ID [4ED0A1042F15CC18].
2019-01-17 13:45:25.358 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Created random ZigBee PAN ID [7902].
2019-01-17 13:45:25.334 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising network
2019-01-17 13:45:25.310 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2019-01-17 13:45:25.270 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - EPANID 0000000000000000
2019-01-17 13:45:25.248 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - PANID 0
2019-01-17 13:45:25.237 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Channel -1
2019-01-17 13:45:25.196 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initializing ZigBee network [zigbee:coordinator_cc2531:c4e55e7d].

You need to add the thing - in PaperUI, add a new thing, select the ZigBee binding, and then the coordinator that you have.

Once you add the coordinator to the system, then you will have the configuration.

I don’t immediately see any problem here - Is there a problem that you have identified that you want to look at?

Thank you, @chris for responce. The next step is to connect the zigbee device. I try to connect Xiaomi Cube controller.
I use scan button on inbox page on PaperUI. The device have not recognized.
Or i need to add device using buttons on stick?
The doc says:

all devices that are set up on the ZigBee controller and puts them in the Inbox. When the binding is put into discovery mode via the user interface, the network will have join enabled for 60 seconds.

But how to put stick in discovery mode?

From PaperUI, go to the inbox and start a scan of the ZigBee binding - it’s just the same as any binding in openhab.

@chris i did this but my cube does not discovered. I presse button on cube led blinking blue on cube.
Does the led blink on stick when stick in discovery mode? On my stick led allways green.

this is part of log:

No.

That’s fine.

The permit join is being sent, so you are starting join.

but no new items in inox-(. Does anybody have experince with xiaomi cube and OH binding? Unfortunately this cube is only one my zigbee device and i can’t check with some another zigbee device.

How are you trying to get this to join? As has been mentioned elsewhere, the Xiaomi devices tend to sleep very quickly, and you need to keep them awake for the discovery.

i have press button on cube 5 seconds/ The led on cube blinking, after that i rotate cube to prevent sleep mode. Does the bindig receive any packets from cube?

The full log of discovering bellow:

2019-01-17 22:31:19.115 [DEBUG] [bee.discovery.ZigBeeDiscoveryService] - Starting ZigBee scan for > zigbee:coordinator_cc2531:c4e55e7d
> 2019-01-17 22:31:19.123 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - Permit join to 65532/0 for 60 seconds.
> 2019-01-17 22:31:19.131 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX CMD: ManagementPermitJoiningRequest [0/0 -> 65532/0, cluster=0036, TID=60, permitDuration=60, tcSignificance=true]
> 2019-01-17 22:31:19.139 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX APS: ZigBeeApsFrame [sourceAddress=0/0, destinationAddress=65532/0, profile=0000, cluster=54, addressMode=DEVICE, radius=31, sequence=96, payload=00 3C 01]
> 2019-01-17 22:31:19.147 [DEBUG] [31.network.impl.CommandInterfaceImpl] - ->  AF_DATA_REQUEST (Packet: subsystem=null, length=13, apiId=24 01, data=FE 0D 24 01 FC FF 00 00 36 00 60 30 1F 03 00 3C 01 6C, checksum=6C, error=false) 
> 2019-01-17 22:31:19.266 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-  AF_DATA_SRSP (FE 01 64 01 00 64)
> 2019-01-17 22:31:19.273 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX CMD: ManagementPermitJoiningRequest [0/0 -> 0/0, cluster=0036, TID=61, permitDuration=60, tcSignificance=true]
> 2019-01-17 22:31:19.281 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX APS: ZigBeeApsFrame [sourceAddress=0/0, destinationAddress=0/0, profile=0000, cluster=54, addressMode=DEVICE, radius=31, sequence=97, payload=00 3C 01]
> 2019-01-17 22:31:19.291 [DEBUG] [31.network.impl.CommandInterfaceImpl] - ->  AF_DATA_REQUEST (Packet: subsystem=null, length=13, apiId=24 01, data=FE 0D 24 01 00 00 00 00 36 00 61 30 1F 03 00 3C 01 6E, checksum=6E, error=false) 
> 2019-01-17 22:31:19.417 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-  AF_DATA_SRSP (FE 01 64 01 00 64)
> 2019-01-17 22:31:19.428 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 01 45 CB 3C B3)
> 2019-01-17 22:31:19.437 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=1, apiId=45 CB, data=FE 01 45 CB 3C B3, checksum=B3, error=false
> 2019-01-17 22:31:19.443 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45cb
> 2019-01-17 22:31:19.449 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 03 45 B6 00 00 00 F0)
> 2019-01-17 22:31:19.458 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=3, apiId=45 B6, data=FE 03 45 B6 00 00 00 F0, checksum=F0, error=false
> 2019-01-17 22:31:19.464 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45b6
> 2019-01-17 22:31:19.470 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0A 45 FF 00 00 00 36 80 00 00 00 00 00 06)
> 2019-01-17 22:31:19.478 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=10, apiId=45 FF, data=FE 0A 45 FF 00 00 00 36 80 00 00 00 00 00 06, checksum=06, error=false
> 2019-01-17 22:31:19.484 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX APS: ZigBeeApsFrame [sourceAddress=0/0, destinationAddress=0/0, profile=0000, cluster=32822, addressMode=null, radius=0, sequence=0, payload=00 00]
> 2019-01-17 22:31:19.490 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX CMD: ManagementPermitJoiningResponse [0/0 -> 0/0, cluster=8036, TID=NULL, status=SUCCESS]
> 2019-01-17 22:31:36.555 [DEBUG] [internal.ZigBeeNodeServiceDiscoverer] - 00124B0018ECDAF6: Node SVC Discovery running
> 2019-01-17 22:31:36.571 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX CMD: NetworkAddressRequest [0/0 -> 65535/0, cluster=0000, TID=62, ieeeAddr=00124B0018ECDAF6, requestType=0, startIndex=0]
> 2019-01-17 22:31:36.578 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - TX APS: ZigBeeApsFrame [sourceAddress=0/0, destinationAddress=65535/0, profile=0000, cluster=0, addressMode=DEVICE, radius=31, sequence=98, payload=00 F6 DA EC 18 00 4B 12 00 00 00]
> 2019-01-17 22:31:36.589 [DEBUG] [31.network.impl.CommandInterfaceImpl] - ->  AF_DATA_REQUEST (Packet: subsystem=null, length=21, apiId=24 01, data=FE 15 24 01 FF FF 00 00 00 00 62 30 1F 0B 00 F6 DA EC 18 00 4B 12 00 00 00 F7, checksum=F7, error=false) 
> 2019-01-17 22:31:36.709 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-  AF_DATA_SRSP (FE 01 64 01 00 64)
> 2019-01-17 22:31:40.584 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B)
> 2019-01-17 22:31:40.591 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=12, apiId=45 CA, data=FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B, checksum=7B, error=false
> 2019-01-17 22:31:40.596 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca
> 2019-01-17 22:31:46.715 [DEBUG] [internal.ZigBeeNodeServiceDiscoverer] - 0: Node SVC Discovery NetworkAddressRequest returned null
> 2019-01-17 22:31:46.722 [DEBUG] [internal.ZigBeeNodeServiceDiscoverer] - 00124B0018ECDAF6: Node SVC Discovery request NWK_ADDRESS failed. Retry 76, wait 201870ms before retry.
> 2019-01-17 22:31:52.276 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B)
> 2019-01-17 22:31:52.285 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=12, apiId=45 CA, data=FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B, checksum=7B, error=false
> 2019-01-17 22:31:52.299 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca
> 2019-01-17 22:32:00.813 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B)
> 2019-01-17 22:32:00.832 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=12, apiId=45 CA, data=FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B, checksum=7B, error=false
> 2019-01-17 22:32:00.842 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca
> 2019-01-17 22:32:13.197 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B)
> 2019-01-17 22:32:13.203 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=12, apiId=45 CA, data=FE 0C 45 CA D1 95 38 0D 10 01 00 8D 15 00 00 00 7B, checksum=7B, error=false
> 2019-01-17 22:32:13.208 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca
> 2019-01-17 22:32:13.307 [DEBUG] [internal.ZigBeeNodeServiceDiscoverer] - 00124B0018ECDAF6: Node SVC Discovery already scheduled or running
> 2019-01-17 22:32:19.411 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 01 45 CB 00 8F)
> 2019-01-17 22:32:19.418 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=1, apiId=45 CB, data=FE 01 45 CB 00 8F, checksum=8F, error=false
> 2019-01-17 22:32:19.424 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45cb

@chris
i suppouse this is packet from cube but binding does not recognize it:

2019-01-17 22:32:19.411 [DEBUG] [31.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 01 45 CB 00 8F)
2019-01-17 22:32:19.418 [DEBUG] [31.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=1, apiId=45 CB, data=FE 01 45 CB 00 8F, checksum=8F, error=false
2019-01-17 22:32:19.424 [DEBUG] [e.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45cb

Why do you think this? I very much doubt it as it is not a frame from a device.

@chris
i just discovered this is frame from device, this record apears in log in discovery mode after pressing button on cube if i not pressing button in discovery mode this packet : <-- ZToolPacket (FE 0C 45 CA 2E F8 38 0D 10 01 00 8D 15 00 00 00 E9) does not apear in log.

00:01:15.254 [DEBUG] [ee.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca
00:01:25.923 [DEBUG] [531.network.impl.CommandInterfaceImpl] - <-- ZToolPacket (FE 0C 45 CA 2E F8 38 0D 10 01 00 8D 15 00 00 00 E9)
00:01:25.932 [DEBUG] [531.network.impl.CommandInterfaceImpl] - Received Async Cmd: Packet: subsystem=null, length=12, apiId=45 CA, data=FE 0C 45 CA 2E F8 38 0D 10 01 00 8D 15 00 00 00 E9, checksum=E9, error=false
00:01:25.941 [DEBUG] [ee.dongle.cc2531.ZigBeeDongleTiCc2531] - Unhandled ZToolPacket type 0x45ca

How did you discover it came from the device? I don’t believe that it is, although this frame is not documented in the ZNP docs I have available right now, but it is not a ZigBee frame from a device - such frames are processed by the library.

If you have more information then please provide it rather than me having to find it as it takes time :wink:

I see logs in karaf online. When I press the button on cube this ztool packet immediately appears in log. If you want I can record a small video with this situation. @chris

That doesn’t necessarily mean that the frame you are seeing comes from the device. There is a lot that happens when devices are associated. It is however hard to tell what is happening with only a single command like this - it is always better to provide a longer log.

I probably will not have much time to look at this much for a few weeks as I am about to go on holiday in a few days.