Zwave and Bluetooth Blugiga (marketbinding) not working together

Tags: #<Tag:0x00007f61716b2c48> #<Tag:0x00007f61716b2b30> #<Tag:0x00007f61716b2748>

Hi Everyone,

i have found a problem while working with zwawe @chris and the bluetooth binding from @vkolotov.

First i had a problem with zwae and i reinstalled it, but my serial ports were not shown. remebering that there where some rumors about the bluetooth binding and deinstalled it.

Thats what i have found.

ZWave Bindings installed; Bluetooth Binding, TinyB and BlueGiga not installed

-> Zwave shows all my serial ports and i can select /dev/ttyACM0 and see /dev/ttyNET1; /dev/ttyNET4

ZWave Bindings installed; Bluetooth Binding installed

-> Zwave shows all my serial ports and i can select /dev/ttyACM0 and see /dev/ttyNET1; /dev/ttyNET4

ZWave Bindings installed; Bluetooth Binding, TinyB installed

-> Zwave shows all my serial ports and i can select /dev/ttyACM0 and see /dev/ttyNET1; /dev/ttyNET4
-> Bluetooth is working with TinyB USB Adapters

ZWave Bindings installed; Bluetooth Binding, TinyB, BlueGiga installed

-> Zwave shows only /dev/ttyNET4 and is not working reliable
-> Bluetooth is working with TinyB USB Adapters and BlueGiga Serial Ports /dev/ttyNET1; /dev/ttyNET4

I would be happy to file an issue, but where is the problem? On the zwave or on the Bluetooth side?

Thanks

Probably neither. I suspect that this is not a binding issue - the bindings are working through a serial driver - they just reference the ports that are specified in the configuration. If there is a problem with the ports, and interaction between them, then I don’t think that the bindings can influence this.

Maybe I’m wrong, but I can’t currently think how the bindings can change anything.

Someone has reported that there was an issues with his virtualization environment. Are you running your OH in a container (VMWare, VirtualBox, Docker)?

Yes, but i ran it before on a raspberry and had the same problems

I’m quite serious, someone on my thread reported that his vertualization environment steals/confuse serial ports, he switched back to host and looks like it was resolved.

OK, i will check that during the xmas holidays

Hi Thomas,
I do have the same situation here in combination of Bluegiga transport and Zigbee (not zwave).
@vkolotov has filed an issue about it:

I circumvent the issue currently by starting Zigbee first and then installing the Bluetooth binding.
Well - quite ugly. But I haven’t found any other solution so far…

It was me :wink:

FTR: This is the post in which I describe the issue on my side:

Yes, it seems like this. But maybe by chance the serial ports had a different order on the bare metal system and/or the bindings started in a “better” order.

Back on the ESXi, the issue re-appeared instantly.

1 Like

Unfortunately i have no zigbee so that i cannot check if the same problem occurs between zigbee and zwave.

In addition i am not aware of the mechanism to get a list of serial ports and then select one.

I’ve tried with both: zwave controller and/or zigbee coordinator in combination with Bluegiga/Bluetooth.

Could you de-install the (yet configured) Bluetooth binding and the Bluegiga transport.
Then restart openhab and let the zwave open it’s serial port.

Then re-install Bluetooth and Bluegiga (it is still configured and should work instantly).

Check, if this more reliable than before?

What was the result with zwave and zigbee without bluegiga?

I will check that

It is working, but i did not see the zwave network in Habmin and all Battery devices ar in the Request_NIF state after a restart. I quit for today

IIRC, both have worked as expected as long as the Bluegiga transport was’nt enabled.
Unfortunately, I can’t re-check this right now.

I did some more testing this morning:

  1. removed the (virtual) USB-ports from the openHAB VM
  2. re-added in a different order (first zigbee, then the Bluegigas)
  3. re-startet openHAB
  4. rebooted whole VM

After Step #3, I have all four serial adapters running. But after reboot (Step #4) is zigbee missing it’s adapter again.

So the most promising way to get all the serial adapters accessible from the different bindings at the same time is:

  1. de-install Bluetooth and Bluegiga.
  2. restart openHAB and let the other bindings open their respective serial adaptor
  3. install Bluetooth and Bluegiga (using the yet-existing configuration)

Well, this is just a workaround and not suitable for “daily operation”.

@vkolotov: May I ask you to provide some option for a “delayed start” of the Bluegiga transport? As long as we don’t really understand the root cause of the issue, this might be a way of mitigating the hurt for now…

From the user point of view the main difference ist that zwaver presents a drop down list to select a serail port and the bluetooth binding selects the serial ports using a regex. So both binding need to read all available ports.

Currently i am setting up a new Raspi 3 and see what come. Maybe i try to understand the code for selecting the ports

1 Like

Just had another thought:

When we are running openHAB in a VM, we are on a much more powerful system than when we are testing on SBC’s (Raspberry Pi etc.).

So the question is:
When (in time) do the bindings collect the available serial ports? Is it during start of the binding or when we open the configuration dialog in PaperUI?

In the first case ALL bindings could ask the same bundle/library at almost the very same point in time especially on very fast hardware. If the specific library/function (“give me all available serial ports”) is not safe for beeing called reentrantly - this might cause the odd/incomplete output.

Have to admit: I’m not a developer and I do not understand how the underlaying libs are working. So please be tolerant with me if this complete nonsense :wink:

I just moved from a vm to a raspi, now i am setting up everything. maybe tomorrow i am able to check if thing are happen on the raspi as in the VM

I did another test: I’ve moved the usb/serial dongles from the ESXi to a separate system (tiny SBC with Armbian Stretch). This guy runs ser2net to provide remote access to the four serial ports which I currently have in this test setup (three Bluegiga’s and one Zigbee CC2531).

In the openHAB VM on the ESXi I’ve startet a couple of socat’s to provide local serial ports as /dev/something* which in is in turn redirected to the remote SBC running ser2net. So it’s now a typical socat/ser2net setup

Surprisingly, this setup shows almost the same behaviour as with the “virtual” local USB ports on the ESXi host: When I start the configuration page for the Zigbee coordinator, just one single serial port is listed (instead of four existing ports). Same as Thomas had with the Zwave and I had with my former tests on the ESXi with locally attached USB2Serial dongles. So I still cannot configure the Zigbee stuff while the Bluetooth binding(Bluegiga transport is running because the right dongle is just not listed. :frowning:

BUT: Once configured (e.g. while Bluetooth was deinstalled) the Bindings can open all their respective ports. That’s different to the local setup. Both Bindings are happy with their dongles now. I can restart openHAB and the Bindings initialize well again.

So beside the configuration quirk, this could work for me.

Nevertheless, there is some oddity in some used serial library, some timing and/or reentrance issue etc. which is worth to look after. :slight_smile:

Ok, now i moved from my VM to a Raspberry pi 3. And get the same behavior. Without bluegiga all serial ports are shown in zwave binding. The after installing the blugiga binding only one port is show, but this port ist not the zwave port. Uninstalling bluegiga does not change anything, but after a restart all ports ar shown for zwave.

So i would say that that has definitly has nothing to do with a VM :triumph: by the way i do not use ESX for virtualisation i use the Synology virtualisation

Wow. That’s interesting. Thank’s for checking!

And: Have you checked the behaviour when

  1. Zwave controller has been configured to use it’s port (while Bluetooth/Blugiga is removed)
  2. installing Bluetooth/Blugiga and configure it too
  3. restart openHAB

Are both bindings able to open all their ports or is zwave unable to open the controller?