/ha-asusrouter

Monitor and control your AsusWRT-powered router from Home Assistant

Primary LanguagePythonApache License 2.0Apache-2.0

GitHub Release LicenseBuild Status
HACS Default Community forum discussionBuy Me A Coffee

Monitor and control your AsusWRT-powered router from Home Assistant

AsusRouter is a custom integration for Home Assistant to monitor and control your AsusWRT (and AsusWRT-Merlin)-powered router using the AsusRouter python library.

The integration uses the native HTTP(S) API (the same way as WebUI) and relies on direct communication with your device.

Firmware limitations

Firmware versions 3.0.0.4.x are fully supported (older versions might have a limited amount of sensors available). When talking about the FW, 3.0.0.4 might be missed since it is the same all the time. Important is only the last part, e.g. 386.48631 for the stock or 386.7 for Merlin FW.

Firmware 5.x.x (some DSL models) is NOT supported (not AsusWRT).

Installation

HACS

You can add this repository to your HACS: HACS -> Integrations -> Explore & Download Repositories -> AsusRouter

Manual

Copy content of the stable branch custom_components/asusrouter/ to custom_components/asusrouter/ in your Home Assistant folder.

Usage

After AsusRouter is installed, you can add your device from Home Assistant UI.

Open your Home Assistant instance and start setting up a new integration.

To connect to the device you need to provide the following data:

  • IP address or hostname
  • Username (the one you use to log into the WebUI)
  • Password
  • Whether to use an SSL connection

Our Setup documentation may provide you with detailed information on the configuration flow and all the possible options.

Almost all the integration settings can be reconfigured later via the Configure button on the Integrations page without the need to remove your device and add it again.

Open your Home Assistant instance and show your integrations.

Monitoring

Binary sensors

OpenVPN Client (non-control mode only)

(enabled by default)

  • name: openvpn_client_x
  • attributes:
    • error_code
    • status - status of the connection (disconnected, connecting, connected)
  • attributes (FW: Merlin-only):
    • auth_read
    • local_ip
    • post_compress_bytes
    • post_decompress_bytes
    • pre_compress_bytes
    • pre_decompress_bytes
    • public_ip
    • server_auth
    • server_ip
    • server_port
    • tcp_udp_read_bytes
    • tcp_udp_write_bytes
    • tun_tap_read_bytes
    • tun_tap_write_bytes
    • update_time
  • description: Sensor value represents the current state of the OpenVPN client. Please, note, that both connected and connecting status will correspond to the switch being in the On state
WAN status

(disabled by default)

  • name: wan
  • attributes:
    • dns
    • gateway
    • ip
    • ip_type - type of the IP (can be static, dhcp and more)
    • mask
    • private_subnet
  • description: Sensor value represents the internet connection of the device
WiFi (non-control mode only)

(enabled by default)

  • name: wireless_{}, where {} can be 2_4_ghz, 5_ghz, 5_ghz_2, 6_ghz
  • attributes:
    • auth_method
    • channel
    • channel_bandwidth
    • chanspec
    • country_code
    • gmode_check
    • group_key_rotation
    • hidden
    • maclist_x
    • macmode
    • mbo_enable
    • mfp
    • mode
    • password
    • radius_ipaddr
    • radius_key
    • radius_port
    • ssid
    • wpa_encryption
    • xbox_optimized
  • description: Sensor value represents the current value of the WiFi network

Device trackers

Device trackers are disabled by default if HA doesn't know the device. The generated device_tracker.device_name entities include device_name as reported by AsusRouter library according to the priority list:

  • Friendly name of the device (if set in the router admin panel)
  • Name as reported by the connected device
  • MAC address if neither of the above is known
Attributes
  • connection_time - time of connection to the router (only wireless devices)
  • connection_type - type of connection (Wired, 2.4 GHz, 5 GHz). Implementation of 6 GHz requires a test device.
  • host_name - the name of the connected device as stated before
  • internet - internet connection of the device, boolean: true - connected, false - disconnected
  • internet_mode - internet mode of the device: allow - internet access alowed, block - internet access blocked, time - parental control is enabled with schedule
  • ip
  • ip_type - (Manual, DHCP and other)
  • last_activity - last time the device was seen online in HA
  • mac
  • rssi - (only wireless devices)
  • rx_speed - (only wireless devices)
  • tx_speed - (only wireless devices)

If the connected device's MAC address is known to Home Assistant (e.g. it was set up by another integration ABC), its device_tracker will be added to that device in the enabled state. Moreover, this device will be showing for both integrations: AsusRouter and ABC

Sensors

Boot time sensor

(disabled by default)

  • name: boot_time
  • units:
  • description: The sensor represents the last time the device was rebooted.
Connected devices sensor

(enabled by default)

  • name: connected_devices
  • units:
  • attributes:
    • devices - represents a list of all connected (active) devices as their MAC/IP/Hostname
  • description: The sensor shows the total number of devices connected.
CPU usage sensor

(disabled by default)

  • name: cpu
  • units: %
  • attributes:
    • core_X - usage by corer x
  • description: Sensor shows average CPU usage.
Load average sensors (FW: Merlin-only)

(disabled by default)

  • names: load_average_{}_min for 1, 5 and 15 minutes
  • description: Sensors represent average load in the usual Linux way. Sensors rely on the sysinfo, available only with the Merlin firmware.
Network traffic and speed

(enabled by default)

  • Traffic:
    • names: {}_download / {}_upload
    • units: GB [^units] (default) (important note). Can be selected during/after the integration configuration.
    • attributes:
      • bytes - raw data from the device
  • Speed:
    • names: {}_download_speed / {}_upload_speed
    • units: Mb/s (default). Can be selected during/after the integration configuration.
    • attributes:
      • bits/s - raw data from device

Possible network interfaces (can be changed via the Configure button for the configuration):

  • WAN - traffic to your ISP (Some of the devices do not report WAN data, refer to the issue. If your device also doesn't show such sensors, please add your information to this issue)
  • USB - traffic to the USB modem / mobile phone connected via USB. Will be showing the correct values when USB WAN is connected and unknown when a phone / USB modem is disconnected.
  • LAN - local wired traffic
  • WLANx - wireless traffic: 0 - 2.4 GHz WiFi, 1 and 2 - 5 GHz WiFi
  • and more
Ports connection sensors

(disabled by default)

  • names: lan_speed / wan_speed
  • units: Mb/s
  • attributes:
    • lan_X / wan_X - represents speed of each port x in Mb/s
  • description: Sensor value represents the total speed on all the connected LAN / WAN ports. E.g. if 2 ports are connected in 1 Gb/s mode and 1 - in 100 Mb/s mode, this value will be 2100 Mb/s.
RAM usage sensor

(disabled by default)

  • name: ram
  • units: %
  • attributes (all in KB, as device reports):
    • free
    • total
    • used
  • description: Sensor represents RAM usage of the device. In most cases, it slowly increases with time. On reboot, RAM usage drops.
Temperature sensors

(disabled by default)

Availability of sensors depends on your device and firmware

  • names: temperature_{} for cpu (CPU), 2_4_ghz (2.4 GHz module), 5_ghz (5 GHz module)
  • units: °C (native)
  • description: Sensors represent the temperature value of the corresponding module. Entities are created only for the sensors available for your device and firmware.
WAN IP sensor

(disabled by default)

  • name: wan_ip
  • attributes:
    • dns
    • gateway
    • ip_type - type of the IP (can be static, dhcp and more)
    • mask
    • private_subnet
  • description: Sensor value represents the current external IP address of the device

Keep in mind

  • If your device supports the dual-WAN feature, the corresponding sensors for traffic and speed can be created. They will be showing the correct values when USB WAN is connected and unknown, when a phone / USB modem is disconnected.
  • AsusWRT firmware calculates traffic as an N-digit HEX, so it overflows and resets to zero. On older devices, it can overflow at only 4 294 967 296 bytes (4 GB). The newer devices have limits between 100 and 1000 GB, depending on the interface. One can either use Long-term statistics or create a utility_meter for more control and the possibility to monitor traffic above the limitation.
  • The integration uses 2^10 conversion factors in calculations - the same way as native Asus software. If you would like to use 10^3 factors, all the sensors provide raw data in bytes or bits/s.

Control

All the following entities require Device control to be enabled in the integration settings. Some of the entities may not be available for your device because of their firmware limitation.

Please, keep this in mind. Some lights / switches might require processing time (especially for older devices). In the Home Assistant, this may look like the switch didn't work and clicked back to the initial state. But it will get the correct value on the next state update (mostly not more than several seconds).

Lights

LED

(enabled by default)

  • name: led
  • description: Light entity allows user to control LED state of the device
  • not available for: RT-AC66U

Switches

OpenVPN Client

(enabled by default)

  • name: openvpn_client_x
  • attributes:
    • error_code
    • status - status of the connection (disconnected, connecting, connected)
  • attributes (FW: Merlin-only):
    • auth_read
    • local_ip
    • post_compress_bytes
    • post_decompress_bytes
    • pre_compress_bytes
    • pre_decompress_bytes
    • public_ip
    • server_auth
    • server_ip
    • server_port
    • tcp_udp_read_bytes
    • tcp_udp_write_bytes
    • tun_tap_read_bytes
    • tun_tap_write_bytes
    • update_time
  • description: Switch entity allows turning on / off available OpenVPN client. Please, note, that both connected and connecting status will correspond to the switch being in the On state
WiFi

(enabled by default)

  • name: wireless_{}, where {} can be 2_4_ghz, 5_ghz, 5_ghz_2, 6_ghz
  • attributes:
    • auth_method
    • channel
    • channel_bandwidth
    • chanspec
    • country_code
    • gmode_check
    • group_key_rotation
    • hidden
    • maclist_x
    • macmode
    • mbo_enable
    • mfp
    • mode
    • password
    • radius_ipaddr
    • radius_key
    • radius_port
    • ssid
    • wpa_encryption
    • xbox_optimized
  • description: Switch entity allows turning on / off WiFi network

Tested devices

The integration supports virtually any AsusWRT-powered device with firmware 3.0.0.4.x.

This list provides only the models tested by me or other users. If your device is not listed yet but works well, please open a Device Support ticket with the device model and it will be added to the list.

GroupDevicesFirmwareLimitation
Full support

802.11ax: DSL-AX82U, GT-AX11000, RT-AX55, RT-AX58U, RT-AX68U, RT-AX82U, RT-AX86U, RT-AX86S (reported as RT-AX86U), RT-AX88U, RT-AX89X, RT-AX92U, TUF-AX5400, ZenWiFi AX (XT8), ZenWiFi AX Mini (XD4)
802.11ac: DSL-AC68U, RT-AC86U, RT-ACRH13

Stock: Any
Merlin: Any
Limited support

802.11ac: RT-AC51U, RT-AC66U, RT-ACRH17 (reported as RT-AC82U)
802.11n: RT-N66U

Stock: Latest available
Merlin
: 380.70+
no LED control
Non-Asus devices

Netgear: R6300V2, R7000

Merlin: 380.70+
Not supported

DSL-AC68VG (non-compatible FW)

Support the integration

Issues and Pull requests

If you have found an issue working with the integration or just want to ask for a new feature, please fill in a new issue.

You are also welcome to submit pull requests to the repository!

Other support

This integration is a free-time project. If you like it, you can support me by buying a coffee.

Buy Me A Coffee

Thanks to

The initial codebase for this integration is highly based on Home Assistant core integration AsusWRT and ollo69/ha_asuswrt_custom.