MTrab/landroid_cloud

Still uncaught thread exception

GSzabados opened this issue ยท 13 comments

Describe the issue

Similar issue different words. Referring to #381

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

What version of the Landroid Cloud integration do you have installed

4.0.4

What type of installation are you running?

Home Assistant OS

Which make and model is the mower used for this integration?

Worx Landroid M500

Diagnostics information (NOT log entries!)

None

Relevant log entries

Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:481
First occurred: 30 March 2024 at 19:00:37 (3 occurrences)
Last logged: 30 March 2024 at 19:00:37

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
         ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
         ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
         ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3330, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.12/site-packages/pyworxcloud/utils/mqtt.py", line 149, in _forward_on_message
    self._on_update(msg)
  File "/usr/local/lib/python3.12/site-packages/pyworxcloud/__init__.py", line 392, in _on_update
    self._decode_data(device)
  File "/usr/local/lib/python3.12/site-packages/pyworxcloud/__init__.py", line 496, in _decode_data
    date = datetime.fromisoformat(data["dat"]["tm"])
                                  ~~~~~~~~~~~^^^^^^
KeyError: 'tm'

Additional information

No response

If you need, I will email you the diagnostics. But, I am still not happy with all the information included there. GPS coords and PIN code!!!

I am also seeing this error:

Apr 04 11:43:09 CentOS7 podman[31155]: 2024-04-04 11:43:09.592 ERROR (Thread-76 (_thread_main)) [root] Uncaught thread exception
Apr 04 11:43:09 CentOS7 podman[31155]: Traceback (most recent call last):
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
Apr 04 11:43:09 CentOS7 podman[31155]: self.run()
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/threading.py", line 1010, in run
Apr 04 11:43:09 CentOS7 podman[31155]: self._target(*self._args, **self._kwargs)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
Apr 04 11:43:09 CentOS7 podman[31155]: self.loop_forever(retry_first_connection=True)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
Apr 04 11:43:09 CentOS7 podman[31155]: rc = self._loop(timeout)
Apr 04 11:43:09 CentOS7 podman[31155]: ^^^^^^^^^^^^^^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1164, in _loop
Apr 04 11:43:09 CentOS7 podman[31155]: rc = self.loop_read()
Apr 04 11:43:09 CentOS7 podman[31155]: ^^^^^^^^^^^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1556, in loop_read
Apr 04 11:43:09 CentOS7 podman[31155]: rc = self._packet_read()
Apr 04 11:43:09 CentOS7 podman[31155]: ^^^^^^^^^^^^^^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
Apr 04 11:43:09 CentOS7 podman[31155]: rc = self._packet_handle()
Apr 04 11:43:09 CentOS7 podman[31155]: ^^^^^^^^^^^^^^^^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
Apr 04 11:43:09 CentOS7 podman[31155]: return self._handle_publish()
Apr 04 11:43:09 CentOS7 podman[31155]: ^^^^^^^^^^^^^^^^^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3330, in _handle_publish
Apr 04 11:43:09 CentOS7 podman[31155]: self._handle_on_message(message)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
Apr 04 11:43:09 CentOS7 podman[31155]: on_message(self, self._userdata, message)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/config/deps/lib/python3.12/site-packages/pyworxcloud/utils/mqtt.py", line 149, in _forward_on_message
Apr 04 11:43:09 CentOS7 podman[31155]: self._on_update(msg)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/config/deps/lib/python3.12/site-packages/pyworxcloud/__init__.py", line 392, in _on_update
Apr 04 11:43:09 CentOS7 podman[31155]: self._decode_data(device)
Apr 04 11:43:09 CentOS7 podman[31155]: File "/config/deps/lib/python3.12/site-packages/pyworxcloud/__init__.py", line 496, in _decode_data
Apr 04 11:43:09 CentOS7 podman[31155]: date = datetime.fromisoformat(data["dat"]["tm"])
Apr 04 11:43:09 CentOS7 podman[31155]: ~~~~~~~~~~~^^^^^^
Apr 04 11:43:09 CentOS7 podman[31155]: KeyError: 'tm'

This occurs when the mover shuts down and not all data is available anymore in the cloud. Due to this error, the integration fails and does not restart by itself, it not even tries to recover itself anymore.

Is there a way to fix it? I have turned the mower on and had it run in the yard for a bit. It can be accessed in the app.

Yep, reload the integration.

Eric, have you moved from ST to Home Assistant? ๐Ÿ˜‰

Eric, have you moved from ST to Home Assistant? ๐Ÿ˜‰

I moved from ST to Hubitat and have been in a 2+ year long transition from Hubitat to Home Assistant LOL.

I still use some of your Sonoff binaries. They do the job and I couldn't be bothered to replace them with Tasmota or ESPHome yet.

I guess you ran into this issue when the mower powered down unintentionally. I saw all the thread exceptions when the mower stuck and powers off, or the border wire has issues and the mower stops and powers down, or just it cannot make a proper contact with the base and runs out of battery and you can guess, powers down. Unfortunately you need to reload the integration to recover from this.

Thanks, I'll keep that in mind and know what to do when my mower dies again.

As for the Sonoff, I still have a bunch of them up and running. If it aint broke, don't fix it. :)

Could you please attach the diagnostics - something seems off, as line 496 in pyworxcloud init file isn't what's displayed here

I will email you once I get back in front of the computer. Otherwise, it is not good that the diagnostic contains the geo part, and a clear PIN of the mower.

Arh sorry - my bad. Had forgot to update my dev env on this machine. I'll do a patch that will be included in next release

Thanks for that! Have a lovely day!