Skip to content

Integration fails to load #9

@thomascandrian

Description

@thomascandrian

I'm not really sure what is going wrong here...

login_step2 = await self._session.post(self._url, data=login_check_data)
        text = await login_step2.text()
        _LOGGER.debug(f"Step 2 returned status code: {login_step2.status}, text: {text}")

        if 'OK' not in text:
            _LOGGER.warn("OK not found in login step 2")
            if is_retry:
                raise Exception("Login failed: %s" % login_step2.text)
            await self._login(is_retry=True)
        
        _LOGGER.debug("Logged in successfully")

Login semms fine, and it looks like there IS a OK in the response text (see below), but it is not recognized. I tried to remove the code which checks the login, but it fails with the html parser. Maybe the device response did change in recent updates?

2024-07-01 20:48:31.718 ERROR (MainThread) [homeassistant.components.switch] Error while setting up zyxel_poe platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/zyxel_poe/switch.py", line 79, in async_setup_platform
await poe_data.async_update()
File "/config/custom_components/zyxel_poe/switch.py", line 220, in _async_update
await self._login()
File "/config/custom_components/zyxel_poe/switch.py", line 166, in _login
await self._login(is_retry=True)
File "/config/custom_components/zyxel_poe/switch.py", line 165, in _login
raise Exception("Login failed: %s" % login_step2.text)
Exception: Login failed: <bound method ClientResponse.text of <ClientResponse(http://10.0.11.2/cgi-bin/dispatcher.cgi) [200 OK]>
<CIMultiDictProxy('Date': 'Mon, 01 Jul 2024 18:48:31 GMT', 'Server': 'Hydra/0.1.8', 'Accept-Ranges': 'bytes', 'Connection': 'close', 'Content-Security-Policy': "default-src 'self';script-src 'self' 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline'; base-uri 'self'")>
>

Model Name: | GS1900-8HP
Revision: | B1
Firmware Version: | V2.60(AAHI.4) | 05/24/2021

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions