[Custom component] AsusRouter integration

Just a quick update as I have it working but I have new question :slight_smile:

  1. how do I filter the list as there are a few that I need to exclude? - done
  2. how do I use the node mac to lookup the node device name? - done.

Table now looks like this. Just need to work out how to get the RSSI for each device but this is not part of connected_devices entity. Any ideas?

Screenshot 2023-04-29 at 10.17.21 am

I may have encountered a significant performance issue with this integration. I’ve been experiencing high load recently and I finally ran the profiler with the following results:

After disabling the integration, the results were the same (indicating this integration may not clean up it’s resources properly when disabled). After a restart my profiler results were better:

This pretty clearly indicates to me this integration was causing the performance issues. My system load also dramatically decreased after the restart.

I’m posting this here as a first step and to get quicker/wider feedback. I’ll also be submitting an issue on github with more detailed information.

I hope you dont expect “normal” people should understand your posted pics and “numbers”
In short i understand " significant, and doesn’t clean up " , and i also have been searching for “power” consumers in my setup, as it has increased , over the past 3-5 month, you could say “significant” but as i run on a I5 laptop, im more talking about increase in CPU usage 1-2%, but still it’s about 50% increase without adding devices, automation etc. … how much the monthly HA updates causes of this i dont know, so i welcome your research, if it can bring it back down … in the long run IO and CPU usage cost money, and wear on disk

No, I don’t expect non-technical people to understand profiler diagrams. I’m posting it here for exposure and for anyone who is able to understand and comment on it to do so.

So what are we talking about, in terms of CPU, IO and Memory consumption ? , or are you also referring to response-time ?

I do however know that in particular 1 update( think it was this April ), slightly increased cpu and memory, in favor of less disk-writes

And i did “follow” your approach, disabled this integration, rebooted the host , slightly noticeable , in either cpu usage or memory consumption, not even " a pin " in Power-consumption

Thou ofcause, i have no idea how you use this integration

Hi all, I have this integration working quite well now - thanks to many contributions on this thread and others! Dashboard looks like this…

Really keen to get some assistance in getting RSSI included in the connected devices table but I can’t find anything on this…

Code if anyone is interested…

