Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (hass --version):
0.32.2
Python release (python3 --version):
latest
Component/platform:
Netgear
Description of problem:
Getting the following error in HASS log:
16-11-08 19:51:42 pynetgear: Error talking to API
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 346, in prepare_url
scheme, auth, host, port, path, query, fragment = parse_url(url)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/url.py", line 189, in parse_url
raise LocationParseError(url)
requests.packages.urllib3.exceptions.LocationParseError: Failed to parse: None:None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/pynetgear/__init__.py", line 113, in _make_request
self.soap_url, headers=headers, data=message, timeout=10)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 110, in post
return request('post', url, data=data, json=json, **kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 461, in request
prep = self.prepare_request(req)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 294, in prepare
self.prepare_url(url, params)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 348, in prepare_url
raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: None:None
16-11-08 19:51:42 homeassistant.components.device_tracker.netgear: Failed to Login
16-11-08 19:51:42 homeassistant.components.device_tracker: Error setting up platform netgear
Expected:
Problem-relevant configuration.yaml entries and steps to reproduce:
```yaml
device_tracker:
platform: netgear
host: 192.168.31.254
username: admin
password: xxxxx
Which netgear router do you have?
Is it part of the supported list? https://github.com/balloob/pynetgear#supported-routers
Oh sorry, forgot to mention indeed! 馃憤 I have the Netgear R7000 Nighthawk so it is supported and it did work before,
The Pynetgear library hasn't been updated in 8 months. So if it is broken it is broken by an update to your router. You can try to fix it yourself but we don't have the device so can't help you.
@Flight777 which firmware version is your R7000 running?
@balloob Thanks for looking into it :) I understand, unfortunately I'm not that advanced yet, but who knows in the future.
@Kernald V1.0.7.2_1.1.93
I'm having the same issue with a R6300 on V1.0.2.78_1.0.58.
Traceback:
Home Assistant
0.32.2
16-11-10 20:53:10 pynetgear: Error talking to API
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/requests/models.py", line 346, in prepare_url
scheme, auth, host, port, path, query, fragment = parse_url(url)
File "/usr/local/lib/python3.5/site-packages/requests/packages/urllib3/util/url.py", line 189, in parse_url
raise LocationParseError(url)
requests.packages.urllib3.exceptions.LocationParseError: Failed to parse: None:None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pynetgear/__init__.py", line 113, in _make_request
self.soap_url, headers=headers, data=message, timeout=10)
File "/usr/local/lib/python3.5/site-packages/requests/api.py", line 110, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.5/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.5/site-packages/requests/sessions.py", line 461, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.5/site-packages/requests/sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python3.5/site-packages/requests/models.py", line 294, in prepare
self.prepare_url(url, params)
File "/usr/local/lib/python3.5/site-packages/requests/models.py", line 348, in prepare_url
raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: None:None
16-11-10 20:53:10 homeassistant.components.device_tracker.netgear: Failed to Login
16-11-10 20:53:10 homeassistant.components.device_tracker: Error setting up platform netgear
As a work around (and to make the router a better router) you could install DD-Wrt and use the DD-Wrt component of HA.
I debugged a bit; and found out the following:
hass.async_add_job(
async_setup_platform(DISCOVERY_PLATFORMS[service], {}, info))
For discovery, the async_setup_platform is called for the netgear platform, and the second argument is left empty. Even though device_tracker.netgear is configured.
So if you configure the netgear platform; it is initialized twice. Once with an empty dict, which leads to the error message. (Note that the second initalization actually does work).
I'm not yet too familiar with the inner workings of hass and discovery; what should be the expected behaviour? Init two scanners, one for autodiscovery with defaults, and one with the actual configuration?
Or just once with the expected config?
@Flight777 Just to let you know I bumped up against this same issue. I went into pynetgear to see if I could use just the library (https://github.com/balloob/pynetgear#installation).
I then ended up adding the port to the configuration.yml file and everything worked correctly.
Example
device_tracker:
platform: netgear
username: AdminUser
password: AdminPassword
host: RouterIpAddress (default: 192.168.1.1)
port: RouterPort (default: 80)
@isleshocky77
Thanks for the info 馃憤 I've just tried you suggestion but Homeassistant keeps saying failed to login while password is fully correct (tried a few times myself). So it seems not to work for all models?
What model router you are using?
@Flight777 i just added the port: 80 into my config and my Nighthawk X4S D7800 is now working
thank @isleshocky77
@Flight777 I have the:
Model: Nighthawk(R) X4S R7800
Firmware: V1.0.2.20
I am in the same boat as @Flight777. Nighthawk R7000, adding a port to the configuration does not work for me either.
@balloob - If I run the command manually from my console using the following: "python -m pynetgear [pass] [host] [user] [port]" (leaving port blank, and with port 5000) and it works, am I correct in assuming that it should work when called via HASS? Any other steps or guidance you can provide on this would be wonderful. I'm not quite sure how to "follow" the traceback and determine what values HASS is trying to post to the router..
I continued to do some more tinkering... And found that if I disabled discovery in my config file, I no longer receive the traceback error. Not ideal, but might be worth a shot @Flight777.
I'm also running into this error with my R7000 as well. Everything in the netgear platform works correctly despite errors showing the the home-assistant.log. I tried adding the port as suggested in this thread and it made no difference.
FWIW, @mjooms explanation seems like a likely cause to me, especially in conjunction with the fact that disabling discovery resolves the issue. Just my 2c...
As a workaround on 0.39+ you can use the new ignore feature of the discovery component. This seems to confirm that this is indeed an issue with HASS double initialization via discovery & manual config, rather than a dependency issue.
discovery:
ignore:
- netgear_router
I also have an R7000 and experienced this exact error/problem. Now with the tip to ignore auto-discovery of Netgear, I can manually configure and and most of the error has disappeared. But, I still get a failed login error consistently:
17-04-17 23:11:14 ERROR (Thread-7) [homeassistant.components.device_tracker.netgear] Failed to Login
17-04-17 23:11:14 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform netgear
The login credentials are definitely correct and are what I use to login directly, so in HomeAssistant, I'm not sure if it's working correctly or not....
I'm seeing this issue, though I have not configured anything in my configuration.yaml to point to my netgear router. Is it possible that HA is automatically detecting the netgear router on my network?
UPDATE: I didn't realize my Pi was using the netgear router for wifi. I moved it to my new router and everything appears to be fine now.
Yes it automatically discovers the merest riser due to the auto-discovery feature of HASS... since I don't use my router for presence detection, the solution above to use the ignore (or disable "discovery" component completely) Hoyt rid of the recurring error message for me.
But there is definitely still an issue with .46 and newer nether routers...
Yep, I'm still getting these errors with _discovery:_ enabled in HASS 0.47.0 with my Netgear N750 (even with the router port defined under device_tracker: - platform: netgear).
2017-06-23 12:23:19 ERROR (Thread-1) [pynetgear] Error talking to API
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 374, in prepare_url
scheme, auth, host, port, path, query, fragment = parse_url(url)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/url.py", line 199, in parse_url
raise LocationParseError(url)
requests.packages.urllib3.exceptions.LocationParseError: Failed to parse: None:None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/pynetgear/__init__.py", line 113, in _make_request
self.soap_url, headers=headers, data=message, timeout=10)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 504, in request
prep = self.prepare_request(req)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 436, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 302, in prepare
self.prepare_url(url, params)
File "/srv/homeassistant/lib/python3.4/site-packages/requests/models.py", line 376, in prepare_url
raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: None:None
2017-06-23 12:23:19 ERROR (Thread-1) [homeassistant.components.device_tracker.netgear] Failed to Login
2017-06-23 12:23:19 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform netgear
Turning off _discovery:_ cleans up the log, but I'd rather keep it enabled; it's an awesome feature.
EDIT: I just saw the post about
discovery:
ignore:
- netgear_router
I'm also with @ddykhoff and @mjooms explanation - The netgear-module is initializied twice, one with default logins (which result in the posted error, if e.g. the router-password has been changed). For me, this is not a dependency issue, but an issue with the device tracker.
I see two options:
Thinking of multiple devices, both could cause trouble 馃槦
Which one makes more sense to you (or do you see a third way..)? @balloob @DavidLP @Kernald
I'm having the same problem and I also confirm that this issue contains two problems:
netgear is initialized twice. One time, automatically during discovery process. Second time, during set up of netgear device tracker platform from configuration.yamlLocationParseError exception is due to automatic discovery process not providing any configuration to the netgear platform.I would say that netgear platform should not be automatically initialized during discovery process. The reason being is that nobody would use default login/password for the router and there is no way to provide them for automatic discovery.
2017-10-22 22:18:29 INFO (MainThread) [homeassistant.loader] Loaded device_tracker.netgear from homeassistant.components.device_tracker.netgear
2017-10-22 22:18:31 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.netgear
2017-10-22 22:18:31 INFO (Thread-10) [homeassistant.components.device_tracker.netgear] Logging in
2017-10-22 22:18:31 INFO (Thread-10) [pynetgear] Get attached devices
2017-10-22 22:18:31 INFO (Thread-10) [pynetgear] Login
2017-10-22 22:18:51 ERROR (Thread-10) [pynetgear] Error talking to API
File "/volume1/homeassistant/deps/lib/python3.5/site-packages/pynetgear/__init__.py", line 113, in _make_request
2017-10-22 22:18:51 ERROR (Thread-10) [homeassistant.components.device_tracker.netgear] Failed to Login
2017-10-22 22:18:51 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform netgear
Still getting this on 0.56.0 with netgear_router in my discovery/ignore section.
@kevindelaney can you please check that your login/password are correct. This is a different error.
@etsinko I figured out the problem - the R7000 is operating in Access Point mode, which means it does not have an IP and can only be accessed via routerlogin.net on devices that are connected via WiFi, which it is not. Will have to do some other type of presence detection. Thanks for pointing me in the right direction.
Most helpful comment
As a workaround on 0.39+ you can use the new
ignorefeature of thediscoverycomponent. This seems to confirm that this is indeed an issue with HASS double initialization via discovery & manual config, rather than a dependency issue.