Xbee S2C - zigbee hardware install

Dear Community,

Are there anyone out there with succesfull installation of Xbee S2C to Raspberry 4, Openhabian system? I’m using this USB adapter, and Xbee radio:

What I’ve already tried:

The thing is visible, but with constant change of “device unknown” and “device offline”.

If you have any succes before, please let me know and discuss some useful steps.

Thank you!

Some misbehaving USB2 devices need to be connected to a USB3 port through a powered USB2 hub.

Thank you for your suggestion Bruce!
Tried again with a HUB in between, but unfortunatelly it is still between offline and initialising state.

Let me try and put the log here:

2020-05-06 15:43:29.916 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Scheduling ZigBee start

2020-05-06 15:43:30.921 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee network starting

2020-05-06 15:43:30.922 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising ZigBee coordinator

2020-05-06 15:43:31.017 [DEBUG] [ding.zigbee.internal.ZigBeeDataStore] - Creating ZigBee persistence folder /var/lib/openhab2/zigbee/zigbee_coordinator_xbee_d66af542/

2020-05-06 15:43:31.022 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=INITIALISING

2020-05-06 15:43:31.022 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Connecting to serial port [/dev/ttyUSB0] at 9600 baud, flow control FLOWCONTROL_OUT_RTSCTS.

2020-05-06 15:43:31.061 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port [/dev/ttyUSB0] is initialized.

2020-05-06 15:44:02.678 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=OFFLINE

==> /var/log/openhab2/events.log <==

2020-05-06 15:44:02.684 [hingStatusInfoChangedEvent] - ‘zigbee:coordinator_xbee:d66af542’ changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR)

==> /var/log/openhab2/openhab.log <==

2020-05-06 15:44:02.680 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:

java.lang.NullPointerException: null

at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.initialiseZigBee(ZigBeeCoordinatorHandler.java:425) ~[?:?]

at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.lambda$2(ZigBeeCoordinatorHandler.java:543) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

2020-05-06 15:44:03.687 [INFO ] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee dongle inactivity timer. Reinitializing ZigBee

2020-05-06 15:44:03.692 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=SHUTDOWN

2020-05-06 15:44:03.777 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port ‘/dev/ttyUSB0’ closed.

2020-05-06 15:44:03.780 [DEBUG] [ding.zigbee.xbee.handler.XBeeHandler] - Initializing ZigBee XBee serial bridge handler.

2020-05-06 15:44:03.783 [DEBUG] [ding.zigbee.xbee.handler.XBeeHandler] - ZigBee XBee Coordinator opening Port:’/dev/ttyUSB0’ PAN:c699, EPAN:870FFDAB426E2948, Channel:11

2020-05-06 15:44:03.786 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Scheduling ZigBee start

Does this give you more meaning than to me?

Thank you!

Not to me. Perhaps the Zigbee log viewer can help.

https://www.cd-jackson.com/index.php/openhab/zigbee-log-viewer

I’ve tried to add logs but I’ve got no result back from the homepage. However, I’m not sure I’ve attached the right one. I’ve tried openhab log and just the zigbee errors in a seperate .txt file. None of them worked so far.

On a side note, I’m not sure that there are even zigbee logs generated, as the cordinator device is not yet online.

Any thoughts?

From the log above, you are generating log files, however probably full logging isn’t enabled. Take a look at the binding docs as this explains how to enable additional logging.

It looks like there is no data being received from the S2 device. I know a number of people use these devices, so this should work fine. I’ve personally not tested it for a long time though.

As per the log above, they are being generated. The logs will help to find out why it’s not online.

I don’t see any log attached, or any link to the log here. I’m not sure what “homepage” you mean?

That is very good news to begin with! :slight_smile:

I have enabled additional logging, now it has extended details, I hope this is what you meant.
I’m trying to upload to zigbee-log-viewer homepage (linked by Bruce), but there is no result from there.

Let me paste it here instead:

2020-05-07 17:41:36.973 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee network starting

2020-05-07 17:41:36.975 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising ZigBee coordinator

2020-05-07 17:41:36.977 [DEBUG] [e.transaction.ZigBeeTransactionQueue] - Default: Set profile to ZigBeeTransactionProfile [maxOutstandingTransactions=2, interTransactionDelay=50, maxRetries=2]

2020-05-07 17:41:36.979 [DEBUG] [e.transaction.ZigBeeTransactionQueue] - Broadcast: Set profile to ZigBeeTransactionProfile [maxOutstandingTransactions=3, interTransactionDelay=1200, maxRetries=0]

2020-05-07 17:41:36.980 [DEBUG] [e.transaction.ZigBeeTransactionQueue] - Multicast: Set profile to ZigBeeTransactionProfile [maxOutstandingTransactions=3, interTransactionDelay=1200, maxRetries=0]

2020-05-07 17:41:36.982 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - ZigBeeNetworkManager initialize: networkState=UNINITIALISED

