Closed dmshimself closed 2 years ago
netgear documentation netgear source (message by IssueLinks)
Hey there @hacf-fr, @quentame, @starkillerog, mind taking a look at this issue as it has been labeled with an integration (netgear
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
I get this too when trying to connect to a RAX50 router. This script successfully prints out devices attached to my router:
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=True,
)
for i in netgear.get_attached_devices():
print(i)
The netgear integration doesn't include force_logon_v2=True
, and this script fails without it. Adding that kwarg would fix it at least in my case, but I don't have an older Netgear router to test on to see if that would break anything. It looks like pynetgear
is supposed to fall back to V2 login if V1 login fails, but it thinks that the V1 login is successful when it actually fails, so doesn't see a need to try V2.
On my SSR60, I do get devices appearing in HA just fine after the fix for 57754 was applied which was a great step forward.
@dmshimself, did you try rebooting the router? (I read somewhere else that it possible to crash the API server in the router while the router is still working fine otherwise). Is your HomeAssistant device connected with a LAN kabel to your router or through WiFi, is it possible that is times out sometimes due to a bad connection?
I can give the router and satellite a reboot tomorrow - we shall see! The HA host is on ethernet and the back haul from router to satellite is also Ethernet. I’ll report back. ......
On Fri, 5 Nov 2021 at 21:06, starkillerOG @.***> wrote:
@dmshimself https://github.com/dmshimself, did you try rebooting the router? (I read somewhere else that it possible to crash the API server in the router while the router is still working fine otherwise). Is your HomeAssistant device connected with a LAN kabel to your router or through WiFi, is it possible that is times out sometimes due to a bad connection?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/59025#issuecomment-961696804, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUU52KA24AGQLKVHMRWDLDUKOF63ANCNFSM5HKJ66UQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@karmeleon thank you verry much for the feedback, it is greath you can test some stuff with a script.
I see the RAX50 is not a Orbi router, does port 5000 work for you, or do you indeed need to use port 80? The automatic discovery of the netgear integration will use port 5000 in your case since the RAX50 is not added to the list of models that use port 80.
Normally the integration uses port 5000 with netgear.get_attached_devices() or port 80 with netgear.get_attached_devices_2() So the combination of port 80 with .get_attached_devices() is never used.
@karmeleon could you turn on debug logging for the netgear integration and post the logs about netgear here? I think the correct approach would be to see if we can corretly identify that login V1 has failed so that it automatically uses login V2.
Sure! I get this error when I enter my router's IP, port 80, and my username and password:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 246, 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 320, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/usr/src/homeassistant/homeassistant/components/netgear/config_flow.py", line 183, in async_step_user
await self.async_set_unique_id(info["SerialNumber"], raise_on_progress=False)
TypeError: 'NoneType' object is not subscriptable
I also tried a bunch of different configurations of port and hostname, and their failures are in this gist. There're a bunch of log lines starting with [homeassistant.components.netgear.config_flow] Netgear ssdp discovery info
that I left out because they didn't seem relevant, but if they are I can upload them too.
EDIT: found some more logs from the port 80 attempt:
Logger: pynetgear
Source: /usr/local/lib/python3.9/site-packages/pynetgear/__init__.py:488
First occurred: 9:41:09 AM (1 occurrences)
Last logged: 9:41:09 AM
Unauthorized response, let's login and retry...
Logger: pynetgear
Source: /usr/local/lib/python3.9/site-packages/pynetgear/__init__.py:498
First occurred: 9:41:10 AM (1 occurrences)
Last logged: 9:41:10 AM
Invalid response
These are just like what I got when my script used the V1 login type, so maybe the fix is as simple as telling this model of router to use port 80 and V2 login method?
@karmeleon that is actually very helpfull. It seems like the get_info call is failing and therefore HomeAssistant fails to get the SerialNumber.
Could you try this script and report back:
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=False,
)
print(netgear.login_v1())
print(netgear.get_info())
I think this will give a True or something on the login while the get_info call will fail
could you then also try to change to v2 and see what that gives:
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=False,
)
print(netgear.login_v2())
print(netgear.get_info())
That schould then work I think.
If that is the case we can just call the get_info() inside the login function as a test for the V1 method, if it fails we can than automatically try V2 method.
Okay, this is the output from the first script:
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
True
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Invalid response
200
{'CONTENT-LENGTH': '426', 'CONTENT-TYPE': 'text/xml; charset="UTF-8"', 'SERVER': '"OS/version" UPnP/1.0 "product/version"'}
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:GetInfoResponse
xmlns:m="urn:NETGEAR-ROUTER:service:DeviceInfo:1">
</m:GetInfoResponse>
<ResponseCode>401</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
None
I also instrumented the code with some logging of my own for outgoing and incoming HTTP messages, here's the output from that:
sending message with service ParentalControl:1 to endpoint http://192.168.1.1:80/soap/server_sa/
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<SessionID>A7D88AE69687E58D9A00</SessionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<Authenticate>
<NewUsername>admin</NewUsername>
<NewPassword>adminadmin</NewPassword>
</Authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
got response
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:AuthenticateResponse
xmlns:m="urn:NETGEAR-ROUTER:service:ParentalControl:1">
<ModelType>0</ModelType>
</m:AuthenticateResponse>
<ResponseCode>000</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
200
True
sending message with service DeviceInfo:1 to endpoint http://192.168.1.1:80/soap/server_sa/
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<SessionID>A7D88AE69687E58D9A00</SessionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<M1:GetInfo xmlns:M1="urn:NETGEAR-ROUTER:service:DeviceInfo:1">
</M1:GetInfo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
sending message with service ParentalControl:1 to endpoint http://192.168.1.1:80/soap/server_sa/
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<SessionID>A7D88AE69687E58D9A00</SessionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<Authenticate>
<NewUsername>admin</NewUsername>
<NewPassword>adminadmin</NewPassword>
</Authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
got response
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:AuthenticateResponse
xmlns:m="urn:NETGEAR-ROUTER:service:ParentalControl:1">
<ModelType>0</ModelType>
</m:AuthenticateResponse>
<ResponseCode>000</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
200
v1 success
got response
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:GetInfoResponse
xmlns:m="urn:NETGEAR-ROUTER:service:DeviceInfo:1">
</m:GetInfoResponse>
<ResponseCode>401</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
200
None
and here's the second:
Login v2
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 432
sess_id=e2ec3e6f65b984cafb4c6037bc707525e1ab9f3f677c9f2833993b2edcbe9a7ba124eb0633ec02efd755a3d9b34caf04a0ded0ed1023dbc5fb908df758340bb9; SameSite=Strict
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 1276
{'ModelName': 'RAX50', 'Description': '802.11ac Dual Band Gigabit Wireless Router RAX50', 'SerialNumber': '65C20378A02EC', 'Firmwareversion': 'V1.0.4.100', 'SmartAgentversion': '3.0', 'FirewallVersion': 'iptables v1.6.2', 'VPNVersion': 'N/A', 'OthersoftwareVersion': '2.0.64', 'Hardwareversion': 'RAX50', 'Otherhardwareversion': 'N/A', 'FirstUseDate': 'Thursday, 04 Nov 2021 13:24:53', 'DeviceName': 'RAX50', 'FirmwareDLmethod': 'HTTPS', 'FirmwareLastUpdate': '2019_10.27_9:6:14', 'FirmwareLastChecked': '2019_10.27_9:6:14', 'DeviceMode': '0', 'DeviceModeCapability': '0', 'DeviceNameUserSet': 'false'
network traffic:
sending message with service DeviceConfig:1 to endpoint http://192.168.1.1:80/soap/server_sa/ [17/1329]
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<SessionID>A7D88AE69687E58D9A00</SessionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<M1:SOAPLogin xmlns:M1="urn:NETGEAR-ROUTER:service:DeviceConfig:1">
<Username>admin</Username>
<Password>adminadmin</Password>
</M1:SOAPLogin> </SOAP-ENV:Body> </SOAP-ENV:Envelope> got response
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:SOAPLoginResponse
xmlns:m="urn:NETGEAR-ROUTER:service:DeviceConfig:1">
</m:SOAPLoginResponse>
<ResponseCode>000</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
200
sess_id=2bf1fef083a57a67e440597c28bfebd617451466ba0161001ca083d43ce580d06a4793790603a386466ef31cd26f37f7842e3c7745aadb30e85fe
52f55d45f29; SameSite=Strict
sending message with service DeviceInfo:1 to endpoint http://192.168.1.1:80/soap/server_sa/
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<SessionID>A7D88AE69687E58D9A00</SessionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<M1:GetInfo xmlns:M1="urn:NETGEAR-ROUTER:service:DeviceInfo:1">
</M1:GetInfo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
got response
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:GetInfoResponse
xmlns:m="urn:NETGEAR-ROUTER:service:DeviceInfo:1">
<ModelName>RAX50</ModelName>
<Description>802.11ac Dual Band Gigabit Wireless Router RAX50</Description>
<SerialNumber>65C20378A02EC</SerialNumber>
<Firmwareversion>V1.0.4.100</Firmwareversion>
<SmartAgentversion>3.0</SmartAgentversion>
<FirewallVersion>iptables v1.6.2</FirewallVersion>
<VPNVersion>N/A</VPNVersion>
<OthersoftwareVersion>2.0.64</OthersoftwareVersion>
<Hardwareversion>RAX50</Hardwareversion>
<Otherhardwareversion>N/A</Otherhardwareversion>
<FirstUseDate>Thursday, 04 Nov 2021 13:24:53</FirstUseDate>
<DeviceName>RAX50</DeviceName>
<FirmwareDLmethod>HTTPS</FirmwareDLmethod>
<FirmwareLastUpdate>2019_10.27_9:6:14</FirmwareLastUpdate>
<FirmwareLastChecked>2019_10.27_9:6:14</FirmwareLastChecked>
<DeviceMode>0</DeviceMode>
<DeviceModeCapability>0</DeviceModeCapability>
<DeviceNameUserSet>false</DeviceNameUserSet>
</m:GetInfoResponse>
<ResponseCode>000</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
200
I rebooted both satellite and router this morning and also upgraded HA to 2021.11.1 and rebooted it. The message in the log remains the same
On 5/11/21 21:06, starkillerOG wrote:
@dmshimself https://github.com/dmshimself, did you try rebooting the router? (I read somewhere else that it possible to crash the API server in the router while the router is still working fine otherwise). Is your HomeAssistant device connected with a LAN kabel to your router or through WiFi, is it possible that is times out sometimes due to a bad connection?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/59025#issuecomment-961696804, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUU52KA24AGQLKVHMRWDLDUKOF63ANCNFSM5HKJ66UQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@karmeleon I made a PR here that schould take care of the login v2 method: https://github.com/MatMaul/pynetgear/pull/90 Could you test that PR?
@dmshimself are you able to test this python script?
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=False,
)
print(netgear.login_v1())
print(netgear.get_info())
print(netgear.get_attached_devices_2())
I'm on hassos, but willing to give it a try. If I create a test.py script and run it, I get what is shown below. I'm probably missing something obvious!
~ python3 test.py
Traceback (most recent call last):
File "/root/test.py", line 4, in
On 8/11/21 02:07, starkillerOG wrote:
@dmshimself https://github.com/dmshimself are you able to test this python script?
|import logging logging.basicConfig(level=logging.DEBUG, format='%(message)s') from pynetgear import Netgear netgear = Netgear( password='adminadmin', host="192.168.1.1", user="admin", port=80, ssl=False, force_login_v2=False, ) print(netgear.login_v1()) print(netgear.get_info()) print(netgear.get_attached_devices_2()) |
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/59025#issuecomment-962607616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUU52KMWPS4LAVDTW2DOXTUKZ2YZANCNFSM5HKJ66UQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@dmshimself from hassos it is a bit difficult to run python scripts because it does not have the modules installed. easiest way is to use a normal computer (can be windows) install python 3 and then from the command line run: "pip3 install --upgrade pynetgear" After that you schould be able to run the script from the command line with: "python3 path/to/your/script/test.py"
Many thanks - here are the results:
Login v1
Starting new HTTP connection (1): 10.13.0.1:80
http://10.13.0.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 422
True
Get Info
Starting new HTTP connection (1): 10.13.0.1:80
http://10.13.0.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 1336
{'ModelName': 'SRR60', 'Description': 'Netgear Smart Wizard 3.0, specification 1.6 version', 'SerialNumber': '53617A55001E8', 'SignalStrength': '-4', 'Firmwareversion': 'V2.7.0.122', 'SmartAgentversion': '3.0', 'FirewallVersion': 'net-wall 2.0', 'VPNVersion': None, 'OthersoftwareVersion': 'N/A', 'Hardwareversion': 'N/A', 'Otherhardwareversion': 'N/A', 'FirstUseDate': 'Sunday, 30 Sep 2007 01:10:03', 'DeviceName': 'ServerRoom', 'DeviceNameUserSet': 'false', 'FirmwareDLmethod': 'HTTPS', 'FirmwareLastUpdate': '2021_10.3_23:11:11', 'FirmwareLastChecked': '2021_11.6_8:2:1', 'DeviceMode': '0', 'DeviceModeCapability': '0;1'}
Get attached devices 2
Starting new HTTP connection (1): 10.13.0.1:80
Error talking to API
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise raise value File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 386, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 306, in _raise_timeout raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='10.13.0.1', port=80): Read timed out. (read timeout=30)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/pynetgear/init.py", line 481, in _make_request data=message, timeout=30, verify=False) File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host='10.13.0.1', port=80): Read timed out. (read timeout=30) None
@karmeleon I made a PR here that schould take care of the login v2 method: MatMaul/pynetgear#90 Could you test that PR?
Sure, trying the script I posted initially loops until I ctrl-C it:
Get attached devices
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
Login v1
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 467
Get Info
Starting new HTTP connection (1): 192.168.1.1:80
http://192.168.1.1:80 "POST /soap/server_sa/ HTTP/1.1" 200 426
Unauthorized response, let's login and retry...
I tried this with 2021.11.5 as I saw some netgear fixes had been applied, but I get the same results.
@dmshimself, @karmeleon This PR: https://github.com/home-assistant/core/pull/62261 schould fix the login issues
I'm still getting the timeout error reported on this issue origonally after upgrading to HA 2021.12.4. Specifically
ogger: pynetgear Source: /usr/local/lib/python3.9/site-packages/pynetgear/init.py:557 First occurred: 8:13:18 PM (21 occurrences) Last logged: 8:23:48 PM
Error talking to API
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise raise value File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 447, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='10.13.0.1', port=80): Read timed out. (read timeout=30)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pynetgear/init.py", line 533, in _make_request response = requests.post(self.soap_url, headers=headers, File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host='10.13.0.1', port=80): Read timed out. (read timeout=30)
@dmshimself could you verify that with the latest pynetgear version you still get the error when executing this script:
(You can update using pip3 install --upgrade pynetgear
)
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=False,
)
print(netgear.login_v1())
print(netgear.get_info())
print(netgear.get_attached_devices_2())
If that still gives the timeout, could you try the following script and see if that works:
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
from pynetgear import Netgear
netgear = Netgear(
password='adminadmin',
host="192.168.1.1",
user="admin",
port=80,
ssl=False,
force_login_v2=False,
)
print(netgear.login_v1())
print(netgear.get_info())
print(netgear.get_attached_devices())
Sure thing. My HA machine is running HASSOS, so I've run the scripts from another box that I have more direct control over. It is running the latest pynetgear as in:
Installing collected packages: pynetgear Successfully installed pynetgear-0.8.0
The first script gives the timeout. The second shows the following.
True {'ModelName': 'SRR60', 'Description': 'Netgear Smart Wizard 3.0, specification 1.6 version', 'SerialNumber': '53617A55001E8', 'SignalStrength': '-4', 'Firmwareversion': 'V2.7.0.122', 'SmartAgentversion': '3.0', 'FirewallVersion': 'net-wall 2.0', 'VPNVersion': None, 'OthersoftwareVersion': 'N/A', 'Hardwareversion': 'N/A', 'Otherhardwareversion': 'N/A', 'FirstUseDate': 'Sunday, 30 Sep 2007 01:10:03', 'DeviceName': 'ServerRoom', 'DeviceNameUserSet': 'false', 'FirmwareDLmethod': 'HTTPS', 'FirmwareLastUpdate': '2021_10.3_23:11:11', 'FirmwareLastChecked': '2021_12.23_12:1:44', 'DeviceMode': '0', 'DeviceModeCapability': '0;1'} [Device(name='DAVID-NB', ip='10.13.210.5', mac='E4:02:9B:E5:31:52', type='5G High Wireless2', signal=292, link_rate=433, allow_or_block='26', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='DEV-8C:D5:61', ip='10.13.250.11', mac='06:16:9C:8C:D5:61', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='DEV-AF:45:F1', ip='10.13.250.78', mac='EE:8E:F3:AF:45:F1', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='PVE', ip='10.13.100.200', mac='9C:B6:54:0B:18:56', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='DEV-21:F1:B4', ip='10.13.250.10', mac='DE:E6:9B:21:F1:B4', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='FS', ip='10.13.0.2', mac='9A:54:B5:E2:90:2C', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Spark', ip='10.13.0.184', mac='6C:0B:84:59:A4:40', type='2.4G Wireless1', signal=26, link_rate=58, allow_or_block='31', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Nintendo-Switch', ip='10.13.250.74', mac='04:03:D6:4B:FC:79', type='2.4G Wireless1', signal=72, link_rate=72, allow_or_block='23', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Apple', ip='10.13.250.70', mac='FE:C8:09:88:2B:61', type='2.4G Wireless1', signal=6, link_rate=39, allow_or_block='7', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='HS110', ip='10.13.100.110', mac='B0:4E:26:CD:58:3D', type='2.4G Wireless1', signal=72, link_rate=72, allow_or_block='31', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='mitsubishi', ip='10.13.0.240', mac='A0:C9:A0:09:52:36', type='2.4G Wireless1', signal=72, link_rate=52, allow_or_block='24', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Espressif', ip='10.13.100.112', mac='E8:DB:84:55:87:B7', type='2.4G Wireless1', signal=54, link_rate=72, allow_or_block='51', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='DESKTOP-C6U4CMB', ip='10.13.250.75', mac='E0:D4:64:24:25:A2', type='5G High Wireless1', signal=650, link_rate=780, allow_or_block='30', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='GALAXY-J2-PRO', ip='10.13.210.6', mac='FC:A6:21:64:03:9C', type='2.4G Wireless1', signal=1, link_rate=72, allow_or_block='48', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='syncthing', ip='10.13.210.37', mac='7E:95:D6:7D:95:39', type='wired', signal=None, link_rate=None, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='android_tv', ip='10.13.0.158', mac='C0:13:2B:4C:D8:E4', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Tuya', ip='10.13.210.10', mac='7C:F6:66:A2:7E:2B', type='2.4G Wireless1', signal=72, link_rate=72, allow_or_block='56', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Brother', ip='10.13.210.0', mac='D8:12:65:33:DD:5D', type='2.4G Wireless1', signal=72, link_rate=72, allow_or_block='32', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Shanghai High-Flying Electronics', ip='10.13.210.44', mac='98:D8:63:E4:B3:80', type='2.4G Wireless1', signal=72, link_rate=58, allow_or_block='47', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Amazon', ip='10.13.250.65', mac='F8:54:B8:69:38:A4', type='2.4G Wireless1', signal=None, link_rate=None, allow_or_block='0', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Amazon-Echo Dot', ip='10.13.250.68', mac='24:4C:E3:C0:A9:17', type='2.4G Wireless1', signal=None, link_rate=None, allow_or_block='0', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Orbit Irrigation', ip='10.13.250.7', mac='44:67:55:21:2D:DF', type='2.4G Wireless1', signal=150, link_rate=150, allow_or_block='63', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='homeassistant', ip='10.13.0.135', mac='02:D1:0A:95:9C:18', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='docker', ip='10.13.0.200', mac='EA:6E:8A:80:8F:C5', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Apple-iPhone 8', ip='10.13.250.20', mac='DA:91:CD:48:0E:AD', type='5G High Wireless1', signal=130, link_rate=520, allow_or_block='19', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='camea', ip='10.13.0.203', mac='C0:C9:E3:92:AB:3B', type='2.4G Wireless1', signal=72, link_rate=150, allow_or_block='55', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Shelly 1', ip='10.13.0.202', mac='E8:DB:84:D8:0C:A2', type='2.4G Wireless1', signal=54, link_rate=39, allow_or_block='39', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='ADGUARD2', ip='10.13.100.210', mac='7A:C1:B8:19:68:9A', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Good Way', ip='10.13.250.27', mac='00:50:B6:1D:D4:50', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Apple-iPhone', ip='10.13.250.1', mac='60:F8:1D:57:BB:44', type='2.4G Wireless1', signal=39, link_rate=52, allow_or_block='15', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Raspberry Pi-Raspberry Pi', ip='10.13.0.3', mac='B8:27:EB:3C:E0:88', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='tvh', ip='10.13.0.7', mac='7A:D5:8C:CC:DD:50', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Sky Light Digital', ip='10.13.250.52', mac='D4:2C:3D:28:CD:D5', type='2.4G Wireless1', signal=28, link_rate=52, allow_or_block='19', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='Espressif', ip='10.13.100.113', mac='40:F5:20:CE:E6:63', type='2.4G Wireless1', signal=54, link_rate=72, allow_or_block='52', device_type=None, device_model=None, ssid=None, conn_ap_mac=None), Device(name='lms', ip='10.13.0.5', mac='72:01:6F:F2:9A:95', type='wired', signal=1000, link_rate=1000, allow_or_block='100', device_type=None, device_model=None, ssid=None, conn_ap_mac=None)]
The problem
Timeout errors are displayed in the Core logs which I think are related to the netgear integration. More detailed logs arenshown further on.
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='10.13.0.1', port=80): Read timed out. (read timeout=30)
What version of Home Assistant Core has the issue?
core-2021.11.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
netgear
Link to integration documentation on our website
https://www.home-assistant.io/integrations/netgear
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
I have an SRR60 and other config details details are the same as for issue 57754 which itself is resolved for my setup
https://github.com/home-assistant/core/issues/57754