mikey0000 / Mammotion-HA

Home Assistant integration for Luba, Luba 2 and Yuka (Mammotion) lawn mowers
157 stars 23 forks source link

KeyError: 'string' after trying to sync map #99

Closed nijel closed 1 month ago

nijel commented 2 months ago

The problem

I think this has happened after pressing map synchronization:

2024-09-01 13:16:39.293 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 1055, in _on_mqtt_message
    await self._handle_mqtt_message(topic, payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 1187, in _handle_mqtt_message
    await self._parse_mqtt_response(topic=topic, payload=payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 1164, in _parse_mqtt_response
    self._update_raw_data(cast(bytes, binary_data))
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 390, in _update_raw_data
    tmp_msg = LubaMsg().parse(data)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 701, in _postprocess_single
    fmt = _pack_fmt(meta.proto_type)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 281, in _pack_fmt
    return {
           ^
KeyError: 'string'

What Mammotion mower are you using?

Luba 2

What version of the Mammotion intergration are you using?

0.1.11

What version of Home Assistant Core are you running?

core-2024.8.3

mikey0000 commented 2 months ago

Thanks for the report, there is something weird/wrong with the protobuf for getting the area names for some devices, haven't worked out what the problem is exactly.

mikey0000 commented 1 month ago

Can you retry this please?

nijel commented 1 month ago

It crashed the same with 0.1.24:

2024-09-12 14:00:48.426 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 110, in _on_mqtt_message
    await self._handle_mqtt_message(topic, payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 130, in _handle_mqtt_message
    await self._parse_mqtt_response(topic=topic, payload=payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 124, in _parse_mqtt_response
    await self.mqtt_message_event.data_event(event)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/event/event.py", line 61, in data_event
    await self.on_data_event(data)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/event/event.py", line 18, in __call__
    await asyncio.gather(*[handler(*args, **kwargs) for handler in self.__eventhandlers])
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 226, in _parse_message_for_device
    self._update_raw_data(binary_data)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/base.py", line 89, in _update_raw_data
    tmp_msg = LubaMsg().parse(data)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 701, in _postprocess_single
    fmt = _pack_fmt(meta.proto_type)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 281, in _pack_fmt
    return {
           ^
KeyError: 'string'

0.1.28 crashes for me during setup, see https://github.com/mikey0000/Mammotion-HA/issues/122

nijel commented 1 month ago

The crash looks still the same on 0.1.28:

2024-09-13 07:54:58.047 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 111, in _on_mqtt_message
    await self._handle_mqtt_message(topic, payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 131, in _handle_mqtt_message
    await self._parse_mqtt_response(topic=topic, payload=payload)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 125, in _parse_mqtt_response
    await self.mqtt_message_event.data_event(event)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/event/event.py", line 61, in data_event
    await self.on_data_event(data)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/event/event.py", line 18, in __call__
    await asyncio.gather(*[handler(*args, **kwargs) for handler in self.__eventhandlers])
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 227, in _parse_message_for_device
    self._update_raw_data(binary_data)
  File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/base.py", line 92, in _update_raw_data
    tmp_msg = LubaMsg().parse(data)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 718, in _postprocess_single
    value = cls().parse(value)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 759, in parse
    value = self._postprocess_single(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 701, in _postprocess_single
    fmt = _pack_fmt(meta.proto_type)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/betterproto/__init__.py", line 281, in _pack_fmt
    return {
           ^
KeyError: 'string'
2024-09-13 07:56:37.408 ERROR (SyncWorker_53) [pymammotion.aliyun.cloud_gateway] Error in sending cloud command: 500 - None
mikey0000 commented 1 month ago

fixed in 0.1.32

mele1978 commented 1 month ago

0.1.34 installed. Unfortunately the error is back during mowing. 4 hours after starting the job for today.

2024-09-16 12:25:18.845 ERROR (SyncWorker_49) [pymammotion.aliyun.cloud_gateway] Error in sending cloud command: 500 - None

mikey0000 commented 1 month ago

Please don't post in closed issues. A 500 error is a problem with aliyun servers and there is little I can do about it.