pygatt icon indicating copy to clipboard operation
pygatt copied to clipboard

Is it possible to get the RSSI using pygatt?

Open aeyuxi opened this issue 8 years ago • 6 comments

aeyuxi avatar Aug 09 '18 16:08 aeyuxi

Yes. It is. I don't know why it's not documented or why no one else has responded, but you can dig it out of the source code.

I am using:

device.get_rssi()

Let me know if you need more help...

wstreyer avatar Oct 12 '18 16:10 wstreyer

If you are not yet connected to a device, you can do this:

devices = adapter.scan()
for device in devices:
    rssi = device['rssi']
    address = device['address']
    print('{} - rssi = {}'.format(address, rssi))

Example output:

D1:22:E4:F9:58:90 - rssi = -84
7A:1D:9D:C0:A2:01 - rssi = -40
28:EC:A8:29:57:F2 - rssi = -85
21:9E:EF:63:26:93 - rssi = -85
40:F2:E6:9A:C9:EB - rssi = -86
39:4C:80:D2:91:2C - rssi = -91

wstreyer avatar Oct 12 '18 16:10 wstreyer

Thanks, you found it! I'm adding mention in the README that the docs (while limited) can be found in the code itself: https://github.com/peplin/pygatt/blob/master/pygatt/device.py#L45

peplin avatar Mar 30 '19 21:03 peplin

Hi Will. Thanks for the information. However, it seems like the rssi info is not provided not in the return of adapter.scan(). Do you have any idea of how I could access the rssi with PyGatt without connecting to it?

Thanks!

RuiRitaYang avatar Jun 23 '20 20:06 RuiRitaYang

Hi Will. Thanks for the information. However, it seems like the rssi info is not provided not in the return of adapter.scan(). Do you have any idea of how I could access the rssi with PyGatt without connecting to it?

Thanks!

I have the same problem, did you find a solution?

ghost avatar Jul 09 '20 03:07 ghost

It seems like the function has been removed in the mean time? How can I get rssi now? https://github.com/peplin/pygatt/blob/master/pygatt/device.py#L53

jmuellers avatar May 20 '21 16:05 jmuellers