[Custom component] AsusRouter integration

0.12.0

:mag: Per-device internet control is coming to AsusRouter (using the parental control feature of routers)!

Including a binary_sensor / switch for the global parental control (on / off) with a full list of rules via the list attribute.

Plus new service asusrouter.device_internet_access to create a block rule, disable or remove it.

Here is a small example of how to use it:

Button for a device internet control

Change {connected_device}, {device} and the mac value for the ones you need.

switch:
  - platform: template
    switches:
      internet_{connected_device}:
        friendly_name: Internet/{Connected Device}
        unique_id: internet_{connected_device}
        value_template: >
          {% set ns = namespace(
            mac = "01:23:45:67:89:ab"|upper,
            list = state_attr("switch.{device}_parental_control", "list"),
            internet = true
          ) %}
          {# Find whether #}
          {% for element in ns.list %}
            {% if element.mac == ns.mac and element.state == "block" %}
              {% set ns.internet = false %}
            {% endif %}
          {% endfor %}
          {{ ns.internet }}
        turn_on:
          service: asusrouter.device_internet_access
          data:
            entity_id: device_tracker.{connected_device}
            state: disable
        turn_off:
          service: asusrouter.device_internet_access
          data:
            entity_id: device_tracker.{connected_device}
            state: block

Alternative - you can set the service state to remove instead of disable - this way rule will be removed from the list, not just disabled. Might be useful in case you are on the limit of the number of rules (32 / 64 depending on the router model).

:books: Other changes

  • Device-related events are getting connection_type and guest attributes.
  • The same attributes are added to the device list of connected_devices sensor.
  • The new documentation is added to the integration.
  • We are finally changing the last place not to use the correct AsusRouter naming - in the integrations list (it was still ASUS Router there).
  • Deprecated asusrouter.service_reboot is now removed.

:loudspeaker: The new version is available in HACS in 3โ€ฆ 2โ€ฆ 1โ€ฆ Now

Release 0.12.0 :mag: Per-device internet control / parental control and new documentation :books: ยท Vaskivskyi/ha-asusrouter (github.com)


:beer: Want to support the development? Help me with getting an additional device for all the needed tests or Buy Me a Coffee

3 Likes