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
104 stars 13 forks source link

перезагрузка через интеграцию #65

Open spguard13 opened 3 months ago

spguard13 commented 3 months ago

Describe the bug После перезагрузки роутера через интеграцию, интеграция перестает отвечать, при попытки перезагрузить интеграцию выходят вот такие ошибки: Регистратор: homeassistant.config_entries Источник: config_entries.py:594 Первое сообщение: 00:38:40 (1 сообщений) Последнее сообщение: 00:38:40

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 698, 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 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tplink_router/__init__.py", line 47, 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 707, in authorize
    raise ClientException(error)
tplinkrouterc6u.exception.ClientException: TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":5,"attemptsAllowed":5}}

Регистратор: custom_components.tplink_router
Источник: custom_components/tplink_router/coordinator.py:55
интеграция: TP-Link Router ([документация](https://github.com/AlexandrErohin/home-assistant-tplink-router), [проблемы](https://github.com/AlexandrErohin/home-assistant-tplink-router/issues))
Первое сообщение: 00:34:43 (5 сообщений)
Последнее сообщение: 00:38:40
TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":1,"attemptsAllowed":9}}
TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":2,"attemptsAllowed":8}}
TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":3,"attemptsAllowed":7}}
TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":4,"attemptsAllowed":6}}
TplinkRouter - C1200 - Cannot authorize! Error - 'set-cookie'; Response - {"errorcode":"login failed","success":false,"data":{"failureCount":5,"attemptsAllowed":5}}
Add also all relevant logs from **Settings->System->Logs**.

**Additional Information (please complete the following information)**
 - Router Hardware Version:
 - Router Firmware Version:
 - Home Assistant Version: 
 - TP-Link Router Integration Component Version:

Устройство
TPLink
Версия программного обеспечения: 1.0.8 Build 20210415 rel.36301(5255)
Версия аппаратного обеспечения: Archer C7 v4.0

Home Assistant
Core 2024.6.4
Supervisor 2024.06.0
Operating System 12.4
AlexandrErohin commented 1 day ago

@spguard13 It can be if router reboot takes more time to finish. Try to increase scan interval to 1min or more