Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when listing robots #18

Closed
bphermansson opened this issue Jul 13, 2018 · 7 comments · Fixed by #19 or #68
Closed

Crash when listing robots #18

bphermansson opened this issue Jul 13, 2018 · 7 comments · Fixed by #19 or #68

Comments

@bphermansson
Copy link

Hi!

Gets this message when I try to use the code:


$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pybotvac import Account
>>> for robot in Account('[email protected]', '<hidden>').robots: print(robot)
... 
/usr/lib/python3/dist-packages/urllib3/connection.py:266: SubjectAltNameWarning: Certificate for nucleo.neatocloud.com has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/account.py", line 64, in robots
    self.refresh_robots()
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/account.py", line 108, in refresh_robots
    traits=robot['traits']))
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 37, in __init__
    if self.service_version not in SUPPORTED_SERVICES:
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 150, in service_version
    return self.available_services['houseCleaning']
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 146, in available_services
    return self.state['availableServices']
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 142, in state
    return self.get_robot_state().json()
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 118, in get_robot_state
    return self._message({'reqId': "1", 'cmd': "getRobotState"})
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 55, in _message
    headers=self._headers)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 107, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 454, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 388, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python3/dist-packages/requests/models.py", line 297, in prepare
    self.prepare_auth(auth, url)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 490, in prepare_auth
    r = auth(self)
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 170, in __call__
    signing = hmac.new(key=self.secret.encode('utf8'),
AttributeError: 'NoneType' object has no attribute 'encode'

I have two robots listed at my Neato account.

@bphermansson
Copy link
Author

Problem is solved for me now, working as expected.

@fermulator
Copy link
Contributor

There appears to be insufficient information here to explain if/how anything was fixed. As per home-assistant/core#11968, users with newer Neato Botvacs are experiencing issues with connectivity. Some suspect due to the newer standard of "OPS" prefix in the serial number.

Can we please re-open this ticket? (or is it to be deemed the same as #30)?

@fermulator
Copy link
Contributor

Just confirmed (pip3 latest pybotvac), same issue still:

>>> for robot in Account('[email protected]', '(SNIPPED_PASSWORD)').robots: print(robot)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/account.py", line 63, in robots
    self.refresh_robots()
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/account.py", line 109, in refresh_robots
    endpoint=robot['nucleo_url']))
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 41, in __init__
    if self.service_version not in SUPPORTED_SERVICES:
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 213, in service_version
    return self.available_services['houseCleaning']
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 209, in available_services
    return self.state['availableServices']
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 205, in state
    return self.get_robot_state().json()
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 163, in get_robot_state
    return self._message({'reqId': "1", 'cmd': "getRobotState"})
  File "/usr/local/lib/python3.5/dist-packages/pybotvac/robot.py", line 60, in _message
    response.raise_for_status()
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://nucleo.neatocloud.com/vendors/neato/robots/OPS#####-B#A#AAB#B##B/messages

My bot is fully functional, on the WiFi, powered on, etc. (works fully from NeatoApp directly)

@fermulator
Copy link
Contributor

Perhaps this issue was confounded. The merge implies the fix was to ignore robots not connected/online. OK. But in #30, this may describe another problem, which I am experiencing.

@stianaske stianaske reopened this Jan 8, 2019
@fermulator
Copy link
Contributor

fermulator commented Jul 12, 2019

@bphermansson , please confirm if issue is still present for you?
(the re-open may not be required now)

The above snippet you provided works for me

Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609] on linux

>>> from pybotvac import Account
>>> for robot in Account('<SNIP>', '<SNIP>').robots: print(robot)
... 
Your 'boyle-ORIGINAL' robot is offline.
Name: boyle, Serial: (SNIP) Traits: ['maps']
Help on package pybotvac:

NAME
    pybotvac

PACKAGE CONTENTS
    account
    robot
    version

VERSION
    0.0.13

FILE
    /home/fermulator/projects/pybotvac/pybotvac/__init__.py

@fermulator
Copy link
Contributor

@stianaske , let's close

@Santobert
Copy link
Contributor

Santobert commented Jan 10, 2021

It seems that this problem occurs when the robots are not fully set up at Neato. There are situations where a robot was set up twice and the old robot was responsible for these errors. In other situations, an old robot that was not actively being used caused these errors.

Unfortunately, this trick with the Mac address doesn't always work, because fully functional robots sometimes lack the Mac address. The Mac address is also not documented, so we should not rely on it.

In #59 I had to remove that check in order to prevent false positives. Since then, there are some issues popping up again. See:

Even though I see no obvious way to solve this issue we can work around it. #68 is the first step in this direction as we skip invalid robots (those without a secret in this case) for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants