pynetgear: Failed to Login > Error setting up platform netgear (More Details Enclosed)

Platform Old Laptop running fresh install of Linux Mint, running Home Assistant in Docker. Installed HA using these directions, with a few minor detours

  1. Needing to update python3, since Linux Mint natively comes with 3.5.3. Followed this guide to install python 3.6 along side the typical python3 installation of mint as to not disturb any of linux mint’s other functionality.
  2. Needing to pip install docker.io, the default docker library for linux mint, instead of the docker mentioned in the gist
  3. Running each command from the gist individually instead of running the script as a whole.

Home Assistant Version 0.79.3

Router Model Netgear C3000

Problem Simply put, cannot get Netgear component to work as device_tracker. Fails to login. I’ve confirmed the credentials are correct. No matter what I try I cannot seem to get the component configured.

Setup Variations I’ve tried in Configuration.yaml

device_tracker:
  - platform: netgear
    host: 192.168.0.1
    port: 80
    username: admin
    password: REDACTED
device_tracker:
  - platform: netgear
    host: 192.168.0.1
    username: admin
    password: REDACTED
device_tracker:
  - platform: netgear
    password: REDACTED

Full Log

2018-10-04 08:04:46 ERROR (MainThread) [homeassistant.components.device_tracker] Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
2018-10-04 08:04:47 ERROR (SyncWorker_3) [pynetgear] Error talking to API
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pynetgear/__init__.py", line 247, in _make_request
    data=message, timeout=30, verify=False)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 495, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2018-10-04 08:04:47 ERROR (SyncWorker_3) [homeassistant.components.device_tracker.netgear] Failed to Login
2018-10-04 08:04:47 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform netgear
018-10-04 12:15:55 WARNING (SyncWorker_0) [netdisco.ssdp] Found malformed XML at http://192.168.0.10:9080: status=ok

Edit I should also note that the laptop running the HA instance is connected directly to the router via Ethernet cable. Edit 2 I notice my router isn’t included on the Supported Routers List, but I can access & manage the router using the Netgear Genie android app and my device is listed in the acceptable devices in the nodejs version of this program that this was ported over from.

CC: @MatMaul

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 58 (44 by maintainers)

Most upvoted comments

merged, and I just added my logging changes. I’ll merge another PR and release a new version this weekend. Please continue testing with the new commits, always helpful to validate a bit before release, and the more the better 😃

@caffeinatedMike I’ll probably release a new version this weekend. I am adding proper logging so we can get useful debug logs when debugging.

Can you test what fields are really necessary for you in the header ? I am mainly interesting in removing Connection: Keep-Alive because I think we don’t do keep-alive so we are kind of lying 😃

If you can also test with multipart/form-data as a content type as mentioned by @gruijter .

@caffeinatedMike BOOHOOHOO indeed 😃 At least we managed to get the new login method operational!

But are you sure the content-type should be ‘application/xml’? In all the genie captures on my R7000 and R7800 the content-type is set to ‘multipart/form-data’. …

It would be great if you could test my node version, so that I get confirmation that your C3000 is supported. Testing from a (e.g. windows) desktop is real easy:

// INSTRUCTIONS FOR TESTING FROM DESKTOP: install node (https://nodejs.org) install this package: > npm i netgear run the test (from the test folder): > node test password

Haha, all I can say is long day 😛

Super! Together we’ll bring that netgear soap mess down on its knees 👍

You can change line 87/88 and LOGIN_BODY at line 380 to match your finding and see if it helps.