mrin / domoticz-mirobot-plugin

Xiaomi Mi Robot Vacuum plugin for Domoticz
57 stars 28 forks source link

Hardware thread ends unexpectedly #28

Open pgielen opened 4 years ago

pgielen commented 4 years ago

The Xiaomi Mi robot vacuum plugin crashes if I change the plugin setting in the Hardware tab (to turn debug mode on or off). The plugin then stops with the error message:

2020-04-10 10:24:26.425 Error: S5 hardware (15) thread seems to have ended unexpectedly

In debug mode, the log then shows:

2020-04-10 12:25:40.482 (S5) Pushing 'DisconnectDirective' on to queue
2020-04-10 12:25:40.491 (S5) Processing 'DisconnectDirective' message
2020-04-10 12:25:40.491 (S5) Disconnect directive received for '127.0.0.1:22222'.
2020-04-10 12:25:40.491 (S5) Handling TCP disconnect, socket (127.0.0.1:22222) is connected
2020-04-10 12:25:40.491 (S5) Queued asynchronous read aborted (127.0.0.1:22222), [125] Operation canceled.
2020-04-10 12:25:40.491 (S5) Pushing 'DisconnectedEvent' on to queue
2020-04-10 12:25:40.541 (S5) Processing 'DisconnectedEvent' message
2020-04-10 12:25:40.541 (S5) Disconnect event received for '127.0.0.1:22222'.
2020-04-10 12:25:40.541 (S5) Pushing 'onDisconnectCallback' on to queue
2020-04-10 12:25:40.541 (S5) Pushing 'onStopCallback' on to queue
2020-04-10 12:25:40.541 (S5) Processing 'onDisconnectCallback' message
2020-04-10 12:25:40.541 (S5) Calling message handler 'onDisconnect'.
2020-04-10 12:25:40.541 (S5) MIIOServer disconnected
2020-04-10 12:25:40.541 (S5) Processing 'onStopCallback' message
2020-04-10 12:25:40.541 (S5) Calling message handler 'onStop'.
2020-04-10 12:25:40.482 Status: (S5) Stop directive received.
2020-04-10 12:25:40.482 Status: (S5) Exiting work loop.
2020-04-10 12:25:40.582 Status: (S5) Stopping threads.
2020-04-10 12:25:40.582 Status: (S5) Stopped.
2020-04-10 12:25:40.582 Status: (S5) Started.
2020-04-10 12:25:40.691 Error: (xiaomi-mi-robot-vacuum) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/xiaomi-mirobot/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-04-10 12:25:40.691 Error: (S5) Module Import failed, exception: 'AttributeError'
2020-04-10 12:25:40.691 Error: (S5) Error Line details not available.

These last 3 lines indicate that plugin.py failed to load. I checked: plugin.py is indeed in the right folder and the attributes allow execution:

pi@smarthome:~/domoticz/plugins/xiaomi-mirobot $ ls -l
total 60
-rwxr-xr-x 1 pi   pi    9694 Apr  7 15:12 icons.zip
-rwxr-xr-x 1 pi   pi    5846 Apr  7 15:12 miio_server.py
-rwxr-xr-x 1 pi   pi    1755 Apr  7 15:18 miio_server.sh
-rw-r--r-- 1 pi   pi     343 Apr  7 15:12 pip_req.txt
-rwxr-xr-x 1 pi   pi   15493 Apr  7 15:12 plugin.py
drwxr-x--- 2 root root  4096 Apr  7 15:27 __pycache__
-rwxr-xr-x 1 pi   pi    5594 Apr  7 15:12 README.md
-rwxr-xr-x 1 pi   pi    1065 Apr  7 15:12 test.py

The only way to reset the plugin is to reboot the RPi.

pgielen commented 4 years ago

The script has been running stable now for several days. But if I toggle Debug status on or off it still crashes. That seems to be the real issue here.