2020-05-07 17:41:36.984 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - Network state is updated to INITIALISING

2020-05-07 17:41:36.986 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle initialize.

2020-05-07 17:41:36.986 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=INITIALISING

2020-05-07 17:41:36.987 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Connecting to serial port [/dev/ttyUSB0] at 9600 baud, flow control FLOWCONTROL_OUT_RTSCTS.

2020-05-07 17:41:37.021 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port [/dev/ttyUSB0] is initialized.

2020-05-07 17:41:37.022 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler clearing receive buffer.

2020-05-07 17:41:37.124 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler cleared receive buffer.

2020-05-07 17:41:37.126 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset 1.

2020-05-07 17:41:37.126 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler thread started

2020-05-07 17:41:37.128 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE queue: 1: XBeeSetSoftwareResetCommand [frameId=1]

2020-05-07 17:41:37.129 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE: XBeeSetSoftwareResetCommand [frameId=1]

2020-05-07 17:41:37.131 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE Data: 00 04 08 01 46 52 5E

2020-05-07 17:41:37.628 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in sendRequest XBeeSetSoftwareResetCommand [frameId=1]

2020-05-07 17:41:47.132 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBEE Timer: Timeout

2020-05-07 17:41:47.630 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in eventWait class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:41:47.632 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset 2.

2020-05-07 17:41:47.633 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE queue: 1: XBeeSetSoftwareResetCommand [frameId=2]

2020-05-07 17:41:47.633 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in waitEventAsync class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:41:47.635 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE: XBeeSetSoftwareResetCommand [frameId=2]

2020-05-07 17:41:47.637 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE Data: 00 04 08 02 46 52 5D

2020-05-07 17:41:48.133 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in sendRequest XBeeSetSoftwareResetCommand [frameId=2]

2020-05-07 17:41:57.639 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBEE Timer: Timeout

2020-05-07 17:41:58.136 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in eventWait class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:41:58.137 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset 3.

2020-05-07 17:41:58.138 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in waitEventAsync class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:41:58.139 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE queue: 1: XBeeSetSoftwareResetCommand [frameId=3]

2020-05-07 17:41:58.142 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE: XBeeSetSoftwareResetCommand [frameId=3]

2020-05-07 17:41:58.146 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE Data: 00 04 08 03 46 52 5C

2020-05-07 17:41:58.639 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in sendRequest XBeeSetSoftwareResetCommand [frameId=3]

2020-05-07 17:42:08.148 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBEE Timer: Timeout

2020-05-07 17:42:08.643 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in eventWait class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:42:08.644 [INFO ] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset failed after 4 tries.

2020-05-07 17:42:08.646 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in waitEventAsync class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

2020-05-07 17:42:08.647 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - Network state is updated to OFFLINE

2020-05-07 17:42:08.649 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=OFFLINE

2020-05-07 17:42:08.649 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:

java.lang.NullPointerException: null

at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.initialiseZigBee(ZigBeeCoordinatorHandler.java:425) ~[?:?]

at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.lambda$2(ZigBeeCoordinatorHandler.java:543) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

==> /var/log/openhab2/events.log <==

2020-05-07 17:42:08.657 [hingStatusInfoChangedEvent] - ‘zigbee:coordinator_xbee:d66af542’ changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR)

Does this provide any useful output?

It’s very very difficult to process your log due to the way you paste it in. Please either use code fences, or format using the </> button, or simply attach the log, or upload the log somewhere like dropbox and provide the link.

Anyway, from what I can see the S2 is not responding - I can see the library send a command, but there is no response. Are you sure that the serial port is correctly set, and that speed etc is correct?

I’m glad to share with you that I could make it work finally.
Let me explain:

  • under Windows, I’ve updated the firmware and changed the radio to Coordinator mode (default: router) for this, I have used XCTU software from DIGI

  • removed the USB bridge, directly connected the USB adapter to the USB2 port of PI4

  • It went online, and works with things and items in Paper UI

(Previously I’ve installed the script from 5iver.)

Thank you for your support and guidance.

Glad you have it working.

Just for the benefit of others stumbling across this, the binding will automatically do this, so possibly the issue was the USB port, or possibly the firmware.

1 Like

Hi Maligen,

Glad to hear you made it work. I ran into the same issue. What version of firmware are you using on your XBEE? also, is it Zigbee or 802.15.4 mode?

Thanks,

David

You need to use ZigBee firmware - not 802.15.4.

Thanks Chris.

My setup is similar Malingen’s:

RBPi 3+
OpenHab installed on raspbian lite
XBee Pro S2C setup as coordinator / Zigbee FW latest version 4061
XBee mounted on USB explorer board
I am using the Zigbee binding 2.5.5 that comes stock in OpenHab paper UI

However, it still doesn’t work. the logs look identical to the ones Malingen reported.

