Can I access the Unifi Dream Machine's own speed test results in Home Assistant?

This information is definitely available from the gateway.
image

I’d prefer to use this instead of installing the speedtest integration for a few different reasons.

(1) I’ll get more accurate results on the Unifi DM SE where “accurate” means the closest measurement of the true bandwidth my ISP is actually supplying

(2) I’ll avoid extra load on my HA VM. My HA is running on pretty beefy hardware but it’s unnecessary to tax it more. I also route all my IoT traffic behind a VPN (and HA OS is on that as well) so accuracy won’t be as good.

(3) Finally, the native HA speedtest integration isn’t super accurate. For best results I’ll need to also install the speedtest addon from a custom repository and it’s just more complexity (even if trivial) and load when I can just get the result from the Unifi gatefway ideally.

Thanks.

1 Like

Would like to see that as well but I’m not sure if that info is exposed to the Unifi API’s.

If you at least want something, and you don’t like the inaccuracies of the HA speedtest integration, may I offer you this in-between:

# SpeedTest sensor
command_line:
  sensor:
    name: SpeedTest
    icon: mdi:speedometer
    command: /config/deps/ookla/speedtest --accept-license --accept-gdpr -p no -f json
    command_timeout: 30
    scan_interval: 3600
    json_attributes:
      - timestamp
      - ping
      - download
      - upload
      - packetLoss
      - server
    value_template: "{{ value_json.timestamp }}"
    device_class: timestamp

Put that in your configuration.yaml along with the speedtest binary in the path specified, then set up some helpers for upload/download:

{{ (states.sensor.speedtest.attributes.download.bandwidth | float / 125000) | round(0) }}

Set the units to Mbit/s, etc.

The only real downside is this is coming from the HA system, so if you’ve got only 1gb network, that’s your peak, compared to your DM or XG or whatever where you might have a much faster up/down directly from your ISP.