-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I've been battling with a few issues recently (via HASS) but have now stripped things back and gone back to a simple raspberry pi to test using the raw library to communicate with my mower.
PI installed with bare bones (no gui), python3, bleak and git clone of latest AutoMower-BLE.
Restarted my mower and entered the pin on the panel as per normal, mower is now bluetooth visible.
python3 ble_scanner.py
Scanning for 15.0 seconds, please wait...
Husqvarna device(s) found!
Address: 60:98:66:83:69:C5
Name: EasiLife GO 500
Signal Strength: -74 dBm (closer to 0 is stronger)
So I now try and query:
python3 ./mower.py --address 60:98:66:83:69:C5 --pin 1234
2025-08-29 10:54:14,127 automower_ble.protocol INFO: starting scan...
2025-08-29 10:54:14,127 automower_ble.protocol INFO: connecting to device...
2025-08-29 10:54:15,512 automower_ble.protocol INFO: connected
2025-08-29 10:54:15,513 automower_ble.protocol INFO: pairing device...
Traceback (most recent call last):
File "/usr/src/AutoMower-BLE.git/automower_ble/./mower.py", line 331, in <module>
asyncio.run(main(mower))
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/src/AutoMower-BLE.git/automower_ble/./mower.py", line 208, in main
await mower.connect(device)
File "/usr/src/AutoMower-BLE.git/automower_ble/./mower.py", line 42, in connect
status = await super().connect(device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/AutoMower-BLE.git/automower_ble/protocol.py", line 398, in connect
await self.client.pair()
File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 602, in pair
await self._backend.pair(*args, **kwargs)
File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 521, in pair
assert_reply(reply)
File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 27, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.AuthenticationFailed] Authentication Failed
So it seems even when passing the pin it's not pairing correctly.
This then caused me to recall, when I did this originally I had paired my laptop (linux ubuntu with gui) to the mower via normal bluetooth pairing and pin. This allowed the bluez/bleak layer to be authenticated.
This, therefore is a missing step/configuration and looking at bleak it's a future feature (hbldh/bleak#1100)
Therefore, anyone with pairing/pin/authentication issues, ensure your lower layer bluetooth is paired FIRST before using this library. You can do it either via cli by doing:
hcitool cc <target-bdaddr>
hcitool auth <target-bdaddr>
Which should then prompt for your mower pin and create an authentication/authorization at the bluez layer.
In Home Assistant, this means you need to do it at the esphome bluetooth proxy, which is done by adding this to your configuration for the bluetooth proxy yaml:
ble_client:
- mac_address: <MOWER-MAC>
id: automower_305
on_passkey_request:
then:
- logger.log: "Authenticating with passkey"
- ble_client.passkey_reply:
id: automower_305
passkey: <MOWER-PIN>
on_disconnect:
then:
- esp32_ble_tracker.start_scan:
I'll push a PR shortly to update documentation and advise on all of the above so it's documented/clear, but wanted to put it as an issue first so it's made aware that many people with auth/pin may be suffering this directly with the library and via the pin authenticated HASS integrations (mine included).
(I'm currently testing this so can confirm back once I can reliably connect and disconnect and re-pair)