type: vertical-stack
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: sensor.rt_ax86u_connected_devices
        content: >-
          Wired: {{ state_attr('sensor.rt_ax86u_connected_devices',
          'devices')|selectattr('connection_type', '==', 'Wired') |list|count }}
        icon: mdi:lan-connect
        icon_color: green
        double_tap_action:
          action: none
        tap_action:
          action: none
        hold_action:
          action: none
      - type: template
        entity: sensor.rt_ax86u_connected_devices
        icon: mdi:wifi-strength-2
        content: >-
          2.4 GHz: {{ state_attr('sensor.rt_ax86u_connected_devices',
          'devices')|selectattr('connection_type', '==', '2.4
          GHz')|selectattr('guest', '==', false) |list|count }}
        icon_color: blue
        double_tap_action:
          action: none
        tap_action:
          action: none
        hold_action:
          action: none
      - type: template
        entity: sensor.rt_ax86u_connected_devices
        icon: mdi:wifi
        content: >-
          5 GHz: {{ state_attr('sensor.rt_ax86u_connected_devices',
          'devices')|selectattr('connection_type', '==', '5
          GHz')|selectattr('guest', '==', false) |list|count }}
        icon_color: purple
        double_tap_action:
          action: none
        tap_action:
          action: none
        hold_action:
          action: none
    alignment: center
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-entity-card
        entity: button.rt_ax86u_restart_wireless
        name: Restart WIFI
        primary_info: name
        hold_action:
          action: toggle
        tap_action:
          action: more-info
        double_tap_action:
          action: toggle
        fill_container: false
        icon_color: deep-purple
        secondary_info: none
      - type: custom:mushroom-entity-card
        entity: button.rt_ax86u_reboot
        name: Reboot Router
        primary_info: name
        hold_action:
          action: toggle
        tap_action:
          action: more-info
        double_tap_action:
          action: toggle
        fill_container: false
        icon_color: orange
        secondary_info: none
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-update-card
        entity: update.rt_ax86u_firmware_update
        name: Firmware
      - type: custom:mushroom-template-card
        secondary: 'IP: {{state_attr(entity, "ip")}}'
        primary: |
          {% if is_state(entity, "on") %} 
          Internet Connected 
          {% else %} 
          Internet Down 
          {% endif %}
        icon_color: |
          {% if is_state(entity, "on") %} 
          blue 
          {% else %} 
          red 
          {% endif %}
        icon: |
          {% if is_state(entity, "on") %} 
          mdi:check-network-outline 
          {% else %}
          mdi:network-off-outline 
          {% endif %}
        entity: binary_sensor.rt_ax86u_wan
        tap_action:
          action: more-info
        multiline_secondary: false
  - type: custom:mushroom-entity-card
    entity: sensor.rt_ax86u_boot_time
    name: Router Last Rebooted (Uptime)
    icon_color: brown
  - type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        name: Download
        entities:
          - sensor.rt_ax86u_wan_download_speed
      - type: custom:mini-graph-card
        name: Upload
        entities:
          - sensor.rt_ax86u_wan_upload_speed
  - type: horizontal-stack
    cards:
      - type: gauge
        entity: sensor.rt_ax86u_ram
        name: RAM
        needle: false
      - type: gauge
        entity: sensor.rt_ax86u_cpu
        name: CPU
  - type: custom:fold-entity-row
    padding: 0
    head:
      label: Connected Devices
      type: section
      tap_action:
        action: none
    entities:
      - type: custom:flex-table-card
        sort_by:
          - devices+
        strict: true
        entities:
          include: sensor.rt_ax86u_connected_devices
        columns:
          - data: devices
            name: ' Device Name'
            modify: x.name
          - data: devices
            name: ' IP'
            modify: x.ip
            hidden: true
          - data: devices
            name: ' Connection'
            modify: x.connection_type
          - data: devices
            name: ' Node'
            modify: >-
              if(x.node == "a8:5e:45:x:x"){"Balcony"} else if(x.node ==
              "7c:10:c9:ec:x:x"){"Living"} else if(x.node ==
              "3c:7c:3f:44:x:x"){"Bedroom"} else{x.node}

2 Likes

I am not getting tracker updates from this integration. Been that way for awhile. Devices never change to Away unless I reload the integration.
Any solution for this?

1 Like

Does toggling the LED entity write to NVRAM or does it only change the value in the NVRAM mirror? I have merlin so I can’t test it by rebooting.

Currently I have a cron job set up on the router to toggle the LED at night and in the morning, but I only write to the NVRAM mirror to avoid wear on the flash. But if this service doesn’t write to the NVRAM either then it would be better to set up an automation in HA.

Hello, @szerencl,

The integration uses the FW service ctrl_led the same way as the Web UI is doing (via this button in the AiMesh panel).

Snapshot

image

As far as I know, it writes the value to NVRAM directly and on the stock FW the LED state is staying the same even after reboot. At the same time, Merlin ignores this NVRAM value and does not load it on boot (because long ago Merlin implemented a different way to disable LEDs). To work around it, when the communication library notices a reboot and if the last state of the LED is “off”, it actually sends to Merlin (and only Merlin) an “on”/“off” sequence for the LED to restore the correct state. With the “on” value from before the reboot, nothing is sent.

Considering the fact that this is exactly the same behaviour as the Web UI has, I don’t think this should be a problem for the NVRAM wear. Especially considering the number of changes written to NVRAM constantly in any case. But this is up to you to decide what is better in your case.


@kramttocs, hello. I am constantly trying to improve the device tracking features. Unfortunately, the lack of any testing devices (except for the only RT-AX88U I have) and the fact that the issue might happen and not happen to the two identical devices with the same FW version is not helping in solving it fast.
But it will be solved eventually.


@scottg489,

Can you please open an issue on GitHub with all the details about the problems you are experiencing, so that we can troubleshoot and solve everything properly.


To everyone else. If you are experiencing some issues and there is no such issue on GitHub yet, please open an issue. If the same issue already exists, please just comment on it with the device model and the FW version you are using.

With time it’s getting harder to track all the issues here and this can help with providing fixes much faster.


The new version is coming soon to AsusRouter. Please, stay tuned :slightly_smiling_face:

3 Likes

RT-AX88U stock firmware. I’m finding that the integration is corrupting my static IPs and the router is “forgetting” the name of my tracked devices and their statix ip management gets messed up. Only happens to devices tracked through the integration.

Anyone else?

Hello,

AsusRouter cannot directly access the DHCP server table and cannot change the IPs set to static. Please, check your device’s DHCP settings (available at https://YOURROUTERIP:8443/Advanced_DHCP_Content.asp). Are they changed from what it was?

As per the “forgetting the name of tracked devices”, I would need more context. How do you see this? When and how it happens? And what do you actually mean by the device name?

Thanks in advance for the provided info

What are your thoughts on adding a service to reload the integration? I see some integrations have this.
Just thinking that maybe reloading the integration on a daily basis may help with the device tracker issue. I know we don’t want to rely on it as a permanent solution.

Isn’t there a Service available in Core already that let’s you reload any integration? Why not just create an automation using that to do what you need…

Is there? I looked through them but didn’t see one that allowed you to pick an integration. Will look again. But yes, an automation using a service is what I am looking to do.

Something like this should work…(does for me anyway, tho not with this integration)
Obv add in your own entity_id and/or device_id

service: homeassistant.reload_config_entry
target:
  entity_id:
    - entity1
    - entity2
  device_id: device 1
data: {}
1 Like

Thanks! I’ll give that a try. I know it’s purely a workaround but interested to see if this helps.

Stumbled upon this integration after getting very frustrated with ASUSWRT. From what I can tell it’s FANTASTIC! I do have one question that I’m close to pulling my hair out over! I have an ASUS AiMesh setup in my house consisting of:

1x Main Router
2x Wired Nodes
1x Wireless Node

I mainly use the integration as a device tracker so I can trigger certain events when family members are home vs. away…However, my issue is that when a user (android or IOS) connects to the Wireless node (happens to live outside on the patio to cover the backyard), the entity state for that device shows as: AWAY even though they are still connected to the network. How do I tell this integration to over-ride also use the wireless node as part of the tracker?!

Thanks again for all the great community support!! Look forward to figuring out this small issue!

EDIT: I am running stock firmware and tried both Router and AP Access mode with no luck on either.

Hi Mark,

I also have an ASUS AiMesh AC set up in my house consisting of 3 units:

1 router
1 node (wired)
1 node (wireless)

My wireless node is also to provide coverage for the back yard however in still inside the house against the back wall. My wireless node only has the 5GHz radio turned on (2.4GHz disabled) as the backyard coverage I need is for family and guest cell phones. All my IoT devices (2.4GHz) connect to one of the two wired nodes either Ethernet of WiFi.

I too use this excellent AsusRouter integration to track which family members are visiting (adult children living away) as well as home residents (my wife & I) home or away via cell phones (combination of iPhones and Android devices). For me and my wife I also use geofencing apps to supplement the AsusRouter wifi presence.

I just tested the AsusRouter presence for myself by going into the backyard and confirming my iPhone was connected to the wireless node. My iPhone entity remained as ‘Home’ and did not switch to ‘Away’ when my phone WiFi connection roamed from the main router node to the wireless backyard node. I too am running stock firmware and the latest software release for the ZenWiFi AC hardware. Just thought I’d share my findings and experience in case it helps you and/or the integration developer.

The device tracker finicky-ness is a known issue but tough nut to crack. When you are seeing this behavior, if you reload the integration, does it immediately update to HOME?

1 Like