Bleak Lib (bluetooth) not working

Hi, I am trying to connect to a bluetooth device by running a python script via AppDaemon.

However, I get the following stacktrace when using the bleak library:

2022-08-23 15:27:23.085716 WARNING my_demo_app: Traceback (most recent call last): 
File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) 
File "/config/appdaemon/apps/my_demo_app.py", line 27, in request_update asyncio.run(self._walkingPadClient.scan()) 
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) 
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() 
File "/config/appdaemon/apps/my_libs/walking_pad_client.py", line 24, in scan devices = await scanner.discover() 
File "/usr/lib/python3.10/site-packages/bleak/backends/scanner.py", line 116, in discover async with cls(**kwargs) as scanner: 
File "/usr/lib/python3.10/site-packages/bleak/backends/scanner.py", line 96, in __aenter__ await self.start() 
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 128, in start manager = await get_global_bluez_manager() 
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 812, in get_global_bluez_manager await instance.async_init() 
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 294, in async_init bus = MessageBus(bus_type=BusType.SYSTEM) 
File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 122, in __init__ super().__init__(bus_address, bus_type, ProxyObject) 
File "/usr/lib/python3.10/site-packages/dbus_next/message_bus.py", line 85, in __init__ self._setup_socket() 
File "/usr/lib/python3.10/site-packages/dbus_next/message_bus.py", line 575, in _setup_socket raise err 
File "/usr/lib/python3.10/site-packages/dbus_next/message_bus.py", line 548, in _setup_socket self._sock.connect(Filename) 
FileNotFoundError: [Errno 2] No such File or directory

Not sure how to fix this. Any ideas?

I am using v0.9.3 of the AppDaemon AddOn, and running Home Assistant 2022.8.6 on a RPi 4.

Using ssh to connect to Home Assistant, I already checked that bluetooth works via bluetoothctl.

It seems like the only thing in your code causing this is initiating a scan. It kind of looks like an issue with the module, maybe it’s not compatible with Python 3.10? Anyhow, it doesn’t appear this is an AD issue.

That could be it. Is it possible to downgrade the python version for the AppDeamon Addon?

I don’t think so but you can easily build your own docker container for AD.