pschmitt / roombapy

Python program and library to control Wi-Fi enabled iRobot Roombas
MIT License
32 stars 21 forks source link

Missing state for disconnected base (charging error) #67

Closed gralin closed 3 years ago

gralin commented 3 years ago

Hi! I've noticed that my Roomba stopped getting updated in my HomeAssistant. In HA logs I saw, that most likely it's caused by unsupported state value of chargingerror which causes the library to throw and exception. I have reported this issue also in HomeAssistant repository if you want to see the stacktrace and Roomba state in my iRobot mobile app.

I have checked the original repo from which this one was forked from, and it seems they have added the missing state:

https://github.com/NickWaterton/Roomba980-Python/blob/02321f31d7a23216ac36a7aa5b10289fd3093a44/roomba/roomba.py#L276

Would it be possible to include it here too? Thank you!

freekode commented 3 years ago

Yep

freekode commented 3 years ago

Logs for devs:

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1572, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2310, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
    self.on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.8/site-packages/roombapy/roomba.py", line 234, in on_message
    self.decode_topics(json_data)
  File "/usr/local/lib/python3.8/site-packages/roombapy/roomba.py", line 387, in decode_topics
    self.update_state_machine()
  File "/usr/local/lib/python3.8/site-packages/roombapy/roomba.py", line 502, in update_state_machine
    self.current_state = ROOMBA_STATES[self.cleanMissionStatus_phase]
KeyError: 'chargingerror'
gralin commented 3 years ago

Thank you @pschmitt and @freekode 😃 Now we need this to be propagated to HA. I will continue the thread in HA repository issue.

gralin commented 3 years ago

Oh, is there a chance to make a release available on PyPi? Or you need to finish other things first?

gralin commented 3 years ago

Hi again @pschmitt just wanted to ask if you are planning any release on pypi? Without it we can't fix the issue in the integration in HomeAssistant. Thanks!

pschmitt commented 3 years ago

I just published 1.6.3

https://pypi.org/project/roombapy/1.6.3/