AlexandrErohin / home-assistant-tplink-router

Home Assistant component for TP-Link router administration with sensors, button reboot, switches and device tracking.
https://community.home-assistant.io/t/custom-component-tp-link-router-integration
MIT License
113 stars 13 forks source link

Unable to add integration for Archer C2300 v2.0 #102

Open ColinRobbins opened 1 day ago

ColinRobbins commented 1 day ago

Describe the bug Cannot set up the integration with an Archer C2300 v2.0.

The documentation does state v1.0, but I thought I'd try it.

I am reasonably experienced with HA development, so am happy to try and debug if someone can give me some pointers on what the issue may be.

Logs

2024-10-20 12:58:05.813 ERROR (SyncWorker_8) [custom_components.tplink_router.config_flow] TplinkRouter - TPLinkDecoClient - Unknown error for pwd! Error - 'result'; Response - {"success":true,"data":{"password":["XXXXXXXXXXXXXXXXXXXXXXXXXXX","010001"],"mode":"router","username":""}}
2024-10-20 12:58:06.379 ERROR (SyncWorker_4) [custom_components.tplink_router.config_flow] TplinkRouter - TplinkRouter - Cannot authorize! Error - 'stok'; Response - {'errorcode': 'login failed', 'success': False, 'data': {'failureCount': 2, 'errorcode': '-5002', 'attemptsAllowed': 8}}
2024-10-20 12:58:06.380 ERROR (MainThread) [custom_components.tplink_router.config_flow] TplinkRouter Integration Exception - TplinkRouter - TplinkRouter - Cannot authorize! Error - 'stok'; Response - {'errorcode': 'login failed', 'success': False, 'data': {'failureCount': 2, 'errorcode': '-5002', 'attemptsAllowed': 8}}
2024-10-20 12:58:36.648 ERROR (SyncWorker_11) [custom_components.tplink_router.config_flow] TplinkRouter - C1200 - Cannot authorize! Error - Expecting value: line 1 column 1 (char 0); Response - 
2024-10-20 12:58:36.649 ERROR (MainThread) [custom_components.tplink_router.config_flow] TplinkRouter Integration Exception - TplinkRouter - C1200 - Cannot authorize! Error - Expecting value: line 1 column 1 (char 0); Response - 

Additional Information (please complete the following information)

ColinRobbins commented 1 day ago

So, I have tried the test library, using a web encrypted password…

router = TplinkC1200Router('http://192.168.0.1','xxxxxxx', Logger('test'))
router.authorize()

It appears following the call to authorise() the response to the POST contains no data. So, an exception is thrown in requests/models.py#977 trying to decode the JSON

AlexandrErohin commented 22 hours ago

Hi. So it looks like the authorization is different on your router. Would be great if you could add support for your router to the client

ColinRobbins commented 19 hours ago

Any clues on how to try and work out what the authorisation may need? Is it a case of watching an authorisation in dev tools, and reverse engineering?