Giter Site home page Giter Site logo

Timeout under home assistant about pynetgear HOT 9 CLOSED

matmaul avatar matmaul commented on September 16, 2024
Timeout under home assistant

from pynetgear.

Comments (9)

dshokouhi avatar dshokouhi commented on September 16, 2024

I am also seeing this error on my Nighthawk X8, typically when this happens a device that is home get marked as not_home temporarily.

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 389, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 309, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.1', port=5000): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/pynetgear/__init__.py", line 236, in _make_request
    data=message, timeout=10, verify=False)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 521, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.1.1', port=5000): Read timed out. (read timeout=10)
2018-06-21 09:55:47 WARNING (SyncWorker_4) [homeassistant.components.device_tracker.netgear] Error scanning devices```

from pynetgear.

MatMaul avatar MatMaul commented on September 16, 2024

Let's increase to 1mn then. I just hope it doesn't lead to weird effects because I think the default delay between polling update is 12s in home-assistant.

from pynetgear.

MatMaul avatar MatMaul commented on September 16, 2024

or 30s should be enough.

from pynetgear.

michaelblight avatar michaelblight commented on September 16, 2024

I'm keen to test. I did try changing the code myself, but I'm new to Python and Ubuntu. Despite making a change, when I tested it I still got "(read timeout=10)" in the error, so I assume whatever I did was wrong.

According to this the default scan interval is 12 seconds, which can be overridden.

What about running a test where you set the timeout large (eg. 1mn) and I run it outside HA to confirm that it is actually timing out and not getting "stuck" on one of my devices for some reason. If it still times out after a minute there must be something else going on. If it does finish, then we have to worry about the impact of HA wanting to scan again 12 seconds later.

from pynetgear.

michaelblight avatar michaelblight commented on September 16, 2024

I tried modifying it myself again, and this time it worked. I just changed the two timeouts at lines 245 and 253 in __init__.py from 10 to 100. It ran successfully outside HA.

I have HA running inside Docker, and I'm struggling to understand how I get that version to update. Given that the error provides the path, and that's the file I'm editing, I would have thought a restart of HA would pick up that version, but no.

I noticed @MatMaul has changed the timeout to 30s, so I tried to update to this version, but I don't know how to do it properly so it didn't work. I used Portainer to connect to the HA Docker container and ran pip3 install --upgrade pynetgear, which did "stuff" but the error in HA showed timeout=10 again. And I upgraded HA to 0.72.1 using hassio but that didn't pull the newer version so it still timed out after 10 seconds.

Do you know how I can update the version in HA to test it works there?

from pynetgear.

MatMaul avatar MatMaul commented on September 16, 2024

A new version has not been released yet for pypi registry. In the meantime you can do:
pip uninstall pynetgear
pip install git+https://github.com/MatMaul/pynetgear.git

from pynetgear.

michaelblight avatar michaelblight commented on September 16, 2024

That works within the container until I restart HA. After a restart the original timeout is restored.

I'm not sure if HA retries after 12 minutes if it gets this error. I left it running for a while, and only one error shows up suggesting that either it only errored once or it stops retrying after the error. Since my iPhone is on Wifi and shows up in Netgear Genie, but HA still thinks it is "not_home", it looks like it's not trying again. If this is the case, I can't test in within HA.

from pynetgear.

michaelblight avatar michaelblight commented on September 16, 2024

@MatMaul - Given this seems to be working, what are the next steps to getting it updated in the repository and have HA require the new version? Is there anything I can help with?

from pynetgear.

MatMaul avatar MatMaul commented on September 16, 2024

New version released, update sent to home-assistant.
home-assistant/core#15768

from pynetgear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.