Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions being thrown about dbus_fast authentication failure #64

Open
ZionFox opened this issue Sep 24, 2023 · 0 comments
Open

Exceptions being thrown about dbus_fast authentication failure #64

ZionFox opened this issue Sep 24, 2023 · 0 comments

Comments

@ZionFox
Copy link

ZionFox commented Sep 24, 2023

Environment

RasPi 4 running DietPi v8.20.1 and running in Docker accessing hci0
Attempting to access Xiaomi LYWSD03MMC with custom ATC firmware (xiaomilywsd_atc), by adding their individual MAC addresses in the config. MAC addresses gained from HA instance running ble_monitor custom integration, which is still working fine.

Description

Built the container as guided in the readme and that completed without issues. Running the container with default docker compose listed threw an error about /var/run/dbus permission denied, and stating that /run/dbus/system_bus_socket: no such file or directory. Adding the line for volume mount /var/run/dbus:/var/run/dbus, mounting the dbus folder into the container allows access to the dbus but new exception is thrown: dbus_fast.errors.AuthError: authentication failed: REJECTED: ['EXTERNAL']

The service is pushing messages to the MQTT broker, listing the four devices I put into config however stating their availability is offline.

Stacktrace

ble2mqtt    | 2023-09-24 05:24:38 INFO: Starting BLE2MQTT version 0.2.0, bleak 0.21.1, adapter hci0
ble2mqtt    | 2023-09-24 05:24:38 INFO: Connected to 10.0.1.2
ble2mqtt    | 2023-09-24 05:24:38 ERROR: <Task finished name='Task-12' coro=<Ble2Mqtt.scan_devices_task() done, defined at /home/rootless/.local/lib/python3.11/site-packages/ble2mqtt/ble2mqtt.py:194> exception=AuthError("authentication failed: REJECTED: ['EXTERNAL']")> stopped unexpectedly
ble2mqtt    | Traceback (most recent call last):
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/ble2mqtt/ble2mqtt.py", line 209, in scan_devices_task
ble2mqtt    |     await aio.wait_for(scanner.start(), 10)
ble2mqtt    |   File "/usr/local/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
ble2mqtt    |     return fut.result()
ble2mqtt    |            ^^^^^^^^^^^^
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/bleak/__init__.py", line 198, in start
ble2mqtt    |     await self._backend.start()
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/bleak/backends/bluezdbus/scanner.py", line 168, in start
ble2mqtt    |     manager = await get_global_bluez_manager()
ble2mqtt    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/bleak/backends/bluezdbus/manager.py", line 1046, in get_global_bluez_manager
ble2mqtt    |     await instance.async_init()
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/bleak/backends/bluezdbus/manager.py", line 236, in async_init
ble2mqtt    |     await bus.connect()
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/dbus_fast/aio/message_bus.py", line 224, in connect
ble2mqtt    |     await self._authenticate()
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/dbus_fast/aio/message_bus.py", line 507, in _authenticate
ble2mqtt    |     response = self._auth._receive_line(await self._auth_readline())
ble2mqtt    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ble2mqtt    |   File "/home/rootless/.local/lib/python3.11/site-packages/dbus_fast/auth.py", line 99, in _receive_line
ble2mqtt    |     raise AuthError(f"authentication failed: {response.value}: {args}")
ble2mqtt    | dbus_fast.errors.AuthError: authentication failed: REJECTED: ['EXTERNAL']
ble2mqtt    | 2023-09-24 05:24:38 ERROR: Connection lost. Will retry in 10 seconds.

Configurations

ble2mqtt.json

{
    "mqtt_host": "10.0.1.2",
    "mqtt_port": 1883,
    "mqtt_user": "mosquitto",
    "mqtt_password": "<password>",
    "log_level": "INFO",
    "devices": [
        {
            "address": "A4:C1:38:23:89:22",
            "type": "xiaomilywsd_atc",
            "friendly_name": "bedroom thermometer"
        },
        {
            "address": "A4:C1:38:1A:E1:F5",
            "type": "xiaomilywsd_atc",
            "friendly_name": "guestroom thermometer"
        },
        {
            "address": "A4:C1:38:D2:B5:1A",
            "type": "xiaomilywsd_atc",
            "friendly_name": "study thermometer"
        },
        {
            "address": "A4:C1:38:8B:5F:80",
            "type": "xiaomilywsd_atc",
            "friendly_name": "kitchen thermometer"
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant