New Neato Integration Installation Guide (OAuth2 for HA version 2021.1)

Are you adding the integration while logged into your HTTPS accessible Home Assistant instance?

2 Likes

I am getting this exception

2021-01-08 23:15:20 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Configuration.yaml for neato
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/neato/__init__.py", line 99, in async_setup_entry
    await hass.async_add_executor_job(hub.update_robots)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/neato/__init__.py", line 140, in update_robots
    self._hass.data[NEATO_ROBOTS] = self.my_neato.robots
  File "/usr/local/lib/python3.8/site-packages/pybotvac/account.py", line 41, in robots
    self.refresh_robots()
  File "/usr/local/lib/python3.8/site-packages/pybotvac/account.py", line 78, in refresh_robots
    r = Robot(
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 58, in __init__
    if self.service_version not in SUPPORTED_SERVICES:
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 284, in service_version
    return self.available_services["houseCleaning"]
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 280, in available_services
    return self.state["availableServices"]
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 276, in state
    return self.get_robot_state().json()
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 229, in get_robot_state
    return self._message({"reqId": "1", "cmd": "getRobotState"})
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 81, in _message
    response = requests.post(
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 456, in prepare_request
    p.prepare(
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 320, in prepare
    self.prepare_auth(auth, url)
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 551, in prepare_auth
    r = auth(self)
  File "/usr/local/lib/python3.8/site-packages/pybotvac/robot.py", line 313, in __call__
    key=self.secret.encode("utf8"),
AttributeError: 'NoneType' object has no attribute 'encode'

and

2021-01-08 23:15:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 172, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 429, in get
    await hass.config_entries.flow.async_configure(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 155, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
    self._progress.pop(flow.flow_id)
KeyError: 'e80c360d5e9c4c97b43fd595fdb00c2e'

The callback results in a page:

500 Internal Server Error

Server got itself in trouble

First error is caused by neatos API returning invalid data, check the status of the botvac in the neato app and possibly reconnect it to the app. The 500 error not sure about, double check your URLā€™s that you are using to access HA and the ones you entered for the redirect URI and ensure they match.

1 Like

Keep beating me to it :wink:

1 Like

I created my neato credentials by using my nabu.casa URL. I also made sure to be logged into Home Assistant via this nabu.casa URL instead of through my local instance.

This allowed me to create the client_id and client_secret in the neato developers portal.

Then I created this in my packages folder

neato:
  client_id: !secret neato_clientid
  client_secret: !secret neato_secret

When I restart Home Assistant, I get a notification that one integration is not set up correctly. When I click to install it, I get

  • please wait while installing integration
  • pause
  • component is not configured correctly. please read documentation.

The text might be slightly different, my Home Assistant is in German language.

I deleted the previous neato botvac integration, restarted once again, and installed the integration from scratch. The same error will be shown.

I tried both installing a fresh neato botvac integration from my local instance and my nabu.casa instance to make sure this was not the reason for the error. It was not.

What else can I try?

Hey.

That all sounds correct :thinking:. Have you double checked that your id and secret are correct and that you are running the latest version of Home Assistant?

yeah :confused:

Same for me. Also on the same domain as the redirect url.

After going to the neato site and being redirected to home assistant, I get a blank page.

Itā€™s solved for me now.
I had an old neato vacuum cleaner in my neato account registered. That vacuum cleaner was not connected.
After removing the old device from my account, it worked.

3 Likes

Genius - Iā€™ve been going in circles with this and your tip was spot on!
Thank you!

Iā€™ve been watching this thread over the last couple fo days ā€¦ Am I right in thinking that without Nabu Casa, or SSL I wonā€™t be able to use the neato component?

Thanks.

Without SSL it is now unfortunately a no go :frowning:

Yes, you are right. But if you are looking a quick fix, generating SSL certificate (and placing the files to right directory) for your local network and installing / configuring NGINX Home Assistant SSL proxy to ports 8123/443 whatever from the addon-store is not that difficult.

I have to admit that this is frustrating me! I have had a nice and working integration that I loved that I can no longer easily use? My setup is:

  • No public exposure
  • I have connected through http://192.168.x.y:8123 on the internal network
  • I do not use Nabu-casa
  • I do not have a domain-name for my internal network
  • For some reason, https://192.168.x.y:8123 does not work, and I donā€™t know how to make it world.

Can someone make a step-by-step guide on how to make Neato working again? I donā€™t understand this comment about my instance not having to be exposed to the internet. Sorry @nullnullnul what you are proposing is something I donā€™t understand.

I am pondering if I have to:

  1. get a domain name
  2. use letā€™s encrypt
  3. expose it externally
  4. setup neato
  5. revert the exposure from step 3)
    That is however quite some work for someone who have kids and are on a strict time limit when it comes to HAā€¦ :S

https://192.168.x.y:8123/ is only available of you set up SSL either with letsencrypt or with self signed certificates. Be aware that lets encrypt needs an public accessible URL to complete the acme challenge and self signed certificates cannot be created without some knowledge about SSL. But there is an step-by-step guide: Certificate Authority and self-signed certificate for SSL/TLS

The probably easiest solution is to use nabu casa. SSL comes out of the box here. Just set up your internal and external URL accordingly afterwards and your good to go.

1 Like

Thank you very much for the video! This helped me a lot and fixed my connection problem.

1 Like

Thanks for the video. You mention twice that your home assistant requires SSL. But if you use Nabu Casa, then you donā€™t need SSL on your local setup. Was a bit confusing.

I wonder what would happen if you have more then one vacuum cleaner linked :thinking:

Lets find out! :grin:

2 Likes

The latest security issues are one more reason why storing credentials in an application is a bad idea and why OAuth2 is great. Now that we are relying on client_id and client_secret instead of username and password, someone with access to our files cannot use the stored information to log into the account. So I am happy to use OAuth2 now, even if it is a bit more complicated to set up now.

1 Like