alistair23 / AutoMower-BLE

This is an unofficial reverse engineered Husqvarna Automower Connect BLE library. This allows connecting and controlling an Automower without any accounts, cloud or network connection.
GNU General Public License v3.0
76 stars 20 forks source link

Can't connect to Husqvarna 305 #74

Open agramner opened 1 month ago

agramner commented 1 month ago

Really nice to see the progress of this feature in HA. Been missing it for a while. Good job đź‘Ť.

Tried the HA integration with Raspberry Pi 4 bluetooth but can't connect the mower, get this error:

image

Maybe internal bluetooth doesn't work and I need to get the bluetooth proxy?

Output from the log:

2024-07-30 10:08:07.053 INFO (MainThread) [automower_ble.mower] connected
2024-07-30 10:08:07.053 DEBUG (MainThread) [automower_ble.mower] [Service] 98bd0001-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 9): Husqvarna
2024-07-30 10:08:07.116 DEBUG (MainThread) [automower_ble.mower] [Characteristic] 98bd0004-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 17): Unknown (read), Value: bytearray(b'Automower\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2024-07-30 10:08:07.266 DEBUG (MainThread) [automower_ble.mower] [Characteristic] 98bd0003-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 13): Unknown (read,notify), Value: bytearray(b'')
2024-07-30 10:08:07.266 DEBUG (MainThread) [automower_ble.mower] [Characteristic] 98bd0002-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 10): Unknown (write-without-response)
2024-07-30 10:08:07.266 DEBUG (MainThread) [automower_ble.mower] [Service] 00001801-0000-1000-8000-00805f9b34fb (Handle: 8): Generic Attribute Profile
2024-07-30 10:08:09.479 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 415, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 518, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/husqvarna_automower_ble/config_flow.py", line 114, in async_step_user
return await self.async_step_confirm()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/husqvarna_automower_ble/config_flow.py", line 78, in async_step_confirm
(manufacturer, device_type, model) = await Mower(
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/automower_ble/mower.py", line 267, in probe_gatts
return (manufacture, device_type.decode(), model.decode())
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
alistair23 commented 1 month ago

Can you print your device_type and model?

agramner commented 1 month ago

You mean this (from HA UI)?

bcm43438-bt av Raspberry Pi Trading Ltd
Firmware: homeassistant
HĂĄrdvara: usb:v1D6Bp0246d054B
Bluetooth: DC:A6:32:4B:38:5E

or this (from bluetoothctl show)?

Controller DC:A6:32:4B:38:5E (public)
    Manufacturer: 0x0131 (305)
    Version: 0x09 (9)
    Name: homeassistant
    Alias: homeassistant
    Class: 0x006c0000 (7077888)
    Powered: yes
    PowerState: on
    Discoverable: no
    DiscoverableTimeout: 0x000000b4 (180)
    Pairable: no
    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Broadcast Audio Scan      (0000184f-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Volume Control            (00001844-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Volume Offset Control     (00001845-0000-1000-8000-00805f9b34fb)
    UUID: Microphone Control        (0000184d-0000-1000-8000-00805f9b34fb)
    UUID: Audio Input Control       (00001843-0000-1000-8000-00805f9b34fb)
    UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v1D6Bp0246d054B
    Discovering: yes
    Roles: central
    Roles: peripheral
Advertising Features:
    ActiveInstances: 0x00 (0)
    SupportedInstances: 0x05 (5)
    SupportedIncludes: tx-power
    SupportedIncludes: appearance
    SupportedIncludes: local-name
    SupportedCapabilities.MaxAdvLen: 0x1f (31)
    SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
    SupportedMonitorTypes: or_patterns