monitor icon indicating copy to clipboard operation
monitor copied to clipboard

Dev python bluez

Open gadric opened this issue 5 years ago • 8 comments

readme.MD: instructions to install bluetooth, python-bluez package and python-setuptools. clone ewenchou/bluetooth-proximity repo and install the script.

A new file rssi.py added to get rssi of mobile devices

monitor.sh script adapted to python-bluez and the rssi.py script.

gadric avatar Feb 04 '20 11:02 gadric

I'll have to think on this. I understand the purpose, obviously, but one of the major advantages of this project is its small list of dependencies and its single-language source.

andrewjfreyer avatar Feb 10 '20 21:02 andrewjfreyer

I understand your hesitation and I also not 100% happy about involving another project/language.

However, as I read and referenced, hcitool is depreciated and no longer maintained. Sooner or later this tool needs to be replaced. I have thought about using bluetoothctl as another implementation. But I was never get it reliable.

Whatever you decide, I have been playing about with this python script and I found a version which is ported to python3 (Prime consideration was that python2 will be EOL this year). It works even better and I am testing this. If you decide to implement this solution let me know. I upload this new solution working with python3

gadric avatar Feb 10 '20 22:02 gadric

Thanks for the comment. I think the best solution is a complete re-write of monitor in a higher level language (or, being pedantic, an actual programming language) like python, but that's a task I'm likely unable to undertake in the near term.

andrewjfreyer avatar Feb 11 '20 14:02 andrewjfreyer

One thing I can do is to write an bash script, that automates the installation of monitor and the python stuff. Maybe that is a comprise?

gadric avatar Feb 13 '20 14:02 gadric

@gadric I’d help you do that in python, I like the direction you’re going in, maybe a fork of this repo would be a next step so @andrewjfreyer can keep this one as is and a parallel version in python to compliment his version

isaacewing avatar Mar 18 '20 15:03 isaacewing

And more, the new rssi.py script does not calculate the average, but the lowest rssi value. Was more precise.

gadric avatar Mar 18 '20 17:03 gadric

I've installed this, yesterday I had good results with it but today I still face the same (bluetoothctl:18044): GLib-CRITICAL **: Source ID 20 was not found when attempting to remove it error.

I'd also like to contribute but don't have a whole lot of experience.

Output of sudo bash monitor.sh:

> starting monitor.sh (v. 0.2.200)...
> removing web request caches

(bluetoothctl:20798): GLib-CRITICAL **: Source ID 20 was not found when attempting to remove it
> D8:5B:2A:8B:27:44 confidence topic: monitor/diningroom/jans7 (has not previously connected to hci0)
> 08:78:08:F2:59:ED confidence topic: monitor/diningroom/mirjams7 (has not previously connected to hci0)
[+] 0.2.200 23-04-2020 09:06:49 am [CMD-INFO]   cycling bluetooth hardware on hci0. please wait a moment...
[+] 0.2.200 23-04-2020 09:07:20 am [CMD-MQTT]   monitor/diningroom/jans7 { ... confidence : 0 ... }
[+] 0.2.200 23-04-2020 09:07:20 am [CMD-NAME]   D8:5B:2A:8B:27:44 JanS7  Samsung Electronics CoLtd
[+] 0.2.200 23-04-2020 09:07:30 am [CMD-MQTT]   monitor/diningroom/mirjams7 { ... confidence : 0 ... }
[+] 0.2.200 23-04-2020 09:07:30 am [CMD-NAME]   08:78:08:F2:59:ED MirjamS7  Samsung Electronics CoLtd

jlo88 avatar Apr 23 '20 06:04 jlo88

And more, the new rssi.py script does not calculate the average, but the lowest rssi value. Was more precise.

I found that the logic in use for rssi calculation was making an assumption about 0 values, which was the primary source of inaccuracy for me.

I've actually opened https://github.com/andrewjfreyer/monitor/pull/362 as a fix for that, which is a much lighter-weight change than this script - keeping an eye out for instability however.

peter-dolkens avatar Dec 30 '20 23:12 peter-dolkens