[Custom component] AsusRouter integration

0.17.0 :rocket: AiMesh support

2023-01-08

:lock: Requirements

  • Minimum Home Assistant version bumped to 2023.1.0

:rocket: Features

  • Devices:
    • Added device modes (Router or AiMesh node) which can be selected during initial integration configuration or via Configure option on the Integrations page
    • Devices in Router mode support all the features of AsusRouter
    • Devices in AiMesh node mode support the following feature groups: Main, CPU, LED, Load average, Network, Ports, RAM, Temperature. Other features are disabled as unreliable / duplicating
  • Added AiMesh support (FW: 386.x+ only):
    • Wireless backhaul
    • Wired backhaul
    • Node status binary_sensor entities
    • Node devices
    • Node-related events: asusrouter_node_connected, asusrouter_node_disconnected, asusrouter_node_reconnected
    • via_device attribute for the node devices
    • AiMesh data is updated at the same rate as connected devices
  • Added node MAC to the connected device identity
  • Adjusted entities attributes to be sorted alphabetically in the frontend (except for some default attributes of device_tracker entities)
  • Improved generation of unique IDs
  • Network interfaces are renamed to more obvoius names (WLAN02.4 GHz, WLAN15 GHz and so on). entity_id will stay as they are if already in use. For new users, entity_id will have new naming

:bug: Bug fixes

  • Added new API endpoint to monitor online status - device trackers should become more reliable (FW: 386.x+ only)
  • Fixed naming of temperature sensors after bug in 0.15.0
  • Fixed Platform asusrouter does not generate unique IDs.
  • Fixed problems with unique IDs for multiple devices setup
  • Fixed events options

:open_book: Translations

  • A new string Device mode was added to the configuration flow (in respect to the new device modes implemented). It still requires the following translations: cs, es, fr, nl, pt-BR, sk. You can translate it on lines 18, 31 and 111 of the corresponding traslation file (marked with [NT] as Not Translated)
  • A string was updated from Device trackers update to Devices / AiMesh update to signify thew same time interval for all the devices. Requires translations: cs, es, fr, nl, pt-BR, sk. Lines 49 and 141
  • New strings added for node events. Missing cs, es, fr, nl, pt-BR, sk. Lines 175:177

:books: Documentation

  • Added scripts for automatic generation of devices and available features
  • Updated compatible devices list
  • Updated feature list to show which of features are available in which device mode

:package: Dependencies

  • Bumped asusrouter library to 0.16.0

:hammer: Other changes

  • Switched to UnitOfDataRate enum (>= 2023.1.0)
  • Switched to UnitOfInformation enum (>= 2023.1.0)

:oncoming_automobile: New modes

As you might notice, this update brings 2 different modes of device - router and node. Even though everything will be working even with many routers, some of the entities will be repeating with no actual need.

As a result - it is recommended to have 1 router and many nodes. Then all the controls will be available through the router and nodes will only have useful sensors. Also, it will automatically avoid the creation of many repeating device trackers (only device trackers from the router are correct anyway)



AiMesh documentation

https://asusrouter.vaskivskyi.com/features/aimesh.html


:coffee: Support AsusRouter

Monetary support:

  • You can make a donation using the Buy Me a Coffee service
  • Thinking of buying a new Asus router to use with AsusRouter integration? Check the compatibility list in our Docs. If you will use any of the Amazon Associate links, I might get a small (1-3%) bonus from Amazon (usage of the associate links does not change the price of the items for you)

Non-monetary support:

  • Star AsusRouter repository
  • Know a person with an Asus device using Home Assistant but not AsusRouter? Let them know, AsusRouter is cool and has lots of useful features
3 Likes

Unfortunately then new 0.17.0 release not is working for me, the integration not starts up properly:

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/asusrouter/bridge.py:246
Integration: AsusRouter (documentation, issues)
First occurred: 23:24:09 (3 occurrences)
Last logged: 23:26:23

