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
137 stars 16 forks source link

I got the encrypted password from the web, but I can't make the configuration work #37

Closed thsrv closed 8 months ago

thsrv commented 8 months ago

Describe the bug When I went to configure it, the error You need to use web encrypted password instead returned. Check the documentation! I accessed my router's default login page, logged in and activated recording over the network, preserved the log and searched for "login?form=login" Generated a long string of characters in 'sign=' I copied and pasted it to configure it in Home Assistant and the error TplinkRouter - C1200 - Cannot authorize! Error - Expecting value: line 1 column 1 (char 0); Response -

Logs Add also all relevant logs from Settings->System->Logs.

Additional Information (please complete the following information)

AlexandrErohin commented 8 months ago

Hi Is there any logs from Settings->System->Logs ? What is you router model?

AlexandrErohin commented 8 months ago

@thsrv any news?

karl1809 commented 8 months ago

Thank you for your great integration. Everything worked well with the generatet encrypted password. My Router: Archer C60 /AC1350 But then first my handy was no more detected. And then I made some updates icluding the update for your integration. Now errors accure! What should I do? I#m a beginner in homeassistant.

Logger: homeassistant.config_entries Quelle: config_entries.py:504 Erstmals aufgetreten: 14. März 2024 um 23:40:34 (1 Vorkommnisse) Zuletzt protokolliert: 14. März 2024 um 23:40:34

Error setting up entry http://192.168.0.1 for tplink_router Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/tplinkrouterc6u/client.py", line 426, in authorize regex_result = re.search('sysauth=(.*);', response.headers['set-cookie'])


  File "/usr/local/lib/python3.12/site-packages/requests/structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'set-cookie'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tplink_router/__init__.py", line 60, in async_setup_entry
    firmware, status = await hass.async_add_executor_job(TPLinkRouterCoordinator.request, client, callback)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tplink_router/coordinator.py", line 55, in request
    router.authorize()
  File "/usr/local/lib/python3.12/site-packages/tplinkrouterc6u/client.py", line 434, in authorize
    raise ClientException(error)
tplinkrouterc6u.exception.ClientException: TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":1,"attemptsAllowed":9}}

--------------------------------------------------------------------

Protokolldetails (FEHLER)
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.tplink_router
Quelle: custom_components/tplink_router/coordinator.py:55
Integration: TP-Link Router ([Dokumentation](https://github.com/AlexandrErohin/home-assistant-tplink-router), [Probleme](https://github.com/AlexandrErohin/home-assistant-tplink-router/issues))
Erstmals aufgetreten: 14. März 2024 um 23:40:34 (1 Vorkommnisse)
Zuletzt protokolliert: 14. März 2024 um 23:40:34

TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":1,"attemptsAllowed":9}}
AlexandrErohin commented 8 months ago

@karl1809 Try to delete the router entity, get the new generated password from browser and add it again to HA.

karl1809 commented 8 months ago

Thanks a lot! Now it works well! Router Archer C60 works with your Integration.

AlexandrErohin commented 8 months ago

@karl1809 Great! What is your router hardware version?

thsrv commented 8 months ago

@thsrv any news?

sorry, this is the log

Wed Mar 20 22:25:56 2024 user.notice IMPROXY: INFO[imp_verify_multicast_addr@245]: Group address 224.0.0.251 is Local Network Control Block

Wed Mar 20 22:26:06 2024 daemon.notice pppd[5759]: len < 0

Wed Mar 20 22:26:06 2024 daemon.notice netifd: internet (5759): len < 0

AlexandrErohin commented 8 months ago

@thsrv Added Deco M4 support. Please try v1.11.0

thsrv commented 8 months ago

@thsrv Added Deco M4 support. Please try v1.11.0

It worked, thank you! However, I have a question I'd like to clarify, and I hope you can assist me with. Why were the camera and a Broadlink device identified and included during the integration process? I'd like to understand this part better.

AlexandrErohin commented 8 months ago

@thsrv Glad to help you!

Please dont forget to give a star to the repo :)

Do you have the camera and the Broadlink device already added by another integrations? I think HA groups connected devices according to their MAC addresses

thsrv commented 8 months ago

@thsrvFeliz em te ajudar!

Por favor, não se esqueça de dar uma estrela ao repo :)

Você tem a câmera e o dispositivo Broadlink já adicionados por outras integrações? Acho que o HA agrupa dispositivos conectados de acordo com seus endereços MAC

Yes, they were already integrated into HA.