Page 3 of 3
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Saturday 27 January 2018 12:48
by chrispazz
latest beta is working again.
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Friday 17 August 2018 13:33
by rockyt
I have bought a bunch of nut3 for every member of my family. I would like to use the plugin with the stable v4.97 version. The nut3 are correctly detected but I got an error when checking battery
After running “sudo ./ble_scanner.py” when battery is checked I got
INFO - start battery check xx:xx:xx:xx:xx:xx
ERROR - battery service: LE connect error [xx:xx:xx:xx:xx:xx] [Could not create connection: Connection timed out
Config.ini is
[Settings]
; Use different scanner_name if you have several instances for better debugging
scanner_name=Allarme
; By default hci0 in RPI3, but you can check with "hciconfig" command
bt_interface=hci0
; Domoticz IP and UDP port where plugin runs
server_ip=127.0.0.1
server_port=2221
; Check battery if signal strength >= setting
; Connection will not be established if signal is very low
battery_check_rssi_threshold=-75
; Time to check battery. 24h. Interval check_time + 30min
battery_check_time=03:00
; Attempts to check in time interval when beacon available
battery_check_attempts=2
; Beacon MAC address
[xx:xx:xx:xx:xx:xx]
; For better debug
label=Guido
; Supports battery check for nut3 and miband2
; Can be empty (battery check disabled)
battery_service_type=nut3
; Signal strength threshold,
; When signal lower the setting -> beacon info will not send to the plugin
; Can be empty (threshold disabled)
rssi_threshold=
I also wonder how the battery level is copied to Domoticz. Should I add a variable?
Any help would be appreciated
Thanks
Guido
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Saturday 01 September 2018 20:37
by Grinders
Hey. I installed everything according to the instructions. When I run sudo ./ble_scanner.py finds my tags. But in Domoticz with the switches nothing happens.
In the bootloader ble_scanner also does not fall.
In the Domoticz logs only the following message character:
Code: Select all
2018-09-01 21: 33: 30.461 (Bluetooth Beacon Presence) Pushing 'onHeartbeatCallback' on to queue
2018-09-01 21: 33: 30.466 (Bluetooth Beacon Presence) Processing 'onHeartbeatCallback' message
2018-09-01 21: 33: 30.466 (Bluetooth Beacon Presence) Calling message handler 'onHeartbeat'.
2018-09-01 21: 33: 32.462 (Bluetooth Beacon Presence) Pushing 'onHeartbeatCallback' on to queue
2018-09-01 21: 33: 32.471 (Bluetooth Beacon Presence) Processing 'onHeartbeatCallback' message
2018-09-01 21: 33: 32.471 (Bluetooth Beacon Presence) Calling message handler 'onHeartbeat'.
2018-09-01 21: 33: 34.462 (Bluetooth Beacon Presence) Pushing 'onHeartbeatCallback' on to queue
2018-09-01 21: 33: 34.475 (Bluetooth Beacon Presence) Processing 'onHeartbeatCallback' message
2018-09-01 21: 33: 34.475 (Bluetooth Beacon Presence) Calling message handler 'onHeartbeat'.
2018-09-01 21: 33: 36.463 (Bluetooth Beacon Presence) Pushing 'onHeartbeatCallback' on to queue
2018-09-01 21: 33: 36.480 (Bluetooth Beacon Presence) Processing 'onHeartbeatCallback' message
2018-09-01 21: 33: 36.481 (Bluetooth Beacon Presence) Calling message handler 'onHeartbeat'.
Domoticz version 4.9957
Tell me what could be the problem.
Thank you!!!
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Monday 03 September 2018 10:06
by Holland
The moment I start the ble_scanner, domoticz crashes.
See below.
Anyone encountered that problem also?
2018-09-03 10:00:13.813 Error: Domoticz(pid:4679, tid:4706('PluginMgr_IO')) received fatal signal 11 (Segmentation fault)
2018-09-03 10:00:13.813 Error: siginfo address=0x15, address=0x7617d044
I also noticed that Domoticz crashes, the moment anything is adjusted within the hardware setting of the plugin.
Version: 4.9980
Build Hash: 291b22ab
Compile Date: 2018-09-02 17:46:27
dzVents Version: 2.4.7
Python Version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170124]
I opened an issue at github:
https://github.com/mrin/domoticz-bt-presence/issues/5
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Monday 03 September 2018 14:07
by Grinders
At me as it was found out a problem with Domotikz not only with this plugin, but also with a script from this branch
viewtopic.php?f=28&t=10640&p=190282#p190282
Those. as soon as the search for bluetooth tags begins, Domoticz immediately begins to behave inadequately.
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Monday 03 September 2018 19:16
by Holland
@Grinders
Thanks for the link.
I tested it with multiple setups on different raspberry machines, but the moment the ble scanner starts and sends the first packet to the raspberry with the plugin running, domoticz crashes.
A question, is it possible to change anything within the plugin, or does it crash also in your setup? The moment I change something, (e.g ip address), domoticz crashes.
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Wednesday 05 September 2018 15:15
by Ascari
Hello,
I try with new rpi 3b+ but not working.
I use the other methode before but I like your layout and more WAF.
I work with the last stable domoticz and I don't see the puglin in my hardware list.
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Wednesday 05 September 2018 15:39
by Holland
@Ascari
Check your log when Domoticz starts. Likely you will see an error that the libpython3.x library is not installed.
Check the following threat;
http://www.domoticz.com/forum/viewtopic ... 2&start=20
Install per;
Code: Select all
sudo apt-get install libpython3.5-dev
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Wednesday 05 September 2018 18:55
by Ascari
@Holland
Thx now I see the plugin in my hardware.
The port is ok 2221 with netstat -a but I don't have update.
My logs
- Spoiler: show
- 2018-09-05 16:54:29.577 (Test Beacon) Calling message handler 'onHeartbeat'.
2018-09-05 16:54:31.543 (Test Beacon) Pushing 'onHeartbeatCallback' on to queue
2018-09-05 16:54:31.581 (Test Beacon) Processing 'onHeartbeatCallback' message
2018-09-05 16:54:31.581 (Test Beacon) Calling message handler 'onHeartbeat'.
2018-09-05 16:54:33.543 (Test Beacon) Pushing 'onHeartbeatCallback' on to queue
2018-09-05 16:54:33.585 (Test Beacon) Processing 'onHeartbeatCallback' message
2018-09-05 16:54:33.585 (Test Beacon) Calling message handler 'onHeartbeat'.
2018-09-05 16:54:35.544 (Test Beacon) Pushing 'onHeartbeatCallback' on to queue
2018-09-05 16:54:35.589 (Test Beacon) Processing 'onHeartbeatCallback' message
2018-09-05 16:54:35.589 (Test Beacon) Calling message handler 'onHeartbeat'.
2018-09-05 16:54:37.544 (Test Beacon) Pushing 'onHeartbeatCallback' on to queue
2018-09-05 16:54:37.593 (Test Beacon) Processing 'onHeartbeatCallback' message
2018-09-05 16:54:37.593 (Test Beacon) Calling message handler 'onHeartbeat'.
2018-09-05 16:54:39.545 (Test Beacon) Pushing 'onHeartbeatCallback' on to queue
2018-09-05 16:54:39.547 (Test Beacon) Processing 'onHeartbeatCallback' message
2018-09-05 16:54:39.547 (Test Beacon) Calling message handler 'onHeartbeat'.
Wait but not more info :
pi@raspberrypi:~/domoticz/plugins/bt-presence $ sudo ./ble_scanner.py
2018-09-05 16:58:33 - INFO - Ok hci0 interface Up n running !
2018-09-05 16:58:34 - DEBUG - new bt socket
2018-09-05 16:58:34 - DEBUG - Connected to bluetooth device hci0
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Wednesday 05 September 2018 21:30
by Holland
Assuming you have BlueZ 5.43 installed, please try to compile BlueZ 5.50. I have it running, and my scanner is working fine. But that is only the scanner part, my plugin still crashes, the moment it receives the first scanner packages. I'm still working on that to get it resolved.
Code: Select all
2018-09-05 21:24:44 - INFO - Ok hci0 interface Up n running !
2018-09-05 21:24:45 - DEBUG - new bt socket
2018-09-05 21:24:45 - DEBUG - Connected to bluetooth device hci0
2018-09-05 21:24:49 - INFO - dd:48:14:dc:44:68 RSSI -86 - key tag
2018-09-05 21:24:53 - INFO - dd:48:14:dc:44:68 RSSI -87 - key tag
2018-09-05 21:24:56 - INFO - dd:48:14:dc:44:68 RSSI -81 - key tag
2018-09-05 21:25:00 - INFO - dd:48:14:dc:44:68 RSSI -87 - key tag
etc
See below the compile steps
Code: Select all
sudo systemctl stop bluetooth
sudo apt-get update
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
# latest http://www.bluez.org/download/ (User Space Package)
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
tar xf bluez-5.50.tar.xz
cd bluez-5.50
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library
make
sudo make install
sudo ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin/
sudo install -v -dm755 /etc/bluetooth
sudo install -v -m644 src/main.conf /etc/bluetooth/main.conf
sudo systemctl daemon-reload
sudo systemctl start bluetooth
bluetoothd --version
# should now print 5.50
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Thursday 06 September 2018 13:58
by Holland
Update.
I'm a few steps further on, as the crash problem has been resolved for now.
I removed the whole domoticz directory, and reinstalled the stable version (4.9700) of domoticz.
Version: 4.9700
Build Hash: a3a45906
Compile Date: 2018-06-23 16:24:51
dzVents Version: 2.4.6
Python Version: 3.4.4 (default, Apr 17 2016, 16:02:33) [GCC 5.3.1 20160409]
Uptime: 15 Hours, 30 seconds
The Bluetooth Beacon Presence Detection plugin is running as expected, and the switch responds to the scanner.
Now further testing
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Thursday 06 September 2018 16:45
by Grinders
Holland wrote: ↑Thursday 06 September 2018 13:58
Update.
I'm a few steps further on, as the crash problem has been resolved for now.
I removed the whole domoticz directory, and reinstalled the stable version (4.9700) of domoticz.
Hmm ... Holland - it's a completely coordinated way to solve the problem))))
Can you please tell me how, when reinstalling the gateway Xiaomi began to work? Simply, I somehow tried to rearrange Domoticz so I had problems, the gateway ceased to be visible. Therefore, I think I will refrain from such coordinative measures))), but maybe I will have time for the weekend, I will try and reinstall (just a lot of things have already been done in Domoticz).
Thanks for the help !!!
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Thursday 06 September 2018 21:20
by Ascari
Always same issue.
I install in rpi3 b Jessie it's work when I update to Strech and pi 3b+ nothing work.
I think I keep my old Pi
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Thursday 06 September 2018 22:38
by Holland
@Grinders.
Had no choice, than to delete the whole thing, as almost every plugin ran unstable, e.g the standard examples, like Ping and UDP. So I don't know what the problem was, but at least its running stable now.
I have not installed the Xiaomi gateway
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Tuesday 11 September 2018 17:10
by Grinders
Holland wrote: ↑Thursday 06 September 2018 22:38
@Grinders.
Had no choice, than to delete the whole thing, as almost every plugin ran unstable, e.g the standard examples, like Ping and UDP. So I don't know what the problem was, but at least its running stable now.
I have not installed the Xiaomi gateway
Hey. I also decided to completely demolish domoticz and put a stable version, but when I restored the copy, the system refused to start it. I blame everything on the melcloud plugin, which I initially remembered worked only in the beta version. And the whole topic with domoticz just because of him and started originally. So I had to upgrade to beta and only then everything worked except for bluetooth labels. How to make that when scanning the domoticz system does not slow down. I have no idea. What is most interesting is that there are no errors, but the system brakes and falls off the sensors.
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Thursday 20 September 2018 21:57
by pimseb
Hello
This plugin is working great so far but it's flooding my log file. It seems that the script is searching for the beacon every 4 seconds. Thats a lot and I fear that the script will drain the beacon battery very fast.
Is there a way to change the presence check interval ? It could be for example every 15 seconds when the beacon has been last detected, and every 30 seconds when the beacon has not been anymore (away from range)
Thanks
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Monday 24 September 2018 21:22
by chrispazz
Same problem here: hardware update from RPI 3 to RPI 3 B+ and it does not detect nuts anymore.
I can see them with hcitool lescan but ble_scanner does not see them....
Bluez updated to 5.50 but no luck....
Re: Python plugin: Bluetooth Beacon Presence Detection
Posted: Monday 19 November 2018 15:27
by chrispazz
No news about this?