We have an MightyGecko Zigbee dongle placed in our iMX6DL board. I needs to bind that dongle to OpenHAB via Zigbee binding.
Here’s what I have done so far.
I downloaded OpenHAB stable runtime zip file from https://www.openhab.org/download/ and unzipped it in /media/openhab-2.5.5 directory.
Then I added user openhab with following command useradd --system --no-create-home --shell /usr/sbin/nologin openhab
Then added user openhab to tty and dialout groups with following command usermod -a -G dialout,tty openhab
I execute below command to make openhab directory belongs to openhab user chown -hR openhab:openhab /media/openhab-2.5.5
Then I launched OpenHAB with following command su -s /bin/bash -c ‘/media/openhab-2.5.5/start.sh’ openhab
Zigbee Dongle will be detected in board at /dev/ttymxc4
So I manually created /etc/default/openhab2 file and added following line in the file EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttymxc4"
Then I tried to add zigbee dongle manually as a thing via Zigbee Binding -> Ember EM35x Coordinator
I got below error log in openhab.log.
2020-07-06 11:12:02.970 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - EZSP Dongle: Unable to open serial port
2020-07-06 11:12:02.988 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
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_252]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
2020-07-06 11:12:03.996 [INFO ] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee dongle inactivity timer. Reinitializing ZigBee
I am doubting there might be some permission issues causing this error. Can someone help me solve this issue.
To make sure that this environment variable is being used you need to start the openhab instance after modifying the file. You may have done it but it is not part of the steps you listed.
Also I am wondering why the file /etc/default/openhab2 was not already there. Please check if the file is being called/sourced fromthe startup routine. If that is not the case then the environment variable will not be set and not be used.
I think according to OpenHAB document, there is no equivalent file for Manual Installation. I can’t do package installation in my board. So I created manually. and I run the application after adding that file.
To make sure that environment variable is set, I manually exported that environment variable.
What document did you follow for installation?
We need all this information in order to properly help you. You know how you set up your system ans what steps you tried. We do not know unless to decide to tell us.
Ok, according to your answer the environment variable is set for the user root.
Does this mean your system sources /etc/default/openhab2 for all users ?
openhab service runs as user openhab is the environment variable also available for that user ?
This is why I asked if /etc/default/openhab2 is being sourced from the startup routine.
Alternativley I would like to ask you to open a karaf console and check if gnu.io.rxtx.SerialPorts is set.
So login to karaf console and execute the command:
IF that is in the openHAB config file you may not see it there. We know /etc/default/openhab2 is not the proper place according to the documentation. That is why it did not exist.
I highlighted the incorrect item. I see there is no default preconfiguraiton for that type of install.
I prefer installing the openHABian scripts for a debian based Linux install. It preconfigures many of these things for you.
I am getting same “unable to open serial port” error only.
Edit: This morning I launch openhab by following command with environment variable set. And its connected. /media/openhab-2.5.5/start.sh
Will do further tests and update.