Add the official speedtest cli

Glad you got it working, I updated my post with more details on how to download and extract the binary, and to pick the right platform.

Thank for your solution, it’s working great for me. I do have questions:
How to get the value for the server id and the last time of execution.
I’m also trying to get speedtest on demand working using a call-service link to this

shell_command:
   launch_speedtest_cli: /config/shell_commands/speedtest --format=json --accept-license --accept-gdpr

it seem to call the service but doesn’t update the sensors

  json_attributes:
    - 'download'
    - 'upload'
    - 'server_name'
    - 'isp'

- sensor:
  - name: Speedtest Download
    state: '{{ state_attr("sensor.speedtest_ping", "download") | round(2) }}'
    unit_of_measurement: Mbit/s
  - name: Speedtest Upload
    state: '{{ state_attr("sensor.speedtest_ping", "upload") | round(2) }}'
    unit_of_measurement: Mbit/s

In sensor, how to get a sensor for

    - 'server_name'
    - 'isp'

Thank you

Here it is:

  - name: Speedtest ISP
    state: '{{ state_attr("sensor.speedtest_ping", "isp") }}'
  - name: Speedtest Server Name
    state: '{{ state_attr("sensor.speedtest_ping", "server_name") }}'

Thank you,
That work perfectly but both return values were the same so I had to change a line in:
Speed Test Results - (from returned JSON string)
FROM: server_name = st_results[“server”][“name”]
TOL server_name = st_results[“server”][“location”]

ISP is your internet provider and server name is the one you are using to test the speed. Some providers also host speedtest servers so might be the same in your case.

In case anyone is interested I’ve created a wrapper to run official speedtest.net cli and post results to HA via MQTT with auto discovery. No configuration on HA side needed.
https://hub.docker.com/rep…/docker/adorobis/speedtest2mqtt
and here the repo:
https://github.com/adorobis/speedtest-CLI2mqtt
Feel free to comment and contribute :slight_smile:

2 Likes

Thanks for sharing it helped a lot

This looks promising. I need to run it on a different box that has a faster nic then my HA setup, how can I send the results to mqtt on my HA box?

n/m figured it out. Thanks, this is awesome!

1 Like

Ok, I’ve managed to install the docker container via Portainer and its running but how do I call the test to run from within HA ? Do I need to call a Python script to get it to run ?

Just came across this as I was looking to do the same! Thanks for the good work - it works flawlessly!

mb

1 Like

You don’t call it, you have to configure the parameters of your mqtt broker in the config.ini file as well as some other parameters and it will run at the frequency you specify. See some example file in the repo:

1 Like

Thank you, All sorted now.

Would that be worth adding to your GH repo to advise others ?

1 Like

Of course! Will do it in free time but feel free to contribute. You have it fresh :blush: