andyb2000 / HACS-husqvarna_automower_ble

HACS custom component for husqvarna_automower_ble
9 stars 3 forks source link

Failed setup, will retry: Data length mismatch. Read 28 bytes of 24- Event 39 #21

Open cybermatte opened 1 month ago

cybermatte commented 1 month ago

Hi,

What have I missed if I get this:

Husqvarna Automower BLE 0.0.9 Unknown Automower Failed setup, will retry: Data length mismatch. Read 28 bytes of 24

[16:21:00][D][esp32_ble_tracker:270]: Starting scan... [16:21:25][I][bluetooth_proxy:282]: [1] [F0:F8:F2:C6:AA:5F] Connecting v3 without cache [16:21:25][D][esp32_ble_tracker:219]: Pausing scan to make connection... [16:21:25][D][esp32_ble_tracker:307]: End of scan. [16:21:25][I][esp32_ble_client:067]: [1] [F0:F8:F2:C6:AA:5F] 0x00 Attempting BLE connection [16:21:25][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_CONNECT_EVT [16:21:25][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_OPEN_EVT [16:21:25][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_SEARCH_CMPL_EVT [16:21:25][I][esp32_ble_client:227]: [1] [F0:F8:F2:C6:AA:5F] Connected [16:21:25][D][esp32_ble_client:188]: [1] [F0:F8:F2:C6:AA:5F] cfg_mtu status 0, mtu 65 [16:21:25][I][esp32_ble_client:333]: [1] [F0:F8:F2:C6:AA:5F] auth complete. remote BD_ADDR: f0f8f2c6aa5f [16:21:25][D][esp32_ble_client:341]: [1] [F0:F8:F2:C6:AA:5F] auth success. address type = 0 auth mode = 1 [16:21:25][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_READ_CHAR_EVT [16:21:25][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_READ_CHAR_EVT [16:21:26][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_READ_CHAR_EVT [16:21:26][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_READ_CHAR_EVT [16:21:26][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_READ_CHAR_EVT [16:21:26][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_REG_FOR_NOTIFY_EVT [16:21:26][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_DESCR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:31][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:32][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:32][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_WRITE_CHAR_EVT [16:21:32][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:32][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:32][D][esp32_ble_client:110]: [1] [F0:F8:F2:C6:AA:5F] ESP_GATTC_NOTIFY_EVT [16:21:32][D][esp32_ble_client:306]: [1] [F0:F8:F2:C6:AA:5F] Event 39 [16:21:32][I][esp32_ble_client:084]: [1] [F0:F8:F2:C6:AA:5F] Disconnecting. [16:21:32][D][esp-idf:000][BTU_TASK]: W (9788952) BT_HCI: hci cmd send: disconnect: hdl 0x1, rsn:0x13

[16:21:32][D][esp-idf:000][BTU_TASK]: W (9788956) BT_APPL: gattc_conn_cb: if=3 st=0 id=259 rsn=0x16

[16:21:32][D][esp-idf:000][BTU_TASK]: W (9788959) BT_APPL: gattc_conn_cb: if=4 st=0 id=260 rsn=0x16

[16:21:32][D][esp-idf:000][BTU_TASK]: W (9788966) BT_APPL: gattc_conn_cb: if=5 st=0 id=261 rsn=0x16

[16:21:32][D][esp-idf:000][BTU_TASK]: W (9788976) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x16

I have a Husqvarna Automower 310.

cybermatte commented 1 month ago

2024-08-12 16:32:00.625 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connecting to F0:F8:F2:C6:AA:5F with channel ID 1189179191 2024-08-12 16:32:07.803 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connected and paired 2024-08-12 16:32:07.870 WARNING (MainThread) [automower_ble.mower] Response failed validation 2024-08-12 16:32:07.944 INFO (MainThread) [custom_components.husqvarna_automower_ble] Connected to Automower: Automower 310 2024-08-12 16:32:07.945 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Polling device 2024-08-12 16:32:08.021 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] battery level: 82 2024-08-12 16:32:08.096 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] activity: 0 2024-08-12 16:32:08.168 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] state: 2 2024-08-12 16:32:08.273 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] next_start_time: None 2024-08-12 16:32:08.362 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] errorCode: 0 2024-08-12 16:32:08.426 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] NumberOfMessages: 50 2024-08-12 16:32:08.497 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] RemainingChargingTime: 1113 2024-08-12 16:32:08.596 ERROR (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Unexpected error fetching husqvarna_automower_ble data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/husqvarna_automower_ble/coordinator.py", line 125, in _async_update_data data["statistics"] = await self.mower.command("GetAllStatistics") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/mower.py", line 50, in command response_dict = command.parse_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/protocol.py", line 208, in parse_response raise ValueError( ValueError: Data length mismatch. Read 28 bytes of 24 2024-08-12 16:32:08.599 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Finished fetching husqvarna_automower_ble data in 0.654 seconds (success: False) 2024-08-12 16:32:08.599 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Shutdown

andyb2000 commented 1 week ago

Hi, The data length mismatch was a problem that was changed in the upstream library and is now reflected in the new code I've pushed. Also "Response failed validation" suggests you need to enter a PIN which I have updated my repo, so I'd suggest you delete the integration and re-add it with your mower pin and see if that now works as expected.

erlandp commented 1 week ago

I have the same problem but with a Husqvarna 315.

andyb2000 commented 1 week ago

I have the same problem but with a Husqvarna 315.

If you delete the integration, disable the PIN on your Husqvarna or enter the pin in the integration does that solve the issue? If the integration doesn't prompt for the pin you need to update to the latest in my master repo.

erlandp commented 1 week ago

I have tried deleting and installing the integration again and disabled PIN on the mower. No luck.

cybermatte commented 1 week ago

Deleted the pin and tried with the MAC + deleting the 0 in the pin input box, I do get:


Automower BLE component for HASS Custom component by @andyb2000

2024-09-05 07:10:43.048 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connecting to F0:F8:F2:C6:AA:5F with channel ID 46828547 and pin 0 2024-09-05 07:10:48.768 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connected and paired 2024-09-05 07:10:48.844 WARNING (MainThread) [automower_ble.mower] Response failed validation 2024-09-05 07:10:48.934 INFO (MainThread) [custom_components.husqvarna_automower_ble] Connected to Automower: Automower 310 2024-09-05 07:10:48.935 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Polling device 2024-09-05 07:10:49.010 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] battery level: 97 2024-09-05 07:10:49.090 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] activity: 0 2024-09-05 07:10:49.158 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] state: 2 2024-09-05 07:10:49.234 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] next_start_time: None 2024-09-05 07:10:49.309 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] errorCode: 0 2024-09-05 07:10:49.383 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] NumberOfMessages: 50 2024-09-05 07:10:49.460 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] RemainingChargingTime: 0 2024-09-05 07:10:49.572 ERROR (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Unexpected error fetching husqvarna_automower_ble data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/husqvarna_automower_ble/coordinator.py", line 129, in _async_update_data data["statistics"] = await self.mower.command("GetAllStatistics") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/mower.py", line 50, in command response_dict = command.parse_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/protocol.py", line 208, in parse_response raise ValueError( ValueError: Data length mismatch. Read 28 bytes of 24 2024-09-05 07:10:49.575 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Finished fetching husqvarna_automower_ble data in 0.640 seconds (success: False) 2024-09-05 07:10:49.576 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Shutdown

erlandp commented 6 days ago

I get the same. Intergration version 0.0.7. PIN disabled (security setting 'Low'). All previously paired devices deleted from mower. I get the same with PIN set (security setting 'High').

2024-09-06 14:13:50.667 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connecting to 00:81:F9:5E:BB:00 with channel ID 1565583050 and pin 0 2024-09-06 14:13:56.996 DEBUG (MainThread) [custom_components.husqvarna_automower_ble] connected and paired 2024-09-06 14:13:57.202 INFO (MainThread) [custom_components.husqvarna_automower_ble] Connected to Automower: Automower 315 2024-09-06 14:13:57.203 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Polling device 2024-09-06 14:13:57.313 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] battery level: 100 2024-09-06 14:13:57.407 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] activity: 5 2024-09-06 14:13:57.509 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] state: 7 2024-09-06 14:13:57.612 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] next_start_time: 2024-09-07 11:00:00+00:00 2024-09-06 14:13:57.714 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] errorCode: 0 2024-09-06 14:13:57.843 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] NumberOfMessages: 50 2024-09-06 14:13:57.936 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] RemainingChargingTime: 653 2024-09-06 14:13:58.031 ERROR (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Unexpected error fetching husqvarna_automower_ble data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/husqvarna_automower_ble/coordinator.py", line 129, in _async_update_data data["statistics"] = await self.mower.command("GetAllStatistics") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/mower.py", line 50, in command response_dict = command.parse_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/automower_ble/protocol.py", line 208, in parse_response raise ValueError( ValueError: Data length mismatch. Read 28 bytes of 24 2024-09-06 14:13:58.038 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Finished fetching husqvarna_automower_ble data in 0.835 seconds (success: False) 2024-09-06 14:13:58.039 DEBUG (MainThread) [custom_components.husqvarna_automower_ble.coordinator] Shutdown