colin-guyon / py-bluetooth-utils

Python module containing bluetooth utility functions, in particular for easy BLE scanning and advertising
MIT License
73 stars 20 forks source link

Wrong RSSI is displayed #5

Closed JsBergbau closed 3 years ago

JsBergbau commented 3 years ago

Using example BLE scanner RSSI is displayed wrong most time it is just '0' but once you see '-85' which is a reasonable value.

grafik

But I've also already seen '2' as value, which makes no sense to me

grafik

Of course device (Raspberry PI4) is working correctly and reporting reasonable RSSI data

grafik

MS3FGX commented 3 years ago

I'm seeing similar issues, though perhaps not quite as bad as this. Using both the example scanner and my own program I've written that makes use of the py-bluetooth-utils functions, I am occasionally seeing positive numbers for RSSI.

colin-guyon commented 3 years ago

Thank you for reporting this (and sorry for the delay), I will try to figure out what is occurring ;)

JsBergbau commented 3 years ago

Thanks for looking into this. @MS3FGX Which device do you use?

colin-guyon commented 3 years ago

I just pushed a fix on master: afb68229e28db4d784a25078bc0afb6b41ca9783 In my case the values now are like the dbm values reported for eg. when running the btmon tool. Please tell me if it is OK now ;)

MS3FGX commented 3 years ago

@colin-guyon Looks good to me with the new changes. Just logged a little over 100 packets from three different Xiaomi LYWSD03MMC sensors and all the RSSI values were in reasonable range.

JsBergbau commented 3 years ago

Thanks for the fix. Also works for me now.