MTrab / landroid_cloud

Landroid Cloud component for Home Assistant
GNU General Public License v3.0
272 stars 33 forks source link

Still uncaught thread exception #552

Closed GSzabados closed 7 months ago

GSzabados commented 7 months ago

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

GSzabados commented 7 months ago

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!!!

erocm123 commented 7 months ago

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'
GSzabados commented 7 months ago

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.

erocm123 commented 7 months ago

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.

GSzabados commented 7 months ago

Yep, reload the integration.

GSzabados commented 7 months ago

Eric, have you moved from ST to Home Assistant? 😉

erocm123 commented 7 months ago

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.

GSzabados commented 7 months ago

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.

erocm123 commented 7 months ago

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. :)

MTrab commented 7 months ago

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

GSzabados commented 7 months ago

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.

MTrab commented 7 months ago

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

GSzabados commented 7 months ago

Thanks for that! Have a lovely day!