Monitor unifi Dream Machine (Pro)

Hi there,

I finally setup snmp on Dream Machine Pro, but still have issues with:

  1. convert kbps to MB/s
  2. graphs are so slow not showing actual bandwidth usage.
- platform: unifi_status
    host: xxx.xxx.xxx.xxx
    port: 443
    version: UDMP-unifiOS
    username: USERNAME
    password: PASSWORD
    scan_interval: 1
    monitored_conditions:
      - www
      - wan
      - wlan
      - lan
      - alerts
      - firmware
  - platform: template
    sensors:
      unifi_status_wan_cpu:
        friendly_name: "CPU"
        unit_of_measurement: "%"
        value_template: "{{ states.sensor.unifi_status_wan.attributes['gw_system-stats']['cpu'] }}"
      unifi_status_wan_mem:
        friendly_name: "Memory"
        unit_of_measurement: "%"
        value_template: "{{ states.sensor.unifi_status_wan.attributes['gw_system-stats']['mem'] }}"
      unifi_status_wan_ip:
        friendly_name: 'WAN IP'
        value_template: '{{ states.sensor.unifi_status_wan.attributes.wan_ip }}'
      unifi_status_wan_download:
        friendly_name: 'WAN Download'
        unit_of_measurement: kbps
        icon_template: "mdi:progress-download"
        value_template: "{{ (states.sensor.unifi_status_wan.attributes['rx_bytes-r'] / 1024) | int }}"
      unifi_status_wan_upload:
        friendly_name: "WAN Upload"
        unit_of_measurement: kbps
        icon_template: "mdi:progress-upload"
        value_template: "{{ (states.sensor.unifi_status_wan.attributes['tx_bytes-r'] / 1024) | int }}"
      unifi_status_wan_uptime:
        friendly_name: "UDM Uptime"
        value_template: >
          {%- set time = states.sensor.unifi_status_wan.attributes['gw_system-stats']['uptime'] | int %}
          {%- set minutes = ((time % 3600) // 60) %}
          {%- set minutes = '{}min'.format(minutes) if minutes > 0 else '' %}
          {%- set hours = ((time % 86400) // 3600) %}
          {%- set hours = '{}hr '.format(hours) if hours > 0 else '' %}
          {%- set days = (time // 86400) %}
          {%- set days = '{}d '.format(days) if days > 0 else '' %}
          {{ 'Less than 1 min' if time < 60 else days + hours + minutes }}
      unifi_status_firmware_version:
        friendly_name: "UDM Firmware Version"
        icon_template: "mdi:database-plus"
        value_template: "{{ states.sensor.unifi_status_wan.attributes.gw_version }}"
      unifi_status_www_xput_down:
        friendly_name: "UDM Speedtest Download"
        unit_of_measurement: Mbps
        icon_template: "mdi:progress-download"
        value_template: "{{ states.sensor.unifi_status_www.attributes.xput_down }}"
      unifi_status_www_xput_up:
        friendly_name: "UDM Speedtest Upload"
        unit_of_measurement: Mbps
        icon_template: "mdi:progress-upload"
        value_template: "{{ states.sensor.unifi_status_www.attributes.xput_up }}"
      unifi_status_www_speedtest_ping:
        friendly_name: "UDM Speedtest Ping"
        unit_of_measurement: ms
        icon_template: "mdi:progress-clock"
        value_template: "{{ states.sensor.unifi_status_www.attributes.speedtest_ping }}"
      unifi_status_www_uptime:
        friendly_name: 'Internet Uptime'
        value_template: >
          {%- set time = states.sensor.unifi_status_www.attributes.uptime | int %}
          {%- set minutes = ((time % 3600) // 60) %}
          {%- set minutes = '{}min'.format(minutes) if minutes > 0 else '' %}
          {%- set hours = ((time % 86400) // 3600) %}
          {%- set hours = '{}hr '.format(hours) if hours > 0 else '' %}
          {%- set days = (time // 86400) %}
          {%- set days = '{}d '.format(days) if days > 0 else '' %}
          {{ 'Less than 1 min' if time < 60 else days + hours + minutes }}
      unifi_status_wlan_num_user:
        friendly_name: 'Users Wifi'
        icon_template: "mdi:account-multiple"
        value_template: '{{ states.sensor.unifi_status_wlan.attributes.num_user }}'
      unifi_status_lan_num_user:
        friendly_name: 'Users Lan'
        icon_template: "mdi:account-multiple"
        value_template: '{{ states.sensor.unifi_status_lan.attributes.num_user }}'

Any ideas?
I want to use HA like monitoring for my network.

Thank you.

1 Like

I’ve given up on SNMP monitoring, I’m using UnifiPoller. That fetches data to InfluxDB, and gives tons of data, and from that I show the usage graphs on a graph I’ve made with Grafana

1 Like

Does this allow you to create Lovelace Dashboard UI cards for showing current bandwidth usage?

I can’t be the only one who simply wants to see how much internet bandwidth is being used by my UDM Pro – and this really shouldn’t be that hard.

2 Likes

Just wondering if anyone is still using this old Unifi Status integration

I’m thinking about uplifting this integration to follow HA 2024 development best practises by migrating the configuration part from yaml to UI and automatically create sensors to provide insights into the UDM.

If any interest is shown, I will in my spare time start to update this integration. :slight_smile:

7 Likes

I gave up on it, as it wasn’t working properly, giving me the data I wanted (upload / download) on my UDM Pro.
If you update it, I will certainly use it again.

1 Like