[Custom component] AsusRouter integration

A small announcement for the new feature coming to the integration :slightly_smiling_face:

Announcement image here

2 Likes

Love it. :slight_smile:
I understand those are in seconds. But please help specify unit on the UI somewhere - no need to keep the users guessing.

1 Like

Iā€™ll add the units :slightly_smiling_face:

image

Will be available with the next release

2 Likes

This just made my day! Thank you!

Iā€™ve been manually going in and disabling these entities one-by-one since it has been causing so many issues with my Kasa Devicesā€™ connectivity (donā€™t ask :rofl: - long story that has nothing to do with your Integration).

Looking forward to it!

:boom: [BREAKING] With version 0.9.0 (when released), the devices attribute of the Connected devices sensor will change the format from a list of strings to a list of dictionaries. As a result, you will need to correct your templates.

I am attaching new versions you will need instead of the 2 types of code we discussed before.

Template with tabs alignment
{% set ns = namespace(
  devices = state_attr('sensor.rt_ax88u_connected_devices', 'devices'),
  max_length = 0,
  max_tabs = 0)
%}
{# Save the maximum length of device names #}
{% for item in state_attr('sensor.rt_ax88u_connected_devices', 'devices') %}
  {%- if item.name|length > ns.max_length %}
    {%- set ns.max_length = item.name|length %}
  {%- endif %}
{% endfor %}
{# Sort #}
{%- set ns.devices = ns.devices|sort(attribute="name", case_sensitive=true) %}
{%- set ns.max_tabs = (ns.max_length / 8)|int %}
{# Output #}
{% for device in ns.devices %}
  {{- device.name }}
  {%- set tabs = (device.name|length / 8) | int %}
  {%- for tab in ['\t']|batch(ns.max_tabs - tabs + 1, '\t') %}
    {%- for el in tab %}
      {{- el }}
    {%- endfor %}
  {%- endfor %}
  {{- device.ip + '\t' + device.mac }}
{% endfor %}
Flex Table Card
type: entities
entities:
  - type: custom:fold-entity-row
    padding: 0
    head:
      entity: sensor.rt_ax88u_connected_devices
      icon: mdi:router-wireless
      tap_action:
        action: none
    entities:
      - type: custom:flex-table-card
        sort_by:
          - devices+
        entities:
          include: sensor.rt_ax88u_connected_devices
        columns:
          - data: devices
            name: ' Device Name'
            icon: mdi:devices
            modify: x.name
          - data: devices
            name: ' Address'
            icon: mdi:ip-network
            modify: x.ip
          - data: devices
            name: ' MAC'
            icon: mdi:barcode-scan
            modify: x.mac
        card_mod:
          style: |
            ha-card {
              box-shadow: none;
              background: none;
            }

You will need to update the code in a similar way only after updating to 0.9.0

3 Likes

Cool.
Much better now.

So, here we go, 0.9.0 is released:

:bomb: IMPORTANT! A breaking change for the devices attribute of the Connected devices sensor as discussed above. Please, check 2 messages before for the new code examples.

:hourglass: A new possibility - to select a custom update interval for different sensors independently.

:mag: Device trackers got many new updates:

  • you can now disable them;
  • select their own update interval, independent from all other sensors;
  • one nasty bug was fixed, so fewer errors in your HA logs and fewer freezes of the integration.

:open_book: Many code optimizations to faster work on it and decrease the time for bug fixes.

The full release notes are available here: Release 0.9.0 :boom: Breaking change :hourglass: Update intervals for different sensors and device trackers customizations :mag: Ā· Vaskivskyi/ha-asusrouter (github.com).

The update is already available via HACS.

3 Likes

0.9.0 working great, thanks for the update.

Was reading through the GitHub notes and you can add model 4G-AC55U to your list as the component works perfectly on this model with stock firmware (sorry, should have let you know that sooner)

Quick slightly off topic Qā€¦anyone know if is it possible to sort the Flex Table Card by IP Address?

As the same field is used for the three columns I donā€™t think the sort key will make any difference.
But I believe it always sort the first column (if no other instruction), then you can move IP for the first column. Is that OK?

1 Like

I managed to sort by IP by having a hidden copy of that in the first column.

I still using the old version, but my card looks like this:

type: custom:flex-table-card
title: Connected devices
entities:
  include: sensor.rt_ac88u_connected_devices
columns:
  - data: devices
    name: IP_hidden
    modify: x.split('/')[1]
    hidden: true
  - data: devices
    name: Name
    modify: x.split('/')[2]
  - data: devices
    name: IP
    modify: x.split('/')[1]
  - data: devices
    name: MAC
    modify: x.split('/')[0]
sort_by:
  - devices

With the new format it will look like this:

type: entities
entities:
  - type: custom:fold-entity-row
    padding: 0
    head:
      entity: sensor.rt_ax88u_connected_devices
      icon: mdi:router-wireless
      tap_action:
        action: none
    entities:
      - type: custom:flex-table-card
        sort_by:
          - devices+
        entities:
          include: sensor.rt_ax88u_connected_devices
        columns:
          - data: devices
            name: 'IP_hidden'
            modify: x.ip
            hidden: true
          - data: devices
            name: ' Device Name'
            icon: mdi:devices
            modify: x.name
          - data: devices
            name: ' Address'
            icon: mdi:ip-network
            modify: x.ip
          - data: devices
            name: ' MAC'
            icon: mdi:barcode-scan
            modify: x.mac
        card_mod:
          style: |
            ha-card {
              box-shadow: none;
              background: none;
            }

Yes, @EdwardTFN is right, you can use a hidden column. Also, there is no need to assign a name to it. After upgrading to version 0.9.0 of the integration the code will be like this:

Code
type: entities
entities:
  - type: custom:fold-entity-row
    padding: 0
    head:
      entity: sensor.rt_ax88u_connected_devices
      icon: mdi:router-wireless
      tap_action:
        action: none
    entities:
      - type: custom:flex-table-card
        sort_by:
          - devices+
        entities:
          include: sensor.rt_ax88u_connected_devices
        columns:
          - data: devices
            modify: x.ip
            hidden: true
          - data: devices
            name: ' Device Name'
            icon: mdi:devices
            modify: x.name
          - data: devices
            name: ' Address'
            icon: mdi:ip-network
            modify: x.ip
          - data: devices
            name: ' MAC'
            icon: mdi:barcode-scan
            modify: x.mac
        card_mod:
          style: |
            ha-card {
              box-shadow: none;
              background: none;
            }
2 Likes

Brilliant, thanks to you both for that @Vaskivskyi
@EdwardTFN
Sometimes itā€™s the obvious solution thatā€™s hardest to find :grin:. Think I need more coffee :coffee:
Thanks again.

1 Like

Thanks for the update! But, for some reason the ā€œConnected Devicesā€ is now showing 0 (see screenshot). And under attributes, there are no devices listed. Any idea as to why this is?

I deleted the ā€œIntegrationā€ and re-installed it (Note: I did NOT uninstall the HACS portion; just the Integration) with no effect. I restarted the RPi (running Home Assistant OS) a few times so far without any luck. Iā€™ll try re-installing the HACS Add-On (and the Integration as well) to see if that fixes it.

Edit 1: I just rebooted my ASUS Router to see if maybe a refresh was needed, but unfortunately that wasnā€™t it either.

Edit 2: For reference, my router model is an RT-AX58U.

Edit 3: I reinstalled the HACS Add-On and then the Integration - no luck. I have a thought as to why I am running into the problemā€¦ could it be that enabling ā€˜Device Trackersā€™ is required for this to work?

Hey,

I am sorry for this. It is really the case, that if the device tracking is disabled, the connected devices sensor stops working, which I didnā€™t consider before. The fix will be released today

Version 0.9.1 is already available in HACS and will allow keeping the Connected devices sensor working when device trackers are disabled.

Full changelog: Release 0.9.1 A bugfix and a feature Ā· Vaskivskyi/ha-asusrouter (github.com)

1 Like

@Vaskivskyi Thank you! I updated it and all is working very, very well! I am definitely buying you a cup of coffee (Edit: Just sent you a few cups of coffee :rofl:) - I donā€™t think Iā€™ve ever seen a developer so active with the community regarding their Integration/Add-On, especially one that specifically updates their project just to fix one thing for ONE individual. Thank you again.

As a side note, I did notice higher than normal CPU usage on the RPi, however I have yet to investigate. It is unlikely that this Integration is the cause, but just wanted to throw it out there. :wink:
I did a reboot of the RPi and the usage dropped back to normal parameters - all is well!

Screenshots:


ASUS Router - Screen Shot 2

Thanks a lot for your support! :heart:

I am always happy when my integration works for others. And that would be rude of me to promise and release a new feature, and keep it breaking something else :smiley:

P.S. Nice dashboards! :+1:

2 Likes

Hey,

Since my memory is not that good anymore :laughing: and in order for you to see the status of new features :mag_right: coming to the integration in future, AsusRouter GitHub (link in the 1 post) now has a section New features development :hammer_and_wrench:. There you can find out what features are considered, in progress or cannot currently be implemented.

If anything is missing from the list, let me know.

1 Like