ha-asusrouter: AsusRouter Integration doesn't reload automatically upon HA reboot [Bug]

The problem

For the past several months, when I have restarted HA, I have had to manually press reload on the entries for each AP in the integration in order to get it to fully load. More recently (past few weeks), I have had to press reload many times (up to 10 or more) on each entry in order to get them to fully load. Once loaded, the integration seems to be working OK.

Your device model

RT-AX92U

Firmware type

Stock

Firmware version

3.0.0.4.388_23630

Integration version with the issue

0.32.1

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Core 20242.6.3

Is there anything useful in the logs?

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 8:17:01 AM (12 occurrences)
Last logged: 8:24:22 AM

Error setting up entry 192.168.86.1 for asusrouter
Error setting up entry 192.168.86.249 for asusrouter
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/asusrouter/__init__.py", line 27, in async_setup_entry
    await router.setup()
  File "/config/custom_components/asusrouter/router.py", line 363, in setup
    device_registry.async_remove_device(device_entry.id)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 947, in async_remove_device
    device = self.devices.pop(device_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen _collections_abc>", line 951, in pop
  File "/usr/src/homeassistant/homeassistant/helpers/registry.py", line 62, in __delitem__
    self._unindex_entry(key)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 543, in _unindex_entry
    super()._unindex_entry(key, replacement_entry)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 484, in _unindex_entry
    del self._identifiers[identifier]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: ('asusrouter', '04:42:1a:6a:2d:20')

Diagnostics information

syslog.txt

Additional information

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Issue persist with version 0.35.0 of the integration too.

I have 3 routers: 192.168.1.1 -> RT-AX92U - Main router 192.168.1.146 -> RT-AX92U - AiMesh node with wired backhaul 192.168.1.233 -> XD6S - Wireless Media bridge (on 5Ghz)

Only occured always with Main and Mesh roouter: RT-AX92U Each had several firmwares, right now with latest: 3.0.0.4.388_23712 After HA restart always fail to load. Under asusrouter integration need to reload each Hubs 3-5 times to succesfully reload.

Last log after installed 0.35.0 and restarted: (also enabled debug logging, attached: home-assistant_asusrouter_2025-03-23T23-17-04.998Z.log

`Logger: homeassistant.config_entries Source: config_entries.py:753 First occurred: 12:09:44 AM (2 occurrences) Last logged: 12:09:44 AM

Error setting up entry 192.168.1.146 for asusrouter Error setting up entry 192.168.1.1 for asusrouter Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 753, in __async_setup_with_context result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/config/custom_components/asusrouter/init.py”, line 27, in async_setup_entry await router.setup() File “/config/custom_components/asusrouter/router.py”, line 370, in setup device_registry.async_remove_device(device_entry.id) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/helpers/device_registry.py”, line 1251, in async_remove_device device = self.devices.pop(device_id) File “<frozen _collections_abc>”, line 956, in pop File “/usr/src/homeassistant/homeassistant/helpers/registry.py”, line 62, in delitem self._unindex_entry(key) ~~~~~~~~~~~~~~~~~~~^^^^^ File “/usr/src/homeassistant/homeassistant/helpers/device_registry.py”, line 654, in _unindex_entry super()._unindex_entry(key, replacement_entry) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/helpers/device_registry.py”, line 580, in _unindex_entry del self._identifiers[identifier] ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ KeyError: (‘asusrouter’, ‘:::::’)`

Same here