ha-asusrouter: Connection to RT-AX86U broken after upgrade to 0.18.0+ [Bug]

The problem

Support for RT-AX86U (running Merlin 388.1) seems to be broken for me since upgrading to 0.18.0 (and all the way up to the current 0.22.0. When I downgrade back to 0.17.4, everything works/connects fine, but upgrading to 0.18.0/0.18.1/0.18.2/018.3+ seems to ALWAYS break this integration’s ability to connect to my router. Was there just a breaking change somewhere that I missed, or is something else going on here? Screenshot below from my Devices & Services page, and paste of error below that. Oh also, I’m running the latest version of Hassio in KVM if that helps.

image

image

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/asusrouter/bridge.py:145
Integration: AsusRouter (documentation, issues)
First occurred: 8:59:48 AM (1 occurrences)
Last logged: 8:59:48 AM

Error setting up entry 192.168.1.1 for asusrouter
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 183, in async_request
    json_body = await reply.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1119, in json
    return loads(stripped.decode(encoding))
orjson.JSONDecodeError: byte order mark (BOM) is not supported: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 101, in async_run_command
    result = await self.async_request(command, endpoint, self._headers)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 229, in async_request
    json_body = parsers.xml(text=string_body)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/util/parsers.py", line 483, in xml
    data = xmltodict.parse(text)
  File "/usr/local/lib/python3.10/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 60, column 19

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 183, in async_request
    json_body = await reply.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1119, in json
    return loads(stripped.decode(encoding))
orjson.JSONDecodeError: byte order mark (BOM) is not supported: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/asusrouter/__init__.py", line 30, in async_setup_entry
    await router.setup()
  File "/config/custom_components/asusrouter/router.py", line 609, in setup
    await self.bridge.async_connect()
  File "/config/custom_components/asusrouter/bridge.py", line 145, in async_connect
    await self.api.async_connect()
  File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 251, in async_connect
    await self.async_identify()
  File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 344, in async_identify
    ] = await self.async_check_endpoint(address)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 238, in async_check_endpoint
    await self.async_api_load(endpoint)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 400, in async_api_load
    raise ex
  File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 393, in async_api_load
    result = await self.connection.async_run_command(
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 113, in async_run_command
    return await self.async_run_command(command, endpoint, retry=True)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 114, in async_run_command
    raise ex
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 101, in async_run_command
    result = await self.async_request(command, endpoint, self._headers)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 229, in async_request
    json_body = parsers.xml(text=string_body)
  File "/usr/local/lib/python3.10/site-packages/asusrouter/util/parsers.py", line 483, in xml
    data = xmltodict.parse(text)
  File "/usr/local/lib/python3.10/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 60, column 19

Your device model

RT-AX86U

Firmware type

Merlin

Firmware version

3.0.0.4.388.1_0

Integration version with the issue

0.18.0+

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Operating System 9.5 Supervisor 2023.01.1 Home Assistant 2023.3.1

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I had the same issue until I updated to latest firmware. Then it went away. Also check your HACs for an update to the ASUS integration

Sent from my iPhone

On Jul 11, 2023, at 9:57 PM, Ryan Gingerich @.***> wrote:

388.1 is old firmware anyway you should update … Sent from my iPhone On Jul 11, 2023, at 9:07 PM, Ryan Gingerich @.> wrote:  After some new network issues cropped up today I decided to restore factory defaults and start over. Once I got my network back up and running, I came back to test this Home Assistant — Reply to this email directly, view it on GitHub<#572 (comment)https://github.com/Vaskivskyi/ha-asusrouter/issues/572#issuecomment-1631741224>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAPMZWQX2JBDRQQRFXANC7LXPYBFPANCNFSM6AAAAAAVRZLXB4. You are receiving this because you commented.Message ID: @.>

Oh I have been on the latest (388.2_2) for some time and the issue persisted. Factory reset ftw for this issue

— Reply to this email directly, view it on GitHubhttps://github.com/Vaskivskyi/ha-asusrouter/issues/572#issuecomment-1631776033, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAPMZWVFPYVMRQ2JZH76T4LXPYHBNANCNFSM6AAAAAAVRZLXB4. You are receiving this because you commented.Message ID: @.***>

388.1 is old firmware anyway you should update

Sent from my iPhone

On Jul 11, 2023, at 9:07 PM, Ryan Gingerich @.***> wrote:

After some new network issues cropped up today I decided to restore factory defaults and start over. Once I got my network back up and running, I came back to test this Home Assistant

— Reply to this email directly, view it on GitHubhttps://github.com/Vaskivskyi/ha-asusrouter/issues/572#issuecomment-1631741224, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAPMZWQX2JBDRQQRFXANC7LXPYBFPANCNFSM6AAAAAAVRZLXB4. You are receiving this because you commented.Message ID: @.***>

Hey, @ryang3d,

I am sorry for the delayed reply. Some means of the matter didn’t allow me to continue my work on AsusRouter. But now I will finally get back to it and try to help with your bug. I still need to check the file you sent. Please allow me some time and I will get back to you with either more questions or a solution

Hello, @1PlusN,

Your issue is already fixed in the backend library and will be released in the next AsusRouter update (it won’t show errors, but will report the correct reason)

P.S. Error code 10 reported from the device is a captcha request. That’s why the login fails (and you see it on reboot when integration tries to connect again)

Having a similar issue on a zen Wi-Fi xt8 using the stock firmware. Works on 0.21.1, works sometimes on 0.22.0, seems to break on restart.

Log Details (ERROR)

This error originated from a custom integration. Logger: homeassistant.config_entries Source: custom_components/asusrouter/bridge.py:173 Integration: AsusRouter (documentation, issues) First occurred: 7:39:30 PM (1 occurrences) Last logged: 7:39:30 PM

Error setting up entry 192.168.0.1 for asusrouter Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 383, in async_setup result = await component.async_setup_entry(hass, self) File “/config/custom_components/asusrouter/init.py”, line 26, in async_setup_entry await router.setup() File “/config/custom_components/asusrouter/router.py”, line 632, in setup await self.bridge.async_connect() File “/config/custom_components/asusrouter/bridge.py”, line 173, in async_connect await self.api.async_connect() File “/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py”, line 253, in async_connect raise ex File “/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py”, line 251, in async_connect await self.connection.async_connect() File “/usr/local/lib/python3.10/site-packages/asusrouter/connection.py”, line 298, in async_connect response = await self.async_request( File “/usr/local/lib/python3.10/site-packages/asusrouter/connection.py”, line 210, in async_request raise AsusRouterResponseError( asusrouter.error.AsusRouterResponseError: (‘Unknown error code 10, please report it’, None)