home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

Roomba firmware 3.0.11 appears to break roomba component #27028

Closed kbx81 closed 4 years ago

kbx81 commented 4 years ago

Home Assistant release with the issue: 0.99.3

Last working Home Assistant release (if known): 0.99.3

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io 189 on RPi 3 B+

Component/platform: https://www.home-assistant.io/components/roomba/

Description of problem: My iRobot Roomba i7+ received a firmware update to version 3.0.11 on September 27th. It appears that, since this update, the component fails (or causes the cloud component to fail?) at startup.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

vacuum:
  - platform: roomba
    host: 10.9.8.7
    username: [redacted]
    password: [redacted]

Removing this configuration results in HA starting normally.

Traceback (if applicable):

2019-09-27 20:53:41 ERROR (MainThread) [homeassistant.setup] Error during setup of component cloud
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 566, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 534, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1771, in _run_once
    handle._run()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 108, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/cloud/__init__.py", line 189, in async_setup
    user = await hass.auth.async_get_user(prefs.cloud_user)
  File "/usr/src/homeassistant/homeassistant/auth/__init__.py", line 135, in async_get_user
    return await self._store.async_get_user(user_id)
  File "/usr/src/homeassistant/homeassistant/auth/auth_store.py", line 72, in async_get_user
    await self._async_load()
  File "/usr/src/homeassistant/homeassistant/auth/auth_store.py", line 289, in _async_load
    await self._async_load_task()
  File "/usr/src/homeassistant/homeassistant/auth/auth_store.py", line 296, in _async_load_task
    self._store.async_load(),
concurrent.futures._base.CancelledError

After restoring onto a new SD card, the error is slightly different:

2019-09-28 04:04:34 ERROR (MainThread) [homeassistant.components.binary_sensor] octoprint: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 566, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 534, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1771, in _run_once
    handle._run()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 108, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
concurrent.futures._base.CancelledError

Additional information: Things I've tried in an effort to fix:

It is absolutely possible that the firmware update breaking the component is somehow a coincidence, however I can say with absolute certainty it has was working the day prior to the firmware update. No HA updates or configuration changes were made between when it was last working and when it stopped working so I'm not sure what else to attribute this new error to.

rccoleman commented 4 years ago

I have the same issue with the same firmware update and Roomba version. As with you, commenting out the Roomba section in configuration.yaml allows HA to start. For me, I believe there was an ERROR 104 When first connecting to the Roomba and preceding the cascading failures.

probot-home-assistant[bot] commented 4 years ago

Hey there @pschmitt, mind taking a look at this issue as its been labeled with a integration (roomba) you are listed as a codeowner for? Thanks!

rccoleman commented 4 years ago

The MQTT port (1883) is showing up as "filtered" when probed with nmap, so presumably that's why it's failing.

ratsputin commented 4 years ago

I'm having a similar problem with 0.98.5. Commenting out the Roomba section was the only recourse. Interestingly, HA continued to talk to my Roomba 980. Apparently there wasn't an update for it.

As a side note, in my case I'm running the Roomba980-Python library rather than the Roomba support built into HA (that doesn't work for me). I just checked the status and nobody has reported issues with the library as yet.

@kbx81, are you running the stock component? I was under the impression it was not compatible with the 980 nor the i7.

rccoleman commented 4 years ago

I’m running the stock Roomba component and it’s been working fine with my i7+ since I got it last year. It also worked with my 980.

kbx81 commented 4 years ago

@ratsputin I will assure you that the stock component has been working flawlessly with the i7(+) I have for months now -- this is not a new setup that randomly doesn't work (or that broke after an HA upgrade/reconfig). :) I'm familiar with Roomba980-Python as well as dorita but haven't tried to pull either of them into HA. I actually used dorita to determine (and verify the other day) my robot's credentials for its config in HA. It was still able to communicate with the robot although I didn't try to use it for control.

mcaminiti commented 4 years ago

I just ran into the same issue today as my Roomba i7 updated to the same firmware. Been using it with the 980 python code since it came out.

namachieli commented 4 years ago

Same issue with my S9+, same error. commenting it out of configuration.yaml lets everything start up normally.

namachieli commented 4 years ago

So i found https://github.com/NickWaterton/Roomba980-Python/issues/39#issuecomment-538665656 Which lead me to https://github.com/zhouF96/Roomba980-Python/commit/ede7e95e5b10c7e1d52154815f96098859287365

And that does seem to be the issue. I manually edited the following in HA

/usr/local/lib/python3.7/site-packages/roomba/roomba.py
/usr/local/lib/python3.7/site-packages/roomba/password.py  

and changed TLSv1 to TLS, and when i started back up, everything was happy again.

You can run the following to fix it. The first line makes a backup of all .py files, the second uses sed to make a global inline replacement.

for file in /usr/local/lib/python3.7/site-packages/roomba/*.py; do cp "$file" "${file}.bak"; done
sed -i 's/PROTOCOL_TLSv1/PROTOCOL_TLS/g' /usr/local/lib/python3.7/site-packages/roomba/*.py

Looks like @NickWaterton patched it, so we just need https://pypi.org/project/roombapy/ updated, and https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/roomba/manifest.json updated to that version.

ratsputin commented 4 years ago

@namachieli Thanks so much for tracking this down. I made the suggested changes and my i7+ is once again working.

crkochan commented 4 years ago

I opened a PR on the roombapy repository to try to get the package authors attention.

kbx81 commented 4 years ago

Bump. 😄

kbx81 commented 4 years ago

FWIW I made the above fixes/patches to password.py and roomba.py in my (now) 0.102 HA container and the robot is back and working in HA.

Is anyone able to act on the PR and get the fix merged in so it can get released? 😄