Skip to content

Instantly share code, notes, and snippets.

@miquelbotanch
Created September 21, 2025 22:09
Show Gist options
  • Save miquelbotanch/2d2ce5ea255dc0f2f63f5ab294cf8f58 to your computer and use it in GitHub Desktop.
Save miquelbotanch/2d2ce5ea255dc0f2f63f5ab294cf8f58 to your computer and use it in GitHub Desktop.

Revisions

  1. miquelbotanch created this gist Sep 21, 2025.
    56 changes: 56 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    # Unifi Dream Router 7 snmp
    #
    # Get Wan Speed IN / OUT
    #
    # Requires SNMP v2 enabled on UDR7
    #
    # Wan Cable on Port 4

    sensor:
    - platform: snmp
    name: "UDR7 Uptime"
    baseoid: 1.3.6.1.2.1.1.3.0
    community: "public"
    version: "2c"
    scan_interval: 10

    - platform: snmp
    name: "UDR7 WAN in"
    host: 192.168.8.128
    baseoid: 1.3.6.1.2.1.2.2.1.10.34
    community: "public"
    version: "2c"
    scan_interval: 10

    - platform: snmp
    name: "UDR7 WAN out"
    host: 192.168.8.128
    baseoid: 1.3.6.1.2.1.2.2.1.16.34
    community: "public"
    version: "2c"
    scan_interval: 10

    - platform: statistics
    name: "UDR7 WAN in Stats"
    entity_id: sensor.udr7_wan_in
    sampling_size: 4
    state_characteristic: change_second
    max_age:
    hours: 24

    - platform: statistics
    name: "UDR7 WAN out Stats"
    entity_id: sensor.udr7_wan_out
    sampling_size: 4
    state_characteristic: change_second
    max_age:
    hours: 24

    template:
    - sensor:
    - name: "Internet Download"
    state: "{{ (states('sensor.udr7_wan_in_stats') |float /100000) | round(2) }}"
    unit_of_measurement: "MBps"
    - name: "Internet Upload"
    state: "{{ (states('sensor.udr7_wan_out_stats') |float /100000) | round(2) }}"
    unit_of_measurement: "MBps"