How to check presence of Beacon ?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
Busmeikel
Posts: 8
Joined: Monday 19 December 2016 9:48
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Germany - Münsterland
Contact:

RSSI instead of HOME

Post by Busmeikel » Wednesday 05 December 2018 9: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

User avatar
EddyG
Posts: 334
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.10252
Location: Rhenen, Netherlands
Contact:

Re: How to check presence of Beacon ?

Post by EddyG » Friday 07 December 2018 12:17

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???
Regards,
Eddy

QuadRotas
Posts: 6
Joined: Wednesday 07 November 2018 17:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RSSI instead of HOME

Post by QuadRotas » Thursday 13 December 2018 17:57

Busmeikel wrote:
Wednesday 05 December 2018 9: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
Did you get your setup to work eventually? And could you share your setup perhaps?
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.

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 19:15

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 ????

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 19: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
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&param=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&param=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 ??

QuadRotas
Posts: 6
Joined: Wednesday 07 November 2018 17:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by QuadRotas » Sunday 16 December 2018 19:21

Artursd wrote:
Sunday 16 December 2018 19: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 ??
Nothing. You have 2 Bluetooth-controllers, one onboard and one USB. The script takes the one on HCI0, the onboard one.
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.

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 20:30

Thanks for the quick response. Already found more errors. Corrected on HCI 1. There is already a result

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 20:32

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&param=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&param=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,)

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 20:32

And when does he stop ????

QuadRotas
Posts: 6
Joined: Wednesday 07 November 2018 17:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by QuadRotas » Sunday 16 December 2018 20:36

Artursd wrote:
Sunday 16 December 2018 20:32
And when does he stop ????
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.

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 20:54

I understand all this, if I constantly scan it, will it not download RP3B ???

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 20:57

I still have NUT 2 pcs

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 21:01

Variables are already changing, the script is working. There is a concern if he will score RP3b if he constantly scans

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Sunday 16 December 2018 21:02

Пишу с переводчиком, может не все будет понятно

QuadRotas
Posts: 6
Joined: Wednesday 07 November 2018 17:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by QuadRotas » Sunday 16 December 2018 21:46

Artursd wrote:
Sunday 16 December 2018 20:54
I understand all this, if I constantly scan it, will it not download RP3B ???
I am not sure what you mean with 'download'?
Artursd wrote:
Sunday 16 December 2018 20:57
I still have NUT 2 pcs
Thank you.
Artursd wrote:
Sunday 16 December 2018 21:01
Variables are already changing, the script is working. There is a concern if he will score RP3b if he constantly scans
Do you mean if the Raspberry will overheat, or overload? No, the script is not powerful enough to do that.
Artursd wrote:
Sunday 16 December 2018 21:02
Пишу с переводчиком, может не все будет понятно
Нет проблем :)

It's okay to post multiple replies in 1 post, instead of separate posts

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Monday 17 December 2018 18:40

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

Artursd
Posts: 27
Joined: Sunday 16 December 2018 18:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by Artursd » Monday 17 December 2018 18:45

Привет. Это все перевод. Если постоянно будет происходить сканирование BLE, как будет загружаться процессор?

User avatar
emme
Posts: 963
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: How to check presence of Beacon ?

Post by emme » Monday 17 December 2018 19:13

The most dangerous phrase in any language is:
"We always done this way"

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests