monitor icon indicating copy to clipboard operation
monitor copied to clipboard

RSSI Tracking

Open tramanah opened this issue 5 years ago • 6 comments

Hi, I did follow the steps and set -c flag on known_device and successfully to obtain the RSSI value. I did get RSSI value -22, -26 and -24 and once in while -99. Therefore :

I did send MQTT msg from Node REd to raspberry pi zero, Mosquito MQTT. Topic : DRRM/Dir_Room/E0:AA:96:07:D9:59/rssi msg : -24

After reboot, RSSI keeps on troughing -99. Even though the device is close by the raspberry pi. Do I miss anything?

tramanah avatar Jan 23 '20 08:01 tramanah

From this description, you're not doing anything wrong. What device are you using?

andrewjfreyer avatar Jan 23 '20 16:01 andrewjfreyer

I am using Samsung S9 and scanning device in raspberry pi zero. Further to questions, I did use new raspberry Pi zero add two mobile Samsung Note 8 and S9. Both phones are side beside. Reading obtain are as follow:-

-22, -18
-26, -19
-25, -19 

> online

> 
> {"identity":"lobby"}
> -22
> -18
> 
> online
> {"identity":"lobby"}
> online
> {"identity":"lobby"}
> -26
> -19
> 
> online
> {"identity":"lobby"}
> online
> {"identity":"lobby"}
> -25
> -19
> 
> online
> {"identity":"lobby"}
> online
> {"identity":"lobby"}
> -24
> -17
> online`


Can I say if the reading is greater than -30 is within the area and set both Topic : DRRM/Dir_Room/Note8 MAC ID/rssi msg : -30 Topic : DRRM/Dir_Room/S9 MAC ID/rssi msg : -30

and add this in behaviour preferences #PREF_RSSI_CHANGE_THRESHOLD=-20

tramanah avatar Jan 24 '20 02:01 tramanah

I have a similar issue. In my case, monitor is running fine for a couple of hours and then stops working. I cannot get it working again. Only after a restart of the pi, everything works again. I described my problem here #204

Its just a gut feeling, but I think the script somehow overloads the bluetooth in the pi. As I experienced, monitor keep on working longer, when only 1 device is connected. With two device, it seems to make more problems. Maybe it is because of the rssi function? It is possible to make the scan of multi devices with more time between the scans?

i.e.: if a device is scanned and requested for rssi every 1,5 min., then minute 0: scan and request for rssi of device 1 45 seconds: scan and request for rssi of device 2 90 seconds: scan and request for rssi of device 1 135 seconds: scan and request for rssi of device 2

....

gadric avatar Jan 24 '20 09:01 gadric

I think I figured out a solution.

According to ArchWiki, hcitool and other tools from the bluetooth package are deprecated now: https://wiki.archlinux.org/index.php/Bluetooth#Installation

therefore, I installed the pybluez and use the this project which is also used in HA itself for BT detection.

I have testing this script over the weekend and it seems to work good. It requires an additional small python script and a change of the rssi code. I will make a pull request today or tomorrow.

gadric avatar Feb 03 '20 09:02 gadric

Cheers, I meanwhile I will try too.

tramanah avatar Feb 04 '20 08:02 tramanah

create a pull request. let me know if this works.

gadric avatar Feb 04 '20 11:02 gadric