Good morning everyone,
I am trying openhab for the last couple day. The structure is interesting and clean. I have one limitation now.
I used to install a small piece of software on raspberry pi zero with my old controller which will create a deported Bluetooth device which will report the rssi and other informations to the main controller where by the way has no Bluetooth because I am not interested about the presence near it.
As far I could go I could find only SensorReport from @rlkoshak which looks like what I need. But I get errors saying for example something like mqttCon.mqttConnection is not compatible with the platform. I got other errors I fixed.
So here is my question. Is there any library easy to install and error prone and stable to achieve what I want to do ?
I want make any raspberry pi zero a deported Bluetooth device/antenna and use it in my main openhab. As well by improving the location of the device by triangulation using the rssi information.
Basically what I have currently is jeedom. If you speak French and search « antenne blea raspberry pi zero » you will find articles about which explains how to set it up with jeedom. I want to know if I can do it as easy with openhab.
I try my best to explain. So imagine I have 3 raspberry pi zero with Bluetooth and wifi. I put one in the kitchen, one in the living room and the third somewhere else. First they all can see each other and so can approximate their location using rssi. My Nut can be detected by any of those raspberry pi zero and same I can approximate his position with rssi against each one. I don’t want those raspberry pi to have more logic than sending the information to openhab where I manage the automations. Does it sounds stupid ?
Either of those should allow you to achieve what you want to achieve. Find3’s goal is to work out which room or area a person/object is in via triangulation with the combination of signal strength bluetooth and wifi MACs. I think ReelyActive is more focused on generic presence i.e. which bluetooth MACs can I detect in my area.
Either way you’d need to run their nodes (your Raspberry Pi Zeros) and servers (maybe your OH box) but as there is no native binding for these you would probably have to write a script to query their API.
Thanks for all your answer. I will explore those solution. I really though it is a common case to do such a thing. Anyway I will do by step… Maybe first any presence near one of those node and then better location.
There is a Bluetooth binding but I don’t know how mature it is.
Have you reported the error on github (I haven’t looked at my email this morning). I can’t fix or help with problems if I don’t know they exist.
Did you install the prerequisites? In particular the MQTT connection would only report an error along those lines if you haven’t installed Paho.
From the readme
MQTT depends on the Paho library.
Have you looked at reelyActive Smart Spaces Revisited which will probably give you better results anyway? This system is designed to solve exactly this problem and the post I linked to shows how to integrate it with OH over MQTT.
Actually it will report which client the BT device is closest to and report as it moves around. The drawback is if you are trying to track a specific iPhone and some Android phones it doesn’t work because these phones spoof their BT MAC address and change them frequently so all you can really know is that AN iPhone is near a given sensor, not that a specific iPhone is near that sensor.
Honestly, I think most of us come to the realization that the benefits are not worth the effort to get it to work. Many of us also reject the requirement of having our home automation depend on the physical presence of some device on our persons at all time. Personally, I’m mostly concerned in knowing that a phone is on the premises which is a good indication that that person is home. Knowing which room the device is in might be useful only in finding where I misplaced my phone, not to drive the actual home automation.
Thanks for all your work. I did not open an issue because I felt it was me having issues because of my Python knowledge. It happen to me every time I try to use a Python library, I think I spend 80% to understand how to get the right lib and where. I still can open an issue if you wish.
2018-06-20 22:59:48,057 ERROR - mqttConn.mqttConnection is not supported on this platform
Jun 21 15:05:28 blea sensorReporter.py: Traceback (most recent call last):
Jun 21 15:05:28 blea sensorReporter.py: File "/opt/sensorReporter/sensorReporter.py", line 230, in <module>
Jun 21 15:05:28 blea sensorReporter.py: main()
Jun 21 15:05:28 blea sensorReporter.py: File "/opt/sensorReporter/sensorReporter.py", line 71, in main
Jun 21 15:05:28 blea sensorReporter.py: loadConfig(sys.argv)
Jun 21 15:05:28 blea sensorReporter.py: File "/opt/sensorReporter/sensorReporter.py", line 222, in loadConfig
Jun 21 15:05:28 blea sensorReporter.py: sensors[section] = createDevice(config, section)
Jun 21 15:05:28 blea sensorReporter.py: File "/opt/sensorReporter/sensorReporter.py", line 164, in createDevice
Jun 21 15:05:28 blea sensorReporter.py: devConns.append(connections[connStr])
Jun 21 15:05:28 blea sensorReporter.py: KeyError: 'MQTT'
So since this morning I first try what suggested Dibbler42 at the beginning. I have now in my docker container a /dev/ttyNET0 without garantie it is working. I have as well the 3rd Party Bluetooth Binding which I configured with direct regex (/dev/ttyNET0) I add an Adaptor as Thing but this last one stay offline.
I have some errors I need to check or directly try the reelyActive solution.
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 -