Skip to content

GetAllStatistics - Error 'Data length mismatch. Read 28 bytes of 24' #88

@Marcussjogren

Description

@Marcussjogren

Hi,

When I am running the code on my Huqsvarna 440 I get the below error. Seems like the received data is larger than expected.

I commented line 207-209 and now it's working but I guess I'm missing the statistics.

I will try to resolve it - but I think this is out of my competence :)

Line 207 - 209:

#    statuses = await mower.command("GetAllStatistics")
#    for status, value in statuses.items():
#        print(status, value)

This was the error that I was receiving before.

No next start time
2024-12-16 19:31:20,940 protocol INFO: Writing: b'02fd1000b63b604701a100af761200000000ef03'
2024-12-16 19:31:21,024 protocol INFO: Received: b'02fd2900b63b6047017901af76120000001800e8'
2024-12-16 19:31:21,027 protocol INFO: Received: b'0ca6007ffe9d000b8e2700690e0800a8770000b7'
2024-12-16 19:31:21,032 protocol INFO: Received: b'0200006303'
2024-12-16 19:31:21,040 protocol INFO: Final response: b'02fd2900b63b6047017901af76120000001800e80ca6007ffe9d000b8e2700690e0800a8770000b70200006303'
Traceback (most recent call last):
  File "/home/pi/AutoMower-BLE/automower_ble/mower.py", line 299, in <module>
    asyncio.run(main(mower))
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/pi/AutoMower-BLE/automower_ble/mower.py", line 207, in main
    statuses = await mower.command("GetAllStatistics")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/AutoMower-BLE/automower_ble/mower.py", line 50, in command
    response_dict = command.parse_response(response)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/AutoMower-BLE/automower_ble/protocol.py", line 208, in parse_response
    raise ValueError(
ValueError: Data length mismatch. Read 28 bytes of 24

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions