[Custom component] AsusRouter integration

0.24.0b2

2023-11-16

:octopus: GitHub release ←

:rocket: Features

  • Added integration reload on sensors interval change

:bug: Bug fixes

  • Fixed network sensors interval

0.24.0b3

2023-11-17

:octopus: GitHub release ←

:bug: Bug fixes

  • Fixed missing arguments on state setting (report #710)

:package: Dependencies

  • Bumped asusrouter library to 1.1.0b2

Hi All,

Have a question about device_trackers.
I have one for my Home Assistant also:

mac: dc:xx:xx:xx:72:5c
name: Home Assistant
source_type: router
host_name: Home Assistant
connection_type: disconnected
internet_mode: unknown
vendor: Raspberry Pi Trading Ltd
icon: mdi:radar
friendly_name: Home Assistant
templates:
icon: mdi:radar
icon_color: if (state === ‘on’) return ‘#1E90FF’; return ‘grey’;
icon_color: grey

Now i migrate my HA to a Dell 3050 with same static IP.
Only thing now what is changed is MAC Address.

The integration still monitor this one (above) and ddn’t create a new sensor with new MAC address.

What can i do to change this?

EDIT: The new MAC and hostname is in connected devices attributes:

guest: false
connected: ‘2023-11-16T10:40:01+00:00’

  • mac: e4:70:xx:xx:xx::93
    ip: 192.168.100.24
    name: ha
    connection_type: 5ghz

You should Not use same host_name for 2 different devices ( whether it’s IP or MAC it’s “mapped” to )
Anyway have you looked in “hidden/disabled” entities ?

I was edit my post. Hostname is different.

1 Like

if you click "“sensor.connected:device” and go through it it should be there, however it’s “disabled”, Look in /Setting/devices/integration list entities, it’s there (disabled) Enable it ( device_tracker. mac-address )

Im so stupid:

I was searching for “device_tracker.ha…” But frist boot with the Dell was with Windows 11. So the device_tracker got a different name.

device_tracker.msft_5_0

Problem solved… haha

1 Like

Done that quite a few times :smile:

1 Like

0.24.0 :earth_africa: VPNs, WANs and stability

2023-11-19

:octopus: GitHub release ←

:boom: Breaking

  • Implemented changes in wan binary sensor. Refer to the Features section for details

:rocket: Features

  • Added support for VPN Fusion (VPN clients, stock FW 388+)
  • Added support for WireGuard (clients + server) (stock and Merlin FW 388+) (report #594)
  • Added support for OpenVPN (clients + servers) (stock FW 388+) (report #470)
  • Added support for secondary WAN and changed WAN sensors (report #603)
  • Binary sensor wan (wan_secondary)
  • Sensors wan_ip and wan_ip_extra (wan_ip_secondary and wan_ip_secondary_extra)
  • Added internet binary sensor to show the general state of the device internet connection (and IP address as an attribute of the sensor)
  • Added dualwan binary sensor
  • Added wan_aggregation binary sensor

:bug: Bug fixes

  • Fixed error in historic data calculation
  • Other minor fixes in data processing
  • Fixed issue with blocked possibility to reload integration
  • Fixed diagnostics module
  • Fixed missing arguments on state setting (report #710)
  • Fixed network sensors interval
  • Fixed missing values for OpenVPN client
  • Fixed missing temperature sensors
  • Fixed unsafe dictionary operation

:package: Dependencies

  • Bumped asusrouter library to 1.1.0

:mag:Help with testing AsusRouter during the development

If you want to help with testing AsusRouter before the new versions are released, you can help by providing the data from your devices for automated tests. More devices covered - more chances there will be no bugs coming to releases.

Find out what and how to do here:


:coffee: Support AsusRouter

Monetary support:

Non-monetary support:


0.24.1 :adhesive_bandage:

2023-11-20

:octopus: GitHub release ←

:bug: Bug fixes

  • Fixed issue with WireGuard phantom data appearing on FW below 388 (report #715)

:package: Dependencies

  • Bumped asusrouter library to 1.1.1

I no longer see guest as attribute on connected_devices. Is it removed? I only have mac, ip, name, connection_type and node.

Sorry, there was a mistake in the code, causing all the connections to be considered wired. As a result, the guest parameter was also lost. This will be fixed as soon as possible

0.24.2 :adhesive_bandage:

2023-11-21

:octopus: GitHub release ←

:bug: Bug fixes

  • Fixed reboot flag not being reset, causing LED to turn off-on repeatedly (report #709)
  • Fixed issue with all devices marked wired and losing wireless attributes, e.g. guest, rssi and else (report #719, #C674)

:package: Dependencies

  • Bumped asusrouter library to 1.1.2

@Quacked, please check whether the issue is fixed for you

1 Like

Hi , thanks for a fast fix, just noticed there was “none” wifi-devices in my system-view, when you reported it :slight_smile:
However now it seems a small typo broke my templates
21.11.2023_23.25.20_REC

notice the previous “2.4 GHz” is only showing “2ghz”, or is that on purpose ?

PS: it doesn’t matter in my case as i only go for the attribute, in a “sum:up” showing the total devices on wifi2 VS wifi5
and you also changed GHz to ghz, on both 2.4 and 5

PS: i am in “favor” of less code, so skipping dot’s and spaces and capital letters, is something i could have done my self :slight_smile: , for something which doesn’t need to be showed, or can be added in the rendering of a card

working again
21.11.2023_23.44.28_REC

Sorry, some attributes were changed with 0.23.0 to bring all the used values to the same format. Might be that I missed it in the release notes

1 Like

hmmmm, to be honest i didn’t even read properly, just skimmed it :smile:

1 Like

Greetings,

Firstly, even though I’ve said thanks in previous posts, thanks again for an awesome integration. :smiley:

Unfortunately it seems that I have run into some trouble after the upgrade from 0.23.xx to 0.24.xx. Specifically the integration won’t load on startup any longer. And because of this, Home Assistant won’t let me delete the Integration so I can re-install it. And, of course, since I can’t delete the Integration, I can’t delete the HACS Integration either.

Below are the logs that show the error:

Logger: homeassistant.setup
Source: setup.py:185
First occurred: 4:14:49 PM (1 occurrences)
Last logged: 4:14:49 PM

Setup failed for custom integration asusrouter: Requirements for asusrouter not found: ['asusrouter==1.1.2'].
Logger: homeassistant.util.package
Source: util/package.py:102
First occurred: 4:12:08 PM (3 occurrences)
Last logged: 4:14:49 PM

* Unable to install package asusrouter==1.1.2: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa577ec90>: Failed to establish a new connection: [Errno -3] Try again')': /simple/asusrouter/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2c2a890>: Failed to establish a new connection: [Errno -3] Try again')': /simple/asusrouter/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2bbc110>: Failed to establish a new connection: [Errno -3] Try again')': /simple/asusrouter/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2c1c890>: Failed to establish a new connection: [Errno -3] Try again')': /simple/asusrouter/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2c46bd0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/asusrouter/ WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2befc10>: Failed to establish a new connection: [Errno -3] Try again')': /musllinux-index/asusrouter/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2bedbd0>: Failed to establish a new connection: [Errno -3] Try again')': /musllinux-index/asusrouter/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2badad0>: Failed to establish a new connection: [Errno -3] Try again')': /musllinux-index/asusrouter/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2c12010>: Failed to establish a new connection: [Errno -3] Try again')': /musllinux-index/asusrouter/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa2c37d90>: Failed to establish a new connection: [Errno -3] Try again')': /musllinux-index/asusrouter/ ERROR: Could not find a version that satisfies the requirement asusrouter==1.1.2 (from versions: none) ERROR: No matching distribution found for asusrouter==1.1.2

Any help is much appreciated!

Hi,

The error is saying that pip (Python package manager) is having trouble connecting to the package index server.

Failed to establish a new connection: [Errno -3] Try again

Check that you are not accidentally blocking network requests to the PyPI (e.g. if you have any traffic-filter software in front of the HA)

1 Like

Thanks. I had to change my logic to check for guest == true instead of guest == false but that’s ok. It makes sense to not show guest attribute for wired devices.

1 Like

nice card. Can you show the code? :slight_smile:

1 Like

ohhh, well it’s a “combo” of a huge bunch of cards/templates and card_mod :smile:
Beside i have some “settings” in my Theme which affect the “outcome” ( for i.e custom:text-divider-row, special code) and colors etc
I mainly have either grid-layout, or 3 columns vertical-stack as a “foundation” for my views.( to easy adapt to Phone)
OverView is 3 columns (status page) here is 1st “inns” of the Overview (Laptop)

Here is the code for the “requested” part, however as mentioned above i don’t know if it’s just a “copy/paste” example, but i hope it can give you some ideas

  • templates/entities are using " sensor.asusr_connected_devices / + /device_tracker + / “old"groups(in config.yaml) for specific “device_trackers” for i.e Cameras/Wired-Hubs-Controllers/specific-important-computers” :crazy_face:
  • Cards are … as follow
square: false
columns: 1
type: grid
cards:
  - type: custom:text-divider-row
    text: IP Network Status
    align: center
  - type: custom:banner-card
    heading: false
    row_size: 12
    card_mod:
      style: >
        ha-card {
          margin: -12px 0px 9px 0px;
          --mdc-icon-size: 0px;
          --secondary-text-color: #87bf50;
        }  ha-card div.overlay-strip div.entities div.entity-state
        div.entity-value {
          color: #FFBF00;
        } ha-card div.overlay-strip {
          box-shadow: none;
          background: rgba(0,0,0,0.0);
        }    :host {
          margin: 0px 0px 0px 0px;
          --banner-card-entity-value-size: 12px;
          --banner-card-spacing: 3px;
        }   ha-card div.overlay-strip div.entities div.entity-state
        div.entity-value div.entity-padded {
          padding: 0px 20px 0px 0px;
          margin: -10px 0px 0px -20px;
        }
    entities:
      - type: custom:template-entity-row
        entity: group.wired_home
        state: >-
          {%- set wired_home = expand('group.wired_home') %}

          {{ wired_home| selectattr('state', 'in', ['home'] ) | list | count }}
          / 8
        secondary: Wired -
        name: []
        size: 4
      - type: custom:template-entity-row
        entity: sensor.asusr_connected_devices
        secondary: Wifi 2.4 -
        name: []
        state: >-
          {{
          state_attr('sensor.asusr_connected_devices','devices')|selectattr('connection_type','==','2ghz')|selectattr('guest',
          '==', false) |list|count }}
        size: 4
      - type: custom:template-entity-row
        entity: sensor.asusr_connected_devices
        name: []
        secondary: Wifi 5.0 -
        state: >-
          {{
          state_attr('sensor.asusr_connected_devices','devices')|selectattr('connection_type','==','5ghz')|selectattr('guest',
          '==', false) |list|count }}
        size: 4
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-entity-card
        entity: sensor.asusr_connected_devices
        primary_info: last-updated
        secondary_info: none
        icon_type: none
        name: []
        card_mod:
          style: |
            ha-card {
              border-radius: 0px;
              margin-top: -25px;
            }
            :host {
              height: 0px;
              --mush-card-primary-font-size: 14px;
              --mush-card-primary-font-weight: lighter;
            }
      - type: entities
        entities:
          - type: custom:fold-entity-row
            padding: 0
            head:
              type: custom:mushroom-template-card
              entity: group.wired_home
              primary: >-
                {%- set wired_home = expand('group.wired_home') %}  {{
                wired_home| selectattr('state', 'in', ['home'] ) | list | count
                }} / 8
              icon: mdi:network-outline
              icon_color: '#87bf50'
              layout: horizontal
            entities:
              - type: custom:auto-entities
                card:
                  square: false
                  columns: 1
                  type: grid
                card_param: cards
                entities:
                  - type: custom:mushroom-entity-card
                    entity: device_tracker.***
                    name: I-HUB
                    icon_color: '#87bf50'
                    horizonal: true
                    hide_state: true
                    card_mod:
                      style: |
                        ha-card {
                          margin: -18px 0px 0px -10px;
                        } 
                        :host {
                            --mush-icon-size: 0px;
                            --mush-icon-symbol-size: 20px;
                            --mush-card-primary-font-size: 11px;
                            --mush-card-primary-line-height: 12px;
                            --mush-card-primary-font-weight: lighter;
                        }
				
#				*** PS: I have removed the rest of entities here, but included the card_mod(applied to each)
#				*** You could use auto_entities in here( as it's "fold-entity-row you can also use button_cards"
				
        state_color: false
        card_mod:
          style: |
            ha-card {
              --primary-text-color: #FFBF00;
              border-radius: 0px;
              margin-top: -42px !important;
              margin-bottom: -30px !important;
              margin-left: -35px;
              margin-right: 00px;
              padding-top: 0px !important;
            }  
            :host {
              --mush-icon-size: 0px;
              --mush-icon-symbol-size: 26px;
              --mush-card-primary-font-size: 14px;
              --mush-card-primary-font-weight: lighter;
              --mush-card-primary-line-height: 12px;
            }
      - type: entities
        entities:
          - type: custom:fold-entity-row
            padding: 0px;
            head:
              type: custom:mushroom-template-card
              entity: group.camera_home
              primary: >-
                {%- set camera_home = expand('group.camera_home') %} {{
                camera_home | selectattr('state', 'in', ['home'] ) | list |
                count }} / 6
              icon: mdi:cctv
              icon_color: '#87bf50'
              layout: horizontal
            entities:
              - type: custom:multiple-entity-row
                entity: device_tracker.***
                name: TPC1
                icon_color: '#87bf50'
                show_state: false
                card_mod:
                  style: |
                    hui-generic-entity-row {
                    height: 15px;
                    margin: 0px 0px 0px -40px;
                    }
                    :host {
                      --mdc-icon-size: 20px;
                      font-size: 12px;
                    }
				
#				*** PS: I have remove the rest of the hardcoded entities here, but included the card_mod(applied to each)
#				*** You could use auto_entities in here( as it's "fold-entity-row you can also use button_cards"
				
        state_color: false
        theme: noctis-grey
        card_mod:
          style: |
            ha-card {
              --primary-text-color: #FFBF00;
              margin-top: -42px !important;
              margin-bottom: -30px !important;
              margin-left: -20px;
              margin-right: -20px;
              padding-top: 0px !important;
            }  
            :host {
              --mush-icon-size: 0px;
              --mush-icon-symbol-size: 26px;
              --mush-card-primary-font-size: 14px;
              --mush-card-primary-font-weight: lighter;
              --mush-card-primary-line-height: 12px;
            }
  - type: custom:text-divider-row
    text: IP Devices
    align: center
    card_mod:
        style: |
                    hui-generic-entity-row {
                    height: 14px;
                    margin: 0px 0px 10px -40px;
                    }
                    :host {
                      --mdc-icon-size: 20px;
                      font-size: 12px;
                    }
        state_color: false
        theme: noctis-grey
        card_mod:
          style: |
            ha-card {
              --primary-text-color: #FFBF00;
              margin-top: -42px !important;
              margin-bottom: -30px !important;
              margin-left: -20px;
              margin-right: -20px;
              padding-top: 0px !important;
            }  
            :host {
              --mush-icon-size: 0px;
              --mush-icon-symbol-size: 26px;
              --mush-card-primary-font-size: 14px;
              --mush-card-primary-font-weight: lighter;
              --mush-card-primary-line-height: 12px;
            }

Hope you can use some of it

PS: In View ADD_new card, chose manual, paste it in, it should show something similar as shown here

PS2: i just noticed the 2 “fold-entity-row” is “Under Re-Construction” , 2 diff-versions … to play around with :wink: … considered it as a Bonus :smile:

2 Likes

That was it - thanks for the suggestion - I don’t know how I missed that error in the logs. This is the third time in 2 years where Home Assistant changes something in how it handles DNS after a Supervisor Update. I had to add a passthrough (of sorts) in AdGuard Home for Home Assistant to get it back up, then close the passthrough. Strange.

1 Like