The error is definitely caused by its inability to import paho. There are two ways to install a python library, globally or for the specific user. You might be installing it as a specific user but sensorReporter is running as a different user and that user doesn’t have paho available.
If you are not going to use sensorReporter (I’d recommend reelyActive instead anyway) don’t worry about an issue. I think the problem is a configuration problem, not something I can fix in code anyway.
Make socat run in docker either by sharing device (not possible because socat use symlink). I tried with privileged to true to eliminate any isolated issue. I try to make run as a service. But exemple was given with Systemd which is a pain to make running in docker at least for me.
Let’s say I went to the docker machine and manually start socat with the necessary configuration. I tried to run the Bluetooth python tool to check it works. It is looking good. But then come openhab third party Bluetooth binding where I set the device path directly instead of general regex. But the adapter I manually add stay offline. I can share the log when back to my computer.
I am taking any advice, really interested to make raspberry pi gateway using ser2ner…
PS: Location exact is only a bonus. Main purpose is like the first post shared, to be able to have deported Bluetooth or zwave using raspberry pi.
If you want to run this inside Docker you are going to have to get good at building your own custom Docker images. If you are using the official OH dinner image you need to added installation of all the stuff you need and add starting the socat stuff to entrypoint.sh. Docker images, almost as a rule, do not include systemd or upstart.
I firmly believe that pretty much every other suggestion in this thread will be less work to get working than getting socat and the Bluetooth binding working in Docker.
But on openhab side with the third party bluetooth binding I get the following:
01:52:48.903 [WARN ] [er.transport.bluegiga.BluegigaHandler] - Timeout has happened while sending a transaction, retry one more time: BlueGigaEndProcedureCommand
01:52:58.904 [WARN ] [er.transport.bluegiga.BluegigaHandler] - Timeout has happened second time, giving up: BlueGigaEndProcedureCommand
01:52:58.931 [WARN ] [er.transport.bluegiga.BluegigaFactory] - Error occurred while creating a new adapter for port: /dev/ttyNET0, Could not initialize blugiga handler for port: /dev/ttyNET0
On the pi the netstat command gives
tcp6 233 0 192.168.178.84:3001 192.168.178.29:35734 ESTABLISHED -
reelActive has a central server and clients. Each client uses its own BT device and reports the signal strength of all the BT devices that it sees. The server looks at all the reports from all the clients and reports to OH which client has the strongest signal and therefore telling you which room the BT device is in. It solves EXACTLY your problem.
Similarly, sensorReporter is designed to run on more than one Raspberry Pi (or other computers) and report to OH when it can see a BT device. Slight modifications will let it report the RSSI (I’d even make the modifications for you). So sensorReporter nearly solves EXACTLY your problem, though determining which RPi the BT device is closest to will have to be done by Rules.
Somewhat differently, FIND triangulates the location of your phone based on the signal strength of all the wifi APs the phone can see. So this solves your problem, but uses wifi instead of BT.
There is no limitation to connecting to only one BT device in ANY of these solutions.
Just so you know guys @rlkoshak@clempat, the 3rd party bluetooth binding is supposed to do indoor positioning as well. It accumulates RSSI readings from all adapters and calculates shortest distance from bt device to installed adapters. Obviously you will need to have an adapter in each room.
Sorry I meant for exemple I have a Bluetooth temperature Sensor (Xiaomi). I would be interested to get the data from it instead of the signal and the presence. And for this reason I would need to use the Bluetooth binding solution.
@vkolotov As you are here. First thanks for the awesome work you did for the Bluetooth binding. Here is how I stand now:
I have a raspberry pi zero with ser2net exposing the serial I think is the built in Bluetooth.
I have a machine with docker and running socat and openhab. I made a custom image for that here: https://hub.docker.com/r/clempat/openhab-socat/
I see /dev/tryNET0 as said in my last message. Is the 3rd party Bluetooth integration a solution for me or I need to look somewhere else ?
hi @clempat, the internal bluetooth adapter is not serial port based device (unlike BlueGiga devices). You will have to use something different rather than ser2net, that allows you to create a virtual usb port over ip.