How to check presence of Beacon ?
Moderators: leecollings, remb0
-
- Posts: 23
- Joined: Monday 19 December 2016 8:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Germany - Münsterland
- Contact:
RSSI instead of HOME
Hi,
it was my fault, if you can read that is sometimes a benefit
In REPEAT-Mode the script writes the RSSI into the user-variable if the tag is present,
in SWITCH-Mode the script writes HOME into the user-variable if the tag is present.
Only for the protocol.
Meikel
it was my fault, if you can read that is sometimes a benefit
In REPEAT-Mode the script writes the RSSI into the user-variable if the tag is present,
in SWITCH-Mode the script writes HOME into the user-variable if the tag is present.
Only for the protocol.
Meikel
Re: How to check presence of Beacon ?
I have the following problem.
The script(s) worked fine on my previous hardware Raspberry Pi 3B.
Now I switched to a Raspberry Pi 3B+ on Berryboot Linux domoticzslave 4.14.83v7-aufs #1 SMP Wed Nov 28 22:52:43 CET 2018 armv7l GNU/Linux
The only way I can have the test_beacon.py have normal output is to open a second putty window and issue an sudo bluetoothctl
with the commands "power on' and 'scan on'
After the 'scan on' the output on the first window is normal, but as soon as I stop the bluetoothctl by 'quit' the output on the first window stops.
Anyone any ideas???
The script(s) worked fine on my previous hardware Raspberry Pi 3B.
Now I switched to a Raspberry Pi 3B+ on Berryboot Linux domoticzslave 4.14.83v7-aufs #1 SMP Wed Nov 28 22:52:43 CET 2018 armv7l GNU/Linux
The only way I can have the test_beacon.py have normal output is to open a second putty window and issue an sudo bluetoothctl
with the commands "power on' and 'scan on'
After the 'scan on' the output on the first window is normal, but as soon as I stop the bluetoothctl by 'quit' the output on the first window stops.
Anyone any ideas???
-
- Posts: 12
- Joined: Wednesday 07 November 2018 16:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: RSSI instead of HOME
Did you get your setup to work eventually? And could you share your setup perhaps?Busmeikel wrote: ↑Wednesday 05 December 2018 8:29 Hi,
it was my fault, if you can read that is sometimes a benefit
In REPEAT-Mode the script writes the RSSI into the user-variable if the tag is present,
in SWITCH-Mode the script writes HOME into the user-variable if the tag is present.
Only for the protocol.
Meikel
I have everything configured like the wiki manual says but the tags I use are only registered by the script when they're in discovery mode. As soon as they go into normal mode the script doesn't see them anymore.
My Pi3B has been configured according to basic needs so no altered bluetooth settings whatsoever.
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Hello
root@raspberrypi:/home/pi/scripts# hciconfig
hci1: Type: BR/EDR Bus: USB
BD Address: 00:15:83:F2:26:66 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:9808985 acl:0 sco:0 events:232671 errors:0
TX bytes:19397 acl:0 sco:0 commands:997 errors:0
hci0: Type: BR/EDR Bus: UART
BD Address: B8:27:EB:7C:EC:0A ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:17615918 acl:75 sco:0 events:405712 errors:0
TX bytes:20594 acl:67 sco:0 commands:969 errors:0
I need to redo the script on Hci1 ????
root@raspberrypi:/home/pi/scripts# hciconfig
hci1: Type: BR/EDR Bus: USB
BD Address: 00:15:83:F2:26:66 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:9808985 acl:0 sco:0 events:232671 errors:0
TX bytes:19397 acl:0 sco:0 commands:997 errors:0
hci0: Type: BR/EDR Bus: UART
BD Address: B8:27:EB:7C:EC:0A ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:17615918 acl:75 sco:0 events:405712 errors:0
TX bytes:20594 acl:67 sco:0 commands:969 errors:0
I need to redo the script on Hci1 ????
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
root@raspberrypi:/home/pi/scripts# sudo python /usr/local/bin/check_beacon_presence.py
2018-12-16 19:16:07,274 - root - DEBUG - Ok hci0 interface Up n running !
2018-12-16 19:16:07,274 - root - DEBUG - Connect to bluetooth device 0
2018-12-16 19:16:07,741 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:07,743 - root - WARNING - Tag Nut_Egita seen after an absence of 30 sec : update presence
2018-12-16 19:16:07,770 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 19:16:07,772 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=7&vname=Nut_Egita&vtype=2&vvalue=HOME HTTP/1.1" 401 91
2018-12-16 19:16:07,777 - root - DEBUG - <Thread(Thread-2, started 1968174192)> -> <Response [401]>
2018-12-16 19:16:08,065 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:08,160 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 19:16:08,169 - root - WARNING - Tag Nut_Arturs seen after an absence of 30 sec : update presence
2018-12-16 19:16:08,173 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 19:16:08,177 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=8&vname=Nut_Arturs&vtype=2&vvalue=HOME HTTP/1.1" 401 91
2018-12-16 19:16:08,184 - root - DEBUG - <Thread(Thread-3, started 1968174192)> -> <Response [401]>
2018-12-16 19:16:08,315 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-88,) - DATA unknown (0,)
2018-12-16 19:16:09,087 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-89,) - DATA unknown (0,)
2018-12-16 19:16:09,357 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:09,398 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-86,) - DATA unknown (0,)
c2018-12-16 19:16:09,676 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-77,) - DATA unknown (-106,)
what is the problem ??
2018-12-16 19:16:07,274 - root - DEBUG - Ok hci0 interface Up n running !
2018-12-16 19:16:07,274 - root - DEBUG - Connect to bluetooth device 0
2018-12-16 19:16:07,741 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:07,743 - root - WARNING - Tag Nut_Egita seen after an absence of 30 sec : update presence
2018-12-16 19:16:07,770 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 19:16:07,772 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=7&vname=Nut_Egita&vtype=2&vvalue=HOME HTTP/1.1" 401 91
2018-12-16 19:16:07,777 - root - DEBUG - <Thread(Thread-2, started 1968174192)> -> <Response [401]>
2018-12-16 19:16:08,065 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:08,160 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 19:16:08,169 - root - WARNING - Tag Nut_Arturs seen after an absence of 30 sec : update presence
2018-12-16 19:16:08,173 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 19:16:08,177 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=8&vname=Nut_Arturs&vtype=2&vvalue=HOME HTTP/1.1" 401 91
2018-12-16 19:16:08,184 - root - DEBUG - <Thread(Thread-3, started 1968174192)> -> <Response [401]>
2018-12-16 19:16:08,315 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-88,) - DATA unknown (0,)
2018-12-16 19:16:09,087 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-89,) - DATA unknown (0,)
2018-12-16 19:16:09,357 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 19:16:09,398 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-86,) - DATA unknown (0,)
c2018-12-16 19:16:09,676 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-77,) - DATA unknown (-106,)
what is the problem ??
-
- Posts: 12
- Joined: Wednesday 07 November 2018 16:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Nothing. You have 2 Bluetooth-controllers, one onboard and one USB. The script takes the one on HCI0, the onboard one.Artursd wrote: ↑Sunday 16 December 2018 18:17 root@raspberrypi:/home/pi/scripts# sudo python /usr/local/bin/check_beacon_presence.py
2018-12-16 19:16:07,274 - root - DEBUG - Ok hci0 interface Up n running !
2018-12-16 19:16:07,274 - root - DEBUG - Connect to bluetooth device 0
[..]
c2018-12-16 19:16:09,676 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-77,) - DATA unknown (-106,)
what is the problem ??
The output says it detects the 2 tags you defined in the script just fine. If you have set everything correctly in Domoticz you should see the status of the two tags being updated.
Also, what kind of tags do you use? Mine won't stay on so I'm looking for tags that work with the script.
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Thanks for the quick response. Already found more errors. Corrected on HCI 1. There is already a result
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
root@raspberrypi:/home/pi/scripts# sudo python /usr/local/bin/check_beacon_presence.py
2018-12-16 20:31:29,732 - root - DEBUG - Ok hci1 interface Up n running !
2018-12-16 20:31:29,733 - root - DEBUG - Connect to bluetooth device 0
2018-12-16 20:31:29,773 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:29,800 - root - WARNING - Tag Nut_Arturs seen after an absence of 30 sec : update presence
2018-12-16 20:31:29,801 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 20:31:29,806 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=8&vname=Nut_Arturs&vtype=2&vvalue=HOME HTTP/1.1" 200 58
2018-12-16 20:31:29,813 - root - DEBUG - <Thread(Thread-2, started 1968174192)> -> <Response [200]>
2018-12-16 20:31:29,833 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 20:31:29,834 - root - WARNING - Tag Nut_Egita seen after an absence of 30 sec : update presence
2018-12-16 20:31:29,840 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 20:31:29,843 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=7&vname=Nut_Egita&vtype=2&vvalue=HOME HTTP/1.1" 200 58
2018-12-16 20:31:29,847 - root - DEBUG - <Thread(Thread-3, started 1968174192)> -> <Response [200]>
2018-12-16 20:31:30,232 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-84,) - DATA unknown (0,)
2018-12-16 20:31:30,390 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:30,481 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-84,) - DATA unknown (-106,)
2018-12-16 20:31:30,540 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-86,) - DATA unknown (0,)
2018-12-16 20:31:30,691 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-84,) - DATA unknown (0,)
2018-12-16 20:31:30,808 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-83,) - DATA unknown (-106,)
2018-12-16 20:31:31,000 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:31,128 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-84,) - DATA unknown (-106,)
2018-12-16 20:31:29,732 - root - DEBUG - Ok hci1 interface Up n running !
2018-12-16 20:31:29,733 - root - DEBUG - Connect to bluetooth device 0
2018-12-16 20:31:29,773 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:29,800 - root - WARNING - Tag Nut_Arturs seen after an absence of 30 sec : update presence
2018-12-16 20:31:29,801 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 20:31:29,806 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=8&vname=Nut_Arturs&vtype=2&vvalue=HOME HTTP/1.1" 200 58
2018-12-16 20:31:29,813 - root - DEBUG - <Thread(Thread-2, started 1968174192)> -> <Response [200]>
2018-12-16 20:31:29,833 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-80,) - DATA unknown (-106,)
2018-12-16 20:31:29,834 - root - WARNING - Tag Nut_Egita seen after an absence of 30 sec : update presence
2018-12-16 20:31:29,840 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 192.168.1.128
2018-12-16 20:31:29,843 - requests.packages.urllib3.connectionpool - DEBUG - http://192.168.1.128:8080 "GET /json.htm?type=command¶m=updateuservariable&idx=7&vname=Nut_Egita&vtype=2&vvalue=HOME HTTP/1.1" 200 58
2018-12-16 20:31:29,847 - root - DEBUG - <Thread(Thread-3, started 1968174192)> -> <Response [200]>
2018-12-16 20:31:30,232 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-84,) - DATA unknown (0,)
2018-12-16 20:31:30,390 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:30,481 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-84,) - DATA unknown (-106,)
2018-12-16 20:31:30,540 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-86,) - DATA unknown (0,)
2018-12-16 20:31:30,691 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-84,) - DATA unknown (0,)
2018-12-16 20:31:30,808 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-83,) - DATA unknown (-106,)
2018-12-16 20:31:31,000 - root - DEBUG - Tag Nut_Arturs Detected 78:bd:bc:da:50:77 - RSSI (-85,) - DATA unknown (0,)
2018-12-16 20:31:31,128 - root - DEBUG - Tag Nut_Egita Detected ed:c5:51:27:23:96 - RSSI (-84,) - DATA unknown (-106,)
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
And when does he stop ????
-
- Posts: 12
- Joined: Wednesday 07 November 2018 16:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
It doesn't The script continuously scans for the tag and updates Domoticz accordingly. You get this output because you run the script manually. If you end the script, nothing gets scanned. You can configure the script to be ran as a service so it runs all the time, in the background. You won't see anything on your screen. Check out the logging section of the script to reconfigure it so it only writes warnings/errors to the logfile. If you write debug logging to your logfile grows significantly.
Can you let me know what kind of bluetooth tags you use? I'm dealing with my own problems getting this to work.
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
I understand all this, if I constantly scan it, will it not download RP3B ???
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
I still have NUT 2 pcs
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Variables are already changing, the script is working. There is a concern if he will score RP3b if he constantly scans
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Пишу с переводчиком, может не все будет понятно
-
- Posts: 12
- Joined: Wednesday 07 November 2018 16:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
I am not sure what you mean with 'download'?
Thank you.
Do you mean if the Raspberry will overheat, or overload? No, the script is not powerful enough to do that.
Нет проблем
It's okay to post multiple replies in 1 post, instead of separate posts
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Hey. This is all a translation. I mean, if BLE scanning is going to happen all the time, Can a large processor loop be? I'm working on RP Domoticz
-
- Posts: 86
- Joined: Sunday 16 December 2018 17:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check presence of Beacon ?
Привет. Это все перевод. Если постоянно будет происходить сканирование BLE, как будет загружаться процессор?
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: How to check presence of Beacon ?
on Pi3b+ give Nodered a chance:
https://flows.nodered.org/flow/7343f804 ... 221e9ed3b9
https://flows.nodered.org/flow/7343f804 ... 221e9ed3b9
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
Re: How to check presence of Beacon ?
Tnx. for the flow.
Unfortunately it still does not work. There is something wrong with my Bluetooth device on the RPi 3B+ or with libs.
The Answer I get is:
A few post above I explaned what happens on my RPi, but I cannot figure out how to solve it.
And sometimes I get the answer:
Unfortunately it still does not work. There is something wrong with my Bluetooth device on the RPi 3B+ or with libs.
The Answer I get is:
Code: Select all
"Unable to start BLE scan. Adapter state: unknown"
And sometimes I get the answer:
Code: Select all
"Unable to start BLE scan. Adapter state: unauthorized"
Who is online
Users browsing this forum: Google [Bot] and 1 guest