### Install AsusRouter using pip Source: https://asusrouter.vaskivskyi.com/library Install the latest release of the AsusRouter library from PyPI. Ensure Python 3.11 or higher is installed. ```bash pip install asusrouter ``` -------------------------------- ### Configure Operation Mode Source: https://asusrouter.vaskivskyi.com/guide/configuration/operation-mode.html Details the configuration options available during initial setup or via the Configure option for the AsusRouter integration. ```APIDOC ## Configuration Options ### Description Defines the operational behavior of the AsusRouter integration, including device tracking and sensor update settings. ### Parameters #### Options - **Enable device trackers** (boolean) - Default: true - Whether device_tracker entities are enabled for all connected devices. - **Enable per-sensor update intervals** (boolean) - Default: false - Allow different update intervals for different API endpoints. - **Number of latest connected devices** (integer) - Default: 5 - Number of the latest connected devices to be saved to the sensor.{device}_latest_connected. ``` -------------------------------- ### Set router state with arguments Source: https://asusrouter.vaskivskyi.com/library Configure router states that require additional parameters using the `arguments` dictionary in `async_set_state`. This example enables a Guest WLAN. ```python result = await router.async_set_state( AsusWLAN.ON, arguments={ "api_type": "gwlan", # Guest WLAN "api_id": "0.2", # Guest WLAN #2 on 2.4 GHz }, ) print(result) ``` -------------------------------- ### Remove device trackers service example Source: https://asusrouter.vaskivskyi.com/features/connected-devices.html Example configuration for the asusrouter.remove_trackers service, specifying a list of entity IDs to remove. ```yaml entities: - device_tracker.device_1 - device_tracker.device_2 - device_tracker.device_3 ``` -------------------------------- ### Set router state using async_set_state Source: https://asusrouter.vaskivskyi.com/library Use the `async_set_state` method to change router settings. This example shows setting a port forwarding state. The method returns True on success and False otherwise. ```python from asusrouter.modules.port_forwarding import AsusPortForwarding result = await router.async_set_state(AsusPortForwarding.ON) print(result) ``` -------------------------------- ### ARConfigBase Configuration Management Source: https://asusrouter.vaskivskyi.com/library/config.html Methods for interacting with the thread-safe configuration manager to set, get, and manage configuration keys. ```APIDOC ## ARConfigBase Methods ### Description Provides an interface for managing configuration options within the AsusRouter library. ### Methods - **set(key, value)**: Set a configuration option. - **get(key)**: Get a configuration option. - **keys()**: List all configuration keys. - **list()**: List all configuration options. - **reset()**: Reset all options to defaults. - **register_type(key, converter)**: Register a custom type converter. ### Properties - **types**: Property exposing the type converters. ### Usage - **__contains__(key)**: Supports `key in config` syntax. ``` -------------------------------- ### Trigger on AsusRouter Event Source: https://asusrouter.vaskivskyi.com/guide/how-to/automations.html Use the standard HA event platform to trigger automations on any AsusRouter event. This example shows triggering on `asusrouter_device_connected`. ```yaml trigger: - platform: event event_type: asusrouter_device_connected ``` -------------------------------- ### Initialize Firmware Object Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Define the structure of the Firmware class arguments and demonstrate recommended initialization methods. ```python # Default argument version: Optional[str] = None # Optional arguments when version is explicitly set to None major: Optional[str] = None minor: Optional[int] = None build: Optional[int] = None revision: Optional[int | str] = None ``` ```python # Initialize a Firmware object by explicitly providing version my_firmware = Firmware(version="3.0.0.4.386_40451") # Acceptable initialization my_firmware = Firmware("3004.386.5_2") ``` ```python # Alternative initialization # In this case, all the arguments should be provided # in the correct format my_firmware = Firmware(major="3.0.0.4", minor=388, build=57123) ``` -------------------------------- ### Create an AsusRouter object Source: https://asusrouter.vaskivskyi.com/library Instantiate the AsusRouter class to represent a router. Provide hostname, username, and password. SSL can be enabled by setting `use_ssl` to True. ```python from asusrouter import AsusRouter router = AsusRouter( hostname="192.168.1.1", # Required - IP address or hostname of the router username="admin", # Required password="admin", # Required port=None, # Optional - default port would be selected based on use_ssl parameter use_ssl=False, # Optional - use HTTPS instead of HTTP ) ``` -------------------------------- ### GET {device}_ram Sensor Source: https://asusrouter.vaskivskyi.com/features/ram.html Retrieves the RAM utilization sensor data for a specific Asus router device. ```APIDOC ## GET {device}_ram ### Description Returns the current RAM utilization percentage and memory statistics for the specified Asus router device. ### Endpoint {device}_ram ### Parameters #### Path Parameters - **device** (string) - Required - The identifier of the router device. ### Response #### Success Response (200) - **state** (float) - The actual RAM utilization percentage (%). #### Attributes - **free** (integer) - The actual amount of free RAM in KB. - **total** (integer) - The total amount of RAM in KB. - **used** (integer) - The actual amount of used RAM in KB. #### Response Example { "state": 45.5, "attributes": { "free": 128000, "total": 256000, "used": 128000 } } ``` -------------------------------- ### ColorRGBB Class Methods Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Methods for initializing, setting brightness, and converting ColorRGBB objects. ```APIDOC ## ColorRGBB.from_rgbwb() ### Description Loads the RGB color with brightness embedded in the color. The brightness is separated from the RGB color and the color is rescaled to the `scale` value. Uses `ColorRGB._from_rgb()` method. ### Method N/A (Class Method) ### Endpoint N/A ### Parameters #### Arguments - **rgb** (tuple[int, ...] | str | ColorRGB) - Description: The RGB color input. - **delimiter** (str) - Optional - Default: "," - Description: The delimiter used in the color string. - **scale** (Optional[int]) - Optional - Description: The scale to which the color should be rescaled. ### Response #### Updates properties - `r`, `g`, `b`, `brightness`, `scale` ### Returns `None` ``` ```APIDOC ## ColorRGBB.set_brightness() ### Description Sets the brightness of the color. The brightness is set to the `br` value if it is in the range `[0:scale]`. If the value is out of range, the brightness is set to the closest value in the range. ### Method N/A (Instance Method) ### Endpoint N/A ### Parameters #### Arguments - **br** (int) - Description: The brightness value to set. ### Response #### Updates properties - `brightness` ### Returns `None` ``` ```APIDOC ## ColorRGBB.to_rgb() ### Description Returns the RGB color as a `ColorRGB` object with brightness embedded in the RGB values. The color is rescaled to the `scale` value if provided. Uses `ColorRGB._to_rgb()` method. ### Method N/A (Instance Method) ### Endpoint N/A ### Parameters #### Arguments - **scale** (Optional[int]) - Optional - Description: The scale to which the color should be rescaled. ### Returns `ColorRGB` ``` ```APIDOC ## ColorRGBB._from_rgb() ### Description Normalizes the input RGB value into a tuple of integers. The method uses `ColorRGB._normalize_input_rgb()` and `ColorRGB._normalize_scale()` methods. ### Method N/A (Private Instance Method) ### Endpoint N/A ### Parameters #### Arguments - **rgb** (tuple[int, ...] | str) - Description: The RGB input. - **delimiter** (str) - Optional - Default: "," - Description: The delimiter used in the color string. - **scale** (Optional[int]) - Optional - Description: The scale to which the color should be rescaled. ### Returns `tuple[int, int, int]` ``` ```APIDOC ## ColorRGBB._to_rgb() ### Description Normalizes the RGBB value into a tuple of integers. If RGBB value is not provided, the method uses the object's properties. ### Method N/A (Private Instance Method) ### Endpoint N/A ### Parameters #### Arguments - **rgbb** (Optional[tuple[int, ...]]) - Optional - Description: The RGBB value to normalize. ### Returns `tuple[int, int, int]` ``` ```APIDOC ## ColorRGBB.__repr__() ### Description Mimics the `__str__()` method. ### Method N/A (Special Method) ### Endpoint N/A ### Parameters #### Arguments - None ### Returns `str` ``` ```APIDOC ## ColorRGBB.__str__() ### Description Returns the RGBB color as a string in the format `r,g,b,brightness,scale`. ### Method N/A (Special Method) ### Endpoint N/A ### Parameters #### Arguments - None ### Returns `str` ``` -------------------------------- ### Get Aura Scheme from State Source: https://asusrouter.vaskivskyi.com/library/modules/aura.html Determines the current Aura scheme from device state data. Falls back to DEFAULT_AURA_SCHEME if the scheme is not explicitly found. ```python scheme = get_scheme_from_state({ "scheme": AsusAura.STATIC, }) # Output: AsusAura.STATIC scheme = get_scheme_from_state({ "scheme_prev": AsusAura.RAINBOW, }) # Output: AsusAura.RAINBOW scheme = get_scheme_from_state({ "scheme": 1, "scheme_prev": 2, }) # Output: AsusAura.GRADIENT ``` -------------------------------- ### Firmware.from_string() Method Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Parses a firmware version string into its components (major, minor, build, revision) and updates the object's properties. It also detects ROG builds. ```APIDOC ## Firmware.from_string() ### Description This method is used to parse the firmware version string into major, minor, build and revision parts. In addition, check for the ROG build key is done automatically. ### Method Signature `from_string(fw_string: Optional[str] = None)` ### Arguments - `fw_string` (Optional[str]): The firmware version string to parse. ### Returns `None` ### Updates Properties - `major` - `minor` - `build` - `revision` - `beta` - `rog` ### Example Usage ```python my_firmware = Firmware() my_firmware.from_string("3004.386.5_2") ``` ``` -------------------------------- ### Firmware Comparison (__eq__ and __ne__) Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Compares two Firmware objects for equality based on major, minor, build, and revision properties. ```APIDOC ## Firmware Comparison ### `Firmware.__eq__()` **Arguments:** - `other` (object): The object to compare with. **Returns:** `bool` **Description:** This method compares two `Firmware` objects and returns `True` if they are equal. The comparison is done based on the `major`, `minor`, `build` and `revision` properties only. The `beta`, `rog` and `source` properties are not taken into account. When comparing with other objects, the method always returns `False`. **Example:** ```python my_firmware == other_firmware ``` ### `Firmware.__ne__()` **Description:** This method implicitly allows usage of the not-equal comparison. **Example:** ```python my_firmware != other_firmware ``` ``` -------------------------------- ### Get Default Aura Colors Source: https://asusrouter.vaskivskyi.com/library/modules/aura.html Retrieves a tuple of default Aura colors, extended to match the specified number of zones. Uses the ColorRGBB class for color representation. ```python colors = get_default_aura_color(3) # Output: (ColorRGBB((20, 0, 128)), ColorRGBB((110, 0, 100)), ColorRGBB((128, 0, 80))) colors = get_default_aura_color(2) # Output: (ColorRGBB((20, 0, 128)), ColorRGBB((110, 0, 100))) colors = get_default_aura_color(5) # Output: (ColorRGBB((20, 0, 128)), ColorRGBB((110, 0, 100)), ColorRGBB((128, 0, 80)), # ColorRGBB((110, 0, 100)), ColorRGBB((20, 0, 128)) ``` -------------------------------- ### Compare Firmware Less Than Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Use this method to check if one firmware version is less than another. The comparison is based on major, minor, build, and revision properties, ignoring beta, rog, and source properties. It returns False if comparing different firmware sources. ```python my_firmware < other_firmware ``` -------------------------------- ### process() - Process Temperature Data Source: https://asusrouter.vaskivskyi.com/library/modules/endpoint/temperature.html Converts temperature data into an AsusData-compliant format. ```APIDOC ## `process(data)` ### Description Convert temperature data in an `AsusData`-compliant format. ### Method `process` ### Parameters #### Arguments * `data` (dict[str, float | None]) - The temperature data to process. ### Returns * `AsusData` - The processed data in AsusData format. ``` -------------------------------- ### Parse Firmware String Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Use the from_string method to parse a firmware version string into its constituent parts using regular expressions. ```python fw_string: Optional[str] = None ``` ```python ( r"^(?P[39].?0.?0.?[46])?[_.]?" r"(?P[0-9]{3})[_.]?" r"(?P[0-9]+)[_.-]?" r"(?P[a-zA-Z0-9-_]+?)(?=_rog|$)?" r"(?P_rog)?$" ) ``` ```python my_firmware = Firmware() my_firmware.from_string("3004.386.5_2") ``` -------------------------------- ### Firmware String Representation Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html This method provides a string representation of the firmware, formatted as 'major.minor.build_revision' or 'major.minor.build_revision_rog' for ROG builds. ```python str(my_firmware) ``` -------------------------------- ### Compare Firmware Objects Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Compare two Firmware objects for equality or inequality based on their version components. ```python my_firmware == other_firmware # or opposite my_firmware != other_firmware ``` -------------------------------- ### LED Control Entity Source: https://asusrouter.vaskivskyi.com/features/led.html Documentation for the {device}_led entity used to control the status LED on supported AsusRouter devices. ```APIDOC ## LED Control Entity ### Description The status LED control entity allows users to toggle the device LED on or off. ### Supported Firmware - Stock: >= 3.0.0.4.386.x - Merlin: >= 3.0.0.4.386.x ### Supported Device Modes - Router - AiMesh Node - Access point - Media bridge ### Entity Details - **Entity ID**: {device}_led - **Minimum Version**: AsusRouter >= 0.3.0 - **Default State**: Enabled - **Supported Features**: On, Off ``` -------------------------------- ### Firmware Class Methods Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Methods for comparing and representing Firmware objects. ```APIDOC ## Firmware.__gt__(other) ### Description Compares two Firmware objects and returns True if the first object is greater than the second. ### Parameters #### Arguments - **other** (object) - The firmware object to compare against. ### Response - **Returns** (bool) - True if greater than, False otherwise. ``` ```APIDOC ## Firmware.__lt__(other) ### Description Compares two Firmware objects and returns True if the first object is less than the second based on major, minor, build, and revision properties. ### Parameters #### Arguments - **other** (object) - The firmware object to compare against. ### Response - **Returns** (bool) - True if less than, False otherwise. ``` ```APIDOC ## Firmware.__str__() ### Description Returns the firmware version as a string. ### Response - **Returns** (str) - Format: major.minor.build_revision or major.minor.build_revision_rog. ``` -------------------------------- ### Set Aura State via Callback (Deprecated) Source: https://asusrouter.vaskivskyi.com/library/modules/aura.html Sets the Aura state using a provided callback. Direct usage is not recommended; use `AsusRouter.async_set_state()` instead. Requires an `identity` parameter for communication. ```python # Initialize the router object router = AsusRouter(...) # Set the Aura state using the general (safe) method router.async_set_state(AsusAura.MARQUEE, color=ColorRGB((128, 0, 0)), brightness=64, zone=1) ``` -------------------------------- ### Switch: {device}_guest_{type}_{x} Source: https://asusrouter.vaskivskyi.com/features/guest-wlan.html Represents the current state and attributes of a specific guest wireless network. ```APIDOC ## {device}_guest_{type}_{x} ### Description The current state of the guest wireless network {type}, where {type} is [2_4_ghz, 5_ghz, 5_ghz_2, 6_ghz] number {x}. ### Attributes - **aimesh_sync** (boolean) - Whether guest network is broadcasted from each AiMesh node. - **auth_method** (string) - Authentication method. - **bw_limit** (boolean) - Whether bandwidth limit is enabled. - **bw_limit_download** (integer) - Download bandwidth limit in kbit/s. - **bw_limit_upload** (integer) - Upload bandwidth limit in kbit/s. - **expire** (integer) - Enable guest network for a limited amount of time in seconds. - **expire_in** (integer) - When the network will be disabled in seconds. - **hidden** (boolean) - Whether SSID is hidden. - **lan_access** (boolean) - Whether LAN access is enabled. - **maclist** (string) - MAC address list. - **macmode** (string) - State of the MAC filter (allow, deny, disabled). - **password** (string) - Guest network password (if hide passwords is false). - **ssid** (string) - Guest network SSID. - **wpa_encryption** (string) - WPA encryption type. ``` -------------------------------- ### Call a system service using AsusSystem Source: https://asusrouter.vaskivskyi.com/library Use the async_set_state method with an AsusSystem enum member to trigger a system service. The method returns a boolean indicating success or failure. ```python from asusrouter.modules.system import AsusSystem result await router.async_set_state(AsusSystem.RESTART_HTTPD) print(result) ``` -------------------------------- ### set_state() Source: https://asusrouter.vaskivskyi.com/library/modules/aura.html Sets the Aura state on the device. Direct usage is discouraged in favor of AsusRouter.async_set_state(). ```APIDOC ## set_state() ### Description Sets the Aura state using a callback function. Requires an identity parameter representing an Aura-capable AsusDevice. ### Parameters - **callback** (Callable) - Required - Function for device communication. - **state** (AsusAura) - Required - The Aura state to set. - **identity** (AsusDevice) - Required (in kwargs) - The target device. - **router_state** (dict) - Optional (in kwargs) - Router state data. - **color** (ColorRGB | list[ColorRGB]) - Optional (in kwargs) - Color settings. - **brightness** (int) - Optional (in kwargs) - Brightness level. - **zone** (int) - Optional (in kwargs) - Target zone. ### Response - **Returns** (bool) - True if successfully set and confirmed, False otherwise. ``` -------------------------------- ### Configuration Utility Functions Source: https://asusrouter.vaskivskyi.com/library/config.html Helper functions for safe type conversion of configuration values. ```APIDOC ## Utility Functions ### safe_bool_config(value) Converts a value to boolean, using a safe default. ### safe_int_config(value) Converts a value to integer, using a safe default. ``` -------------------------------- ### Initialize ColorRGBB Object Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Initialize a ColorRGBB object by providing RGB values and an optional brightness value. This class separates brightness from the RGB color. ```python # Initialize a ColorRGBB object by explicitly providing RGB and brightness values my_color = ColorRGBB(rgb=(64, 32, 128), br=64) # or my_color = ColorRGBB((64, 32, 128), 64) ``` -------------------------------- ### Define Port Types Source: https://asusrouter.vaskivskyi.com/features/ports.html Lists the supported port types and firmware-specific constraints for the binary sensor. ```text - LAN, USB, WAN ports. - sensors are firmware-dependant. - USB is available only for FW versions `388.x` ``` -------------------------------- ### Service: adjust_wlan Source: https://asusrouter.vaskivskyi.com/features/guest-wlan.html Allows changing guest WLAN settings including bandwidth limits, SSID, and access control. ```APIDOC ## adjust_wlan ### Description Allows changing guest WLAN settings. ### Parameters #### Request Body - **entity_id** (string) - Required - entity_id of the guest WLAN. - **bw_enabled** (boolean) - Optional - Whether bandwidth limit is enabled. - **bw_dl** (integer) - Optional - Download bandwidth limit in kbit/s. 0 - unlimited. - **bw_ul** (integer) - Optional - Upload bandwidth limit in kbit/s. 0 - unlimited. - **closed** (boolean) - Optional - Whether SSID should be hidden. - **expire** (integer) - Optional - Enable guest network for a limited amount of time in seconds. 0 indicates feature being off. - **lan_access** (boolean) - Optional - Whether LAN access is enabled. - **password** (string) - Optional - Guest network password. - **ssid** (string) - Optional - Guest network SSID. - **state** (boolean) - Optional - Whether WLAN should be on. - **sync_node** (boolean) - Optional - Whether guest network is broadcasted from each AiMesh node. ``` -------------------------------- ### Initialize ColorRGB Object Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Initialize a ColorRGB object by explicitly providing RGB values, with optional arguments for green and blue. Missing values default to the 'r' value. Can also initialize with a tuple. ```python my_color = ColorRGB(r=64, g=32, b=128) # or my_color = ColorRGB(64, 32, 128) # Initialize with less color values # In the case of missing values, they will be set to `r` value my_color = ColorRGB(r=64, g=32) # Initialize with a tuple my_color = ColorRGB(r=(64, 32, 128)) ``` -------------------------------- ### Configure Integration Events Source: https://asusrouter.vaskivskyi.com/guide/configuration/events.html Defines the boolean options available for monitoring device and node connection states. ```APIDOC ## Configuration Options ### Description This endpoint or configuration interface allows users to toggle specific event notifications for device and node connectivity states. ### Parameters #### Options - **Device connected** (boolean) - Default: true - Triggers when a device connects. - **Device disconnected** (boolean) - Default: false - Triggers when a device disconnects. - **Device reconnected** (boolean) - Default: false - Triggers when a device reconnects. - **Node connected** (boolean) - Default: true - Triggers when a node connects. - **Node disconnected** (boolean) - Default: true - Triggers when a node disconnects. - **Node reconnected** (boolean) - Default: true - Triggers when a node reconnects. ``` -------------------------------- ### Firmware Class Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html The Firmware class allows processing, comparing, and operating with firmware information of a device. It can be initialized with a version string or individual components. ```APIDOC ## Firmware Class ### Description This class allows processing, comparing and operating with firmware information of a device. ### Initialization **Recommended usage:** ```python # Initialize a Firmware object by explicitly providing version my_firmware = Firmware(version="3.0.0.4.386_40451") # Acceptable initialization my_firmware = Firmware("3004.386.5_2") ``` **Alternative initialization (all arguments should be provided):** ```python my_firmware = Firmware(major="3.0.0.4", minor=388, build=57123) ``` **Arguments:** - `version` (Optional[str]): The full firmware version string. - `major` (Optional[str]): Major version part (e.g., "3.0.0.4"). - `minor` (Optional[int]): Minor version part (e.g., 386). - `build` (Optional[int]): Build version part (e.g., 40451). - `revision` (Optional[int | str]): Revision part (e.g., "2beta1"). **Properties:** - `major` (str): Major version. - `minor` (int): Minor version. - `build` (int): Build version. - `revision` (int/str): Revision. - `beta` (bool): True if the firmware is a beta version. - `rog` (bool): True if the firmware is an ROG build. - `source` (str): The source of the firmware (e.g., GNUTON, MERLIN, STOCK). ``` -------------------------------- ### Compare Firmware Greater Than Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Use this method to check if one firmware version is greater than another. It relies on __lt__() and __eq__() for comparison logic. ```python my_firmware > other_firmware ``` -------------------------------- ### Class ColorRGBB Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Inherits from ColorRGB, adding explicit brightness control. ```APIDOC ## Class ColorRGBB ### Description Extends ColorRGB to allow separating brightness from the RGB color. ### Arguments - **rgb** (tuple[int, int, int] | ColorRGB) - Optional - RGB values. Default: (0, 0, 0) - **br** (int) - Optional - Brightness value - **scale** (int) - Optional - Scale value. Default: 128 ### Properties - **r** (int) - Red color - **g** (int) - Green color - **b** (int) - Blue color - **color_brightness** (int) - Brightness of the color - **brightness** (int) - Explicit brightness - **scale** (int) - Scale value ### Methods - **from_rgb(rgb, delimiter, scale)**: Loads RGB color, ignoring existing brightness and rescaling to the object's scale. ``` -------------------------------- ### ColorRGBB Method Arguments Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Argument definitions for ColorRGBB class methods. ```python rgb: tuple[int, ...] | str | ColorRGB delimiter: str = "," scale: Optional[int] = None ``` ```python br: int ``` ```python scale: Optional[int] = None ``` ```python rgb: tuple[int, ...] | str delimiter: str = "," scale: Optional[int] = None ``` ```python rgbb: Optional[tuple[int, ...]] = None ``` -------------------------------- ### Notify on New Device Connection Source: https://asusrouter.vaskivskyi.com/guide/how-to/automations.html Create a Home Assistant persistent notification when a new device connects to the local network, triggered by the `asusrouter_device_connected` event. Similar automations can be set up for `asusrouter_device_disconnected` and `asusrouter_device_reconnected` events. ```yaml alias: AsusRouter/New device connected description: Create a HA notification for any new device connected to the local network trigger: # Trigger automation on the AsusRouter event - platform: event event_type: asusrouter_device_connected # No conditions are needed in this example condition: [] action: # Create HA persistant notification - service: persistent_notification.create data_template: # Title of the notification title: Device has joined the local network # Body of the notification (allows templating) message: >- MAC: {{trigger.event.data.mac}}, IP: {{trigger.event.data.ip}}, name: {{trigger.event.data.name}} mode: queued max: 100 ``` -------------------------------- ### ColorRGBB Class Methods Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Methods for loading and processing RGB color values for the ColorRGBB class. `from_rgb` loads the RGB color, ignoring brightness and rescaling to the object's scale. ```python # Example usage of from_rgb for ColorRGBB # Assuming my_color_b is an instance of ColorRGBB my_color_b.from_rgb((255, 128, 0)) my_color_b.from_rgb("100,50,25", delimiter=",") my_color_b.from_rgb(ColorRGB(r=64, g=32, b=128), scale=255) ``` -------------------------------- ### WAN Binary Sensor Source: https://asusrouter.vaskivskyi.com/features/wan.html Provides the status of the WAN connection. Requires AsusRouter integration version 0.3.0 or higher. ```APIDOC ## Binary sensor `{device}_wan` ### Description The status of WAN connection. ### Default Entity State `Enabled` ### Attributes - **dns** (string) - DNS servers IP addresses as a single string, separated with ` ` (space). - **gateway** (string) - Gateway IP address. - **ip** (string) - WAN IP address. - **ip_type** (string) - Method of obtaining IP address. - **mask** (string) - WAN mask. - **private_subnet** (integer) - An integer value whether WAN is connected to private subnet (`1`) or not (`0`). - **xdns** (string) - Secondary DNS servers IP addresses as a single string, separated with ` ` (space). Requires AsusRouter >= 0.18.0. - **xgateway** (string) - Secondary gateway IP address. Requires AsusRouter >= 0.18.0. - **xip** (string) - Secondary WAN IP address. Requires AsusRouter >= 0.18.0. - **xip_type** (string) - Secondary method of obtaining IP address. Requires AsusRouter >= 0.18.0. - **xmask** (string) - Secondary WAN mask. Requires AsusRouter >= 0.18.0. ``` -------------------------------- ### AiMesh Device Information Source: https://asusrouter.vaskivskyi.com/features/aimesh.html For each AiMesh node, a Home Assistant device is created, providing basic device information such as Model, Manufacturer, Firmware version, and connection details. ```APIDOC ## AiMesh Device ### Description For each AiMesh node, a Home Assistant device is created, providing the basic device info: Model, Manufacturer, Firmware version, and Connected via (a link to the main `router` device through which `node` is connected). ### Device Name The device name is set via the `model` value. ``` -------------------------------- ### Enumerations Source: https://asusrouter.vaskivskyi.com/library/modules/firmware.html Definitions for firmware types and web update status codes. ```APIDOC ## FirmwareType ### Description Enum representing the type of firmware. ### Values - **STOCK** (0) - Stock firmware - **MERLIN** (1) - Merlin custom firmware - **GNUTON** (2) - Gnuton custom firmware - **UNKNOWN** (-999) - Unknown firmware type ``` ```APIDOC ## WebsError ### Description Enum representing errors during firmware operations. ### Values - **NONE** (0) - No error - **DOWNLOAD_ERROR** (1) - Error during download - **SPACE_ERROR** (2) - Not enough space - **FW_ERROR** (3) - Firmware incompatible or corrupted - **UNKNOWN** (-999) - Unknown error ``` ```APIDOC ## WebsFlag ### Description Enum representing update flags. ### Values - **DONT** (0) - Do not perform update - **AVAILABLE** (1) - Update is available - **FORCE** (2) - Force upgrade - **UNKNOWN** (-999) - Unknown flag ``` ```APIDOC ## WebsUpdate ### Description Enum representing the update check status. ### Values - **ACTIVE** (0) - Checking for update - **INACTIVE** (1) - Inactive - **UNKNOWN** (-999) - Unknown ``` ```APIDOC ## WebsUpgrade ### Description Enum representing the upgrade process status. ### Values - **INACTIVE** (-1) - Inactive - **DOWNLOADING** (0) - Downloading new firmware - **FINISHED** (1) - Firmware download finished - **ACTIVE** (2) - Firmware upgrade active - **UNKNOWN** (-999) - Unknown ``` -------------------------------- ### Retrieve router data using AsusData enum Source: https://asusrouter.vaskivskyi.com/library Fetch specific router data using the `async_get_data` method and the `AsusData` enum. The `force` parameter can be used to bypass cache. ```python from asusrouter import AsusData ram_info = await router.async_get_data(AsusData.RAM, force=False) # `force` parameter is optional and defaults to False # If set to True, the library will fetch the data from the router # regardless of the cache state print(ram_info) ``` -------------------------------- ### ColorRGB Class Methods Source: https://asusrouter.vaskivskyi.com/library/modules/color.html Methods for processing and normalizing RGB color values. `from_rgb` processes input into separate channels, `from_rgbs` allows loading colors with custom scales, and normalization methods handle input validation and scaling. ```python # Initialize a ColorRGB object by explicitly providing RGB values my_color = ColorRGB(r=64, g=32, b=128) # or my_color = ColorRGB(64, 32, 128) # Initialize with less color values # In the case of missing values, they will be set to `r` value my_color = ColorRGB(r=64, g=32) # Initialize with a tuple my_color = ColorRGB(r=(64, 32, 128)) ``` ```python my_color.as_tuple() ``` ```python # Example usage of from_rgb (assuming my_color is an instance of ColorRGB) my_color.from_rgb("255,128,0") my_color.from_rgb("100,50,25", delimiter=",") ``` ```python # Example usage of from_rgbs my_color.from_rgbs((100, 200, 50), scale=255) my_color.from_rgbs("50,100,150", scale=100) ``` ```python # Example usage of _normalize_input_rgb (internal method, typically not called directly) # Assuming rgb_input is a tuple or string normalized_rgb = ColorRGB._normalize_input_rgb(rgb_input, delimiter=",") ``` ```python # Example usage of _normalize_scale (internal method, typically not called directly) # Assuming values_tuple is a tuple of integers and scale_value is an integer normalized_values = ColorRGB._normalize_scale(values_tuple, scale_value) ``` -------------------------------- ### WireGuard Server Configuration Source: https://asusrouter.vaskivskyi.com/features/wireguard.html Information regarding the configuration and state of the WireGuard server. ```APIDOC ## WireGuard Server ### Description This switch describes the current state of the WireGuard server `{x}`. Currently, all the devices have support for 1 server. ### Attributes ... to be added ... ``` -------------------------------- ### WireGuard Client Configuration Source: https://asusrouter.vaskivskyi.com/features/wireguard.html Information regarding the configuration and state of WireGuard clients. ```APIDOC ## WireGuard Client ### Description This switch describes the current state of the WireGuard client `{x}`. Currently, all the devices have support for up to 5 clients. ### Attributes ... to be added ... ```