Added support for TP-Link Archer C50 V3 BR Version#13525
Added support for TP-Link Archer C50 V3 BR Version#13525MelkyFB-zz wants to merge 5 commits intohome-assistant:devfrom
Conversation
| referer = 'http://{}/'.format(self.host) | ||
| cookie = 'Authorization=Basic {}'.format(self.credentials) | ||
|
|
||
| payload = '[LAN_HOST_ENTRY#0,0,0,0,0,0#0,0,0,0,0,0]0,4\r\nleaseTimeRemaining\r\nMACAddress\r\nhostName\r\nIPAddress\r\n' |
There was a problem hiding this comment.
line too long (128 > 79 characters)
|
|
||
| mac_results = [] | ||
|
|
||
| #CHECK DHCP CLIENT LIST |
There was a problem hiding this comment.
block comment should start with '# '
| # Create the authorization cookie. | ||
| cookie = 'Authorization=Basic {}'.format(self.credentials) | ||
|
|
||
| response = requests.get(url, headers={COOKIE: cookie}) |
There was a problem hiding this comment.
local variable 'response' is assigned to but never used
| _LOGGER.info("Retrieving auth tokens...") | ||
| url = 'http://{}/'.format(self.host) | ||
|
|
||
| credentials = '{}:{}'.format(self.username, self.password).encode('utf') |
There was a problem hiding this comment.
line too long (80 > 79 characters)
| self.token = '' | ||
| #had to rewrite due c50 responds with colon mac instead of dash | ||
| self.parse_macs_c50 = re.compile('[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:' + | ||
| '[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}') |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| self.credentials = '' | ||
| self.token = '' | ||
| #had to rewrite due c50 responds with colon mac instead of dash | ||
| self.parse_macs_c50 = re.compile('[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:' + |
There was a problem hiding this comment.
line too long (81 > 79 characters)
| """Initialize the scanner.""" | ||
| self.credentials = '' | ||
| self.token = '' | ||
| #had to rewrite due c50 responds with colon mac instead of dash |
There was a problem hiding this comment.
block comment should start with '# '
| self.stok = '' | ||
| self.sysauth = '' | ||
|
|
||
| class TplinkArcherC50DeviceScanner(TplinkDeviceScanner): |
| cookie = 'Authorization=Basic {}'.format(self.credentials) | ||
|
|
||
| payload = '[LAN_HOST_ENTRY#0,0,0,0,0,0#0,0,0,0,0,0]0,4\r\n' + | ||
| 'leaseTimeRemaining\r\nMACAddress\r\nhostName\r\nIPAddress\r\n' |
There was a problem hiding this comment.
indentation is not a multiple of four
unexpected indentation
line too long (81 > 79 characters)
| url = 'http://{}/'.format(self.host) | ||
|
|
||
| credentials = '{}:{}'.format(self.username, \ | ||
| self.password).encode('utf') |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| _LOGGER.info("Retrieving auth tokens...") | ||
| url = 'http://{}/'.format(self.host) | ||
|
|
||
| credentials = '{}:{}'.format(self.username, \ |
There was a problem hiding this comment.
the backslash is redundant between brackets
| self.token = '' | ||
| # I had to rewrite due c50 responds with colon mac instead of dash | ||
| self.parse_macs_c50 = | ||
| re.compile('[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:' + |
| self.credentials = '' | ||
| self.token = '' | ||
| # I had to rewrite due c50 responds with colon mac instead of dash | ||
| self.parse_macs_c50 = |
There was a problem hiding this comment.
trailing whitespace
SyntaxError: invalid syntax
|
|
||
| payload = '[LAN_HOST_ENTRY#0,0,0,0,0,0#0,0,0,0,0,0]0,4\r\n' + \ | ||
| 'leaseTimeRemaining\r\nMACAddress\r\nhostName\r\nIPAddress\r\n' | ||
|
|
| self.credentials = base64.b64encode(credentials).decode('utf') | ||
|
|
||
| # Create the authorization cookie. | ||
| cookie = 'Authorization=Basic {}'.format(self.credentials) |
There was a problem hiding this comment.
local variable 'cookie' is assigned to but never used
| def _get_auth_tokens(self): | ||
| """Retrieve auth tokens from the router.""" | ||
| _LOGGER.info("Retrieving auth tokens...") | ||
| url = 'http://{}/'.format(self.host) |
There was a problem hiding this comment.
local variable 'url' is assigned to but never used
| # CHECK DHCP CLIENT LIST | ||
| url = 'http://{}/cgi?5'.format(self.host) | ||
| referer = 'http://{}/'.format(self.host) | ||
| cookie = 'Authorization=Basic {}'.format(self.credentials) |
| def __init__(self, config): | ||
| """Initialize the scanner.""" | ||
| self.credentials = '' | ||
| self.token = '' |
| self.credentials = '' | ||
| self.token = '' | ||
| # I had to rewrite due c50 responds with colon mac instead of dash | ||
| self.parse_macs_c50 = re.compile('[0-9A-F]{2}:[0-9A-F]{2}:' + |
There was a problem hiding this comment.
This is fine. Please rewrite or remove the comment. You could overwrite self.parse_macs here. A new variable isn't needed to my mind.
|
Please provide a PR to use |
Description:
Pull request in home-assistant.github.io
The tplink.py was not working for this model of router, I tested with my Brazilian Version, maybe it works with Europe Version or even with other other Hardware versions, not only v3.
Checklist:
tox.