is zigbee binding manual installation better than the one comes as stock in OpenHab?

thanks,

David

It will be exactly the same if you are using 2.5.5.

so i have fixed openhab permissions by adding the account to the dialout group. Still no luck. I went further and tried a couple things:

1 - I put a powered USB 3 hub in between to make sure there is enough power feeding the XBEE explorer. No luck, same results.

2 - I checked communications with XBEE via screen command (i.e. # screen /dev/ttyUSB0 9600). I get a prompt on the screen and it seems i can issue ATT commands.

but no matter what i cannot get openhab to interact with XBEE.

When i look at the logs i keep getting these messages over and over:

2020-05-24 10:14:59.161 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle initialize.

2020-05-24 10:14:59.161 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - null: networkStateUpdated called with state=INITIALISING

2020-05-24 10:14:59.163 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Connecting to serial port [/dev/ttyUSB0] at 9600 baud, flow control FLOWCONTROL_OUT_RTSCTS.

2020-05-24 10:14:59.236 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port [/dev/ttyUSB0] is initialized.

2020-05-24 10:14:59.238 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler clearing receive buffer.

2020-05-24 10:14:59.341 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler cleared receive buffer.

2020-05-24 10:14:59.343 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset 1.

Any suggestions anyone?

Thanks in advance. Clearly i am a newbie at this.

Hello There,

Providing another update. I was able to further analyze the problem and I starting to see what’s happening. I enabled the debug logging for this zigbee binding.

1 - Serial port gets initialized as follows:

*2020-05-26 12:34:40.955 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Connecting to serial port [/dev/ttyUSB0] at 9600 baud, flow control FLOWCONTROL_OUT_RTSCTS.*

*2020-05-26 12:34:40.983 [DEBUG] [ding.zigbee.handler.ZigBeeSerialPort] - Serial port [/dev/ttyUSB0] is initialized.*

*2020-05-26 12:34:40.986 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler clearing receive buffer.*
*2020-05-26 12:34:41.088 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler cleared receive buffer.*

2 - A sequence of commands from system to XBEE are TX but interrupted and timed out every time and no RX from XBEE:

2020-05-26 12:34:41.091 [DEBUG] [.zigbee.dongle.xbee.ZigBeeDongleXBee] - XBee dongle reset 1.

2020-05-26 12:34:41.091 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBeeFrameHandler thread started

2020-05-26 12:34:41.095 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE: XBeeSetSoftwareResetCommand [frameId=1]

2020-05-26 12:34:41.094 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE queue: 1: XBeeSetSoftwareResetCommand [frameId=1]

2020-05-26 12:34:41.100 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE Data: 00 04 08 01 46 52 5E

2020-05-26 12:34:41.594 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in sendRequest XBeeSetSoftwareResetCommand [frameId=1]

2020-05-26 12:34:51.103 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBEE Timer: Timeout

2020-05-26 12:34:51.598 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - XBee interrupted in eventWait class com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeModemStatusEvent

This leads me to believe the serial port is not communicating properly or the zigbee binding is tripping itself.

I checked the XBEE communication of serial port USB0 using screen command as follows:

#screen /dev/ttyUSB0 9600

I get:

>-Resetersion

not sure what that means but it is obviously communicating.

According to this link from Digi this prompt means the serial port is not fully released or not sending full API frames.

https://www.digi.com/support/forum/56910/xbee-resetersion

And that means the XBEE is in bootload mode. This is caused by then initialization process which I suppose it is caused by some sort of missing step on the zigbee binding?

Chris, is there anything I should be checking? I am running out of ideas.

Thanks,

David

Hi David,

I can not recall the version, since I have just downloaded the latest with the XCTU software of Digi.
I recommend you change the radio to coordinator mode with the XCTU software first, and then try the steps with the script of 5iver. That made the trick for me.

Thanks Maligen,

I’ve tried all those things but no success.

What I have further done is adding below line to start.sh in folder openhab2-sys.
I’m not sure what it does, but I have read it in other threads.

export EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1:/dev/ttyS0:/dev/ttyS1:/tmp/virtualcom0"

Of course you should replace with your own serial ports.

I am happy to report my XBEE S2C is finally recognized as a thing in my openhab setup.

One thing I changed it was the serial interface to API mode. By default is disabled or in transparent mode.

Here are some details from Digi: https://www.digi.com/resources/documentation/Digidocs/90001506/reference/r_cmd_ap.htm?tocpath=AT%20commands|Serial%20interfacing%20commands|_____5

I obviously did this via CLI (through screen in raspbian shell) but it can also be done via XCTU.

Malingen, i also added the serial port export command for Java as you indicated. Just for clarification it was done in two places:

1 - start.sh located in /srv/openhab2-sys/
2 - openhab2 file in /etc/default

Thanks everyone. now, to play with a CREE light. See how far I get before I get stuck again.

Cheers!

2 Likes