Open DiggiD opened 4 years ago
Hi, I've only repackaged the old TP-Link router integration in HACS, so that people can keep using it even though it was officially removed from Home Assistant. I've only implemented support for the N600, which is my own router. I don't have a C1200 so I can't troubleshoot and fix by myself.
If you are able to find out how authentication works for your router, I'm happy to integrate in the code.
Eric
@DiggiD Try this:
Save this file (https://gist.github.com/GuyKh/39cd5a2ed74c5303f3217a503cde4048) with .py extension
Modify the Username/Password settings in the file
Then run it with python3 file.py
If it succeed - #4 should solve the issue
thanks all
@GuyKh
changed 'conf_password' to my router password since page does not have username field. got many errors, can't make sense of it but most notably the logs keep mentioning host=192.168.1.1 even after i tried changing 'conf_host' to 192.168.0.1 the address of my router.
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection raise err File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen chunked=chunked, File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output self.send(msg) File "/usr/local/lib/python3.7/http/client.py", line 966, in send self.connect() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect conn = self._new_conn() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x76382f70>: Failed to establish a new connection: [Errno 110] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.1', port=80): Max retries exceeded with url: /cgi/getParm (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76382f70>: Failed to establish a new connection: [Errno 110] Operation timed out'))
also tried changing 'conf_username' to admin to check
@DiggiD
So yeah - if you're using only a password then the username must be admin
.
Make sure you use the right host (192.168.1.1
in the example) for your case - perhaps it's 192.168.0.1
Try these settings and paste the entire run log (right from the python
command).
Also - please specify what is your IP you're calling from.
In the log you pasted - indeed it shows that 192.168.1.1
is not where the router is located
Again - I don't promise it'll work - it just uses the new VR600 admin interface.
conf_host = '192.168.0.1' conf_password = 'mypassword' conf_username = 'admin'
I'm calling this from docker hassio install running on my pi on the same subnet
error:
bash-5.0# python3 tp-link.py Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection raise err File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen chunked=chunked, File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output self.send(msg) File "/usr/local/lib/python3.7/http/client.py", line 966, in send self.connect() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect conn = self._new_conn() File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7632cf10>: Failed to establish a new connection: [Errno 110] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.1', port=80): Max retries exceeded with url: /cgi/getParm (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7632cf10>: Failed to establish a new connection: [Errno 110] Operation timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tp-link.py", line 307, in
@DiggiD It still feels that it tries to reach 192.168.1.1
Again - make sure that in the .py
file - on line #295 you get these lines:
CONF_HOST: "192.168.0.1",
CONF_USERNAME: "admin",
CONF_PASSWORD: "<your pass>"
thanks for the pointer.. missed that completely.
script now exits with
FAILED!
So - sorry to disappoint - my solution will not work (out-of-the-box) for you.
I need to further investigate this - and this is VERY HARD when I don't have the router. Sorry :(
Wait You can also try this: https://gist.github.com/GuyKh/545ebfe1e95f48a8c623cf959cebb82b
Modify lines 74-76. This is a more detailed script
Wait You can also try this:
Response Status: 404
Wait You can also try this:
Response Status: 404
Sure you set the right settings in line 74?
yes, i set it to my router url '192.168.0.1'
@DiggiD so it seems that indeed this method is not suitable for your router. Sorry to be the bearer of bad news
thanks for trying:)
if only i knew how to get you the info that you need
I have the same router and was able to get this to work, but had to get the encrypted password, per instructions in README.
I have the same router and was able to get this to work, but had to get the encrypted password, per instructions in README.
As you managed to make it work I would like to ask you if can share some details. As for me it is not working
Did you use admin as username or did you left it blanc like ''?
Could you share you config ?
How is your ip setting? My router is 192.168.1.3 and also 192.168.2.1 my home assistant is like 192.168.2.101
Some specific steps to do? I.e. modem and router reset ? Or anything else please share so we can also benefit 👍
I have the same router and was able to get this to work, but had to get the encrypted password, per instructions in README.
As you managed to make it work I would like to ask you if can share some details. As for me it is not working
Did you use admin as username or did you left it blanc like ''?
Could you share you config ?
How is your ip setting? My router is 192.168.1.3 and also 192.168.2.1 my home assistant is like 192.168.2.101
Some specific steps to do? I.e. modem and router reset ? Or anything else please share so we can also benefit +1
My config:
device_tracker:
- platform: tplink_router
host: 192.168.0.1
username: admin
password: !secret tplink_router
My home assistant is on 192.168.0.0/24 subnet. I didn't do anything specifically to get it working, once I realised I needed the encrypted password.
One thing to watch out for is you can't be logged on to the router multiple times, so keep sure to log off from other devices.
If you are still looking for a Home Assistant Integration for Archer C1200 v2.0 - I have one https://github.com/AlexandrErohin/home-assistant-tplink-router
archer c1200 v2.0
no username field for router home page, only password field
AP didn't respond with JSON. Check if credentials are correct
Couldn't fetch auth tokens!
Response was: {"errorcode":"login failed","success":false,"data":{"failureCount":1,"errorcode":"-5002","attemptsAllowed":9}}
Router didn't respond with JSON. Check if credentials are correct.
Error 404 from router