Jakeler / ble-serial

"RFCOMM for BLE" a UART over Bluetooth low energy (4+) bridge for Linux, Mac and Windows
https://blog.ja-ke.tech/tags/#bluetooth
MIT License
274 stars 38 forks source link

FutureWarning: BLEDevice.rssi is deprecated ... from Bleak v 0.20.0 #83

Closed zalexua closed 1 year ago

zalexua commented 1 year ago

ble-serial v 2.7.0 has been installed with automatic dependency bleak v 0.20.2 which causes an issue:

# ble-scan
Started general BLE scan

/usr/local/lib/python3.10/dist-packages/ble_serial/scan/main.py:34: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  sorted_devices = sorted(devices, key=lambda dev: dev.rssi, reverse=True)
/usr/local/lib/python3.10/dist-packages/ble_serial/scan/main.py:37: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  print(f'{d.address} (RSSI={d.rssi}): {d.name}')
98:DA:E0:01:9C:46 (RSSI=-46): ANT-DISPLAY
54:51:75:A2:8E:51 (RSSI=-60): S1B_BLE

Finished general BLE scan

The issue is not reproduced on Bleak v 0.19.5

# pip install bleak==0.19.5
Collecting bleak==0.19.5
  Using cached bleak-0.19.5-py3-none-any.whl (132 kB)
Requirement already satisfied: dbus-fast<2.0.0,>=1.22.0 in /usr/local/lib/python3.10/dist-packages (from bleak==0.19.5) (1.85.0)
Requirement already satisfied: async-timeout<5,>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from bleak==0.19.5) (4.0.2)
Installing collected packages: bleak
  Attempting uninstall: bleak
    Found existing installation: bleak 0.20.0
    Uninstalling bleak-0.20.0:
      Successfully uninstalled bleak-0.20.0
Successfully installed bleak-0.19.5
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

# ble-scan
Started general BLE scan

98:DA:E0:01:9C:46 (RSSI=-46): ANT-DISPLAY
54:51:75:A2:8E:51 (RSSI=-56): S1B_BLE

Finished general BLE scan

and reproduced with next release - v 0.20.0

Jakeler commented 1 year ago

Thanks for reporting, fixed in v2.7.1.