ble_monitor: Don't work after upgrade python to 3.8.6 [SOLVED]

Don’t work anymore with python 3.8.6 (HA core in venv 0.116.4)

tried 0.6.13 and 0.7.3beta version

This is error in log:

Oct 19 22:29:20 raspberrypi hass[3904]: 2020-10-19 22:29:20 ERROR (Thread-7) [root] Uncaught thread exception
Oct 19 22:29:20 raspberrypi hass[3904]: Traceback (most recent call last):
Oct 19 22:29:20 raspberrypi hass[3904]:   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Oct 19 22:29:20 raspberrypi hass[3904]:     self.run()
Oct 19 22:29:20 raspberrypi hass[3904]:   File "/home/homeassistant/.homeassistant/custom_components/mitemp_bt/sensor.py", line 129, in run
Oct 19 22:29:20 raspberrypi hass[3904]:     mysocket = aiobs.create_bt_socket(self._interface)
Oct 19 22:29:20 raspberrypi hass[3904]:   File "/srv/homeassistant/lib/python3.8/site-packages/aioblescan/aioblescan.py", line 1280, in create_bt_socket
Oct 19 22:29:20 raspberrypi hass[3904]:     sock = socket.socket(family=socket.AF_BLUETOOTH,
Oct 19 22:29:20 raspberrypi hass[3904]: AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

Model LYWSDCGQ

config:

  - platform: mitemp_bt
    batt_entities: true

pi@raspberrypi:~ $ sudo getcap readlink -f \which python3`` /usr/local/bin/python3.8 = cap_net_admin,cap_net_raw+eip

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19

Most upvoted comments

thanks, works for me!

We are getting there…, can you show your config? Battery sensors are called sensor.mi_battery_MAC, so they might have changed names compared to earlier versions.

@Magalex2x14 Welcome back!

@Gio-dot, you have a different issue, see #123 (temporary solution, downgrade HassOs 4.14 to 4.13).

@Scialla, see the comment of @Magalex2x14, you will have to rebuild your python installation, to include Bluetooth socket support. Python 3 has native support for bluetooth sockets, however, it only has support for it if built with bluetooth.h. See also this link

Hi, guys. @Scialla do I understand correctly that you installed python from source? If so, then python should be rebuilt after installing libbluetooth-dev library.

OK, this evening i will try to install BT library in venv and report back. Thanks