Error setting up entry 192.168.0.1 for asusrouter
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 24, in async_setup_entry
await router.setup()
File “/config/custom_components/asusrouter/router.py”, line 700, in setup
await self.update_nodes()
File “/config/custom_components/asusrouter/router.py”, line 807, in update_nodes
aimesh = await self.bridge.async_get_aimesh_nodes()
File “/config/custom_components/asusrouter/bridge.py”, line 257, in async_get_aimesh_nodes
return await self._get_data(self.api.async_get_aimesh)
File “/config/custom_components/asusrouter/bridge.py”, line 246, in _get_data
raw = await method()
File “/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py”, line 834, in async_get_aimesh
await self.async_monitor_onboarding()
File “/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py”, line 657, in async_monitor_onboarding
convert = converters.onboarding_connection(connection)
File “/usr/local/lib/python3.10/site-packages/asusrouter/util/converters.py”, line 313, in onboarding_connection
raise ex
File “/usr/local/lib/python3.10/site-packages/asusrouter/util/converters.py”, line 309, in onboarding_connection
“connection_type”: CONNECTION_TYPE[temp[0]],
KeyError: ‘5G1’

0.17.1 :bug: A bugfix

2023-01-08

:bug: Bug fixes

  • Fixed bug with AiMesh 5 GHz-2 connection between nodes (report #C364)

:package: Dependencies

  • Bumped asusrouter library to 0.16.1


@sesame26, please, check 0.17.1

@Vaskivskyi works with 0.17.1 !!! :+1:t2::+1:t2::+1:t2:

My HA haven’t detected this update. Is that available already?

I’m running HA 2023.1.1.

Now I can see it.

@EdwardTFN, sorry, was already writing a reply. HACS checks for updates with some periodicity. But you can always reload HACS and it will show updates immediately


@sesame26, great! Hope, you won’t have any problems with AsusRouter

2 Likes

:loudspeaker: Do you want to add AsusRouter to HA Core integrations?

:+1: Vote for the feature request!

2 Likes

@Vaskivskyi, any idea here? It started when I’ve updateom from v0.16.x to v0.17.1.

2023-01-09 13:03:40.811 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration asusrouter which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2023-01-09 13:05:06.155 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ASUSRouter for asusrouter

File "/config/custom_components/asusrouter/__init__.py", line 24, in async_setup_entry

File "/config/custom_components/asusrouter/router.py", line 680, in setup

ValueError: Unique id 'asusrouter_7c:10:XX:XX:XX:e0_guest_5_ghz_2_1' is already in use by 'switch.router_guest_5_ghz_2_1'

@EdwardTFN, oh, it seems like it happens to some users but not everyone. Also didn’t get it during tests with migration… Issue #450.

I will try to reproduce it and fix it today, so everyone can properly migrate. In case you don’t want to wait, it will work if you just remove and set up integration again.

Sorry

No problem. I can keep the issue until you have a fix, so you can use my case as a testing bed if you want, otherwise I will remove and setup again as this is not a big issue as well.

@Vaskivskyi I am getting these errors every few hours or so

2023-01-09 14:40:12.230 ERROR (MainThread) [custom_components.asusrouter.router] Error fetching ports data: None

2023-01-09 14:40:12.233 ERROR (MainThread) [custom_components.asusrouter.router] Error fetching gwlan data: None

2023-01-09 14:40:12.241 ERROR (MainThread) [custom_components.asusrouter.router] Error fetching parental_control data: None

2023-01-09 14:40:38.231 ERROR (MainThread) [custom_components.asusrouter.router] Error fetching ram data: None

2023-01-09 14:40:38.235 ERROR (MainThread) [custom_components.asusrouter.router] Error fetching wlan data: None

2023-01-09 14:41:10.230 ERROR (MainThread) [custom_components.asusrouter.router] Error connecting to ‘192.168.0.1’ for device update: None

2023-01-09 14:41:40.230 ERROR (MainThread) [custom_components.asusrouter.router] Error connecting to ‘192.168.0.1’ for device update: None

2023-01-09 14:42:10.229 ERROR (MainThread) [custom_components.asusrouter.router] Error connecting to ‘192.168.0.1’ for device update: None

@sesame26,

Are the sensors stuck or did they recover and started updating?

Do you connect to your device with the SSL option or without? It is recommended to use an SSL connection since it is more stable on most devices

@Vaskivskyi the sensors are available when I check, I not use SSL, to be honest I also have no idea how to do this, if I check the SSL conection box I get a “unknow error”

This error originated from a custom integration.

Logger: custom_components.asusrouter.config_flow
Source: custom_components/asusrouter/config_flow.py:863
Integration: AsusRouter (documentation, issues)
First occurred: 19:20:27 (3 occurrences)
Last logged: 19:21:59

Unknown error of type ‘<class ‘homeassistant.exceptions.ConfigEntryNotReady’>’ during connection to 192.168.0.1: (‘Cannot connect to host 192.168.0.1:80 ssl:True [None]’, None)
Unknown error of type ‘<class ‘homeassistant.exceptions.ConfigEntryNotReady’>’ during connection to 192.168.0.1: (‘Cannot connect to host 192.168.0.1:80 ssl:False [None]’, None)

@Vaskivskyi Ok did see also needed to change the port, now did set-up with the SSL box checked and the Check SSL Certificate box unchecked… I hope this is the correct way to do it :slight_smile:

0.17.2 :hammer: Migration improvement

2023-01-09

:bug: Bug fixes

  • Fix removing duplicates on unique_id migration (reports #C371, #443, #450)

:open_book: Translations

:hatching_chick: Github / HACS



@EdwardTFN, please check the update. Migration should work better now.


@sesame26, yes. This should work well. Just make sure, that SSL is enabled in your router settings. But if it works for your now, than it’s fine

Yeap!
The issue was fixed!

Thanks again for your great work, @Vaskivskyi.

1 Like

Since the lastest:

Logger: homeassistant.config_entries
Source: helpers/entity_registry.py:695
First occurred: 21:27:45 (2 occurrences)
Last logged: 21:36:38

Error setting up entry 192.168.2.1 for asusrouter
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 24, in async_setup_entry
    await router.setup()
  File "/config/custom_components/asusrouter/router.py", line 680, in setup
    entity_reg.async_update_entity(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 749, in async_update_entity
    return self._async_update_entity(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 695, in _async_update_entity
    raise ValueError(
ValueError: Unique id 'asusrouter_24:4b:fe:e4:ff:80_temperature_2_4_ghz' is already in use by 'sensor.rt_ac86u_temperature_2_4_ghz'

Debugging doesn’t show anything else.

Edit:

Forget it. Working with 0.17.2!

0.17.3 :bomb: A new bugfix for older devices

2023-01-09

:bug: Bug fixes

  • Fixed issue for the devices with missing label_mac value from NVRAM (some older devices with Merlin builds) preventing AsusRouter from start (report #451)

:package: Dependencies

  • Bumped asusrouter library to 0.17.0


@Ostracizado, sorry, I was already typing that with the latest version everything should work fine


Users with no problems regarding the mentioned issue do not need to urgently update.

P.S. Sorry for the double release today. Did not want to go to sleep and keep users with an unresolved bug.

:beers:


0.17.4 :bug: One more

2023-01-09

:bug: Bug fixes

  • Fixed bug in the backend library bothering some users with older FW

:package: Dependencies

  • Bumped asusrouter library to 0.17.1

5 Likes

Is it just me or is the documentation hard to understand? I would love to see some code examples in the documentation. Like one thing i want to know is how to i use parental control or device control? Is it not possible to make a list with ”flex-table-card” with name/ip/Mac/parental control for an example? Right now the only information i have found is make a automation and a Button that triggers it to turn on/off parental control that would make me have to create 40ish automations and that aint that great solution…