alexjustesen / speedtest-tracker

Speedtest Tracker is a self-hosted application that monitors the performance and uptime of your internet connection.
https://speedtest-tracker.dev/
MIT License
2.93k stars 107 forks source link

A Home Assistant add-on? #1586

Open Nickduino opened 5 months ago

Nickduino commented 5 months ago

Would it be possible to turn this project into a Home Assitant add-on to set it up in one click, rather than having to install it somewhere else and import all data through the API?

That would be a very welcome alternative for people who aren't too tech savy like myself :-)

mckooter commented 4 months ago

As a workaround using the unofficial API for now I was able to get the data into home assistant using Node RED (available as an addon if you are using the home assistant os) Below is how simple it looks firefox_U1iWCD9OEV

I apologize if this isnt the appropriate place for this, if it is let me know and I can move it, but figured it would be helpful for others in the mean time.

Thanks,

mckooter commented 4 months ago

Additionally, its much easier to just do it in the home assistant configuration.yaml. Here is an example that pulls the same as the above node red (I did add the rest of the values from the json to the attributes of each sensor (could also pull any of those values for its own sensor if desired

sensor:
  - platform: rest
    name: Speedtest Ping
    resource: http://{{SERVERIP}}:8080/api/speedtest/latest
    value_template: "{{ value_json.data.ping }}"
    unit_of_measurement: "ms"
    scan_interval: 1800  # 30 minutes in seconds
    json_attributes_path: "$.data"
    json_attributes:
      - id
      - server_id
      - server_host
      - server_name
      - url
      - scheduled
      - failed
      - created_at
      - updated_at

  - platform: rest
    name: Speedtest Download
    resource: http://{{SERVERIP}}:8080/api/speedtest/latest
    value_template: "{{ value_json.data.download }}"
    unit_of_measurement: "Mbps"
    scan_interval: 1800  # 30 minutes in seconds
    json_attributes_path: "$.data"
    json_attributes:
      - id
      - server_id
      - server_host
      - server_name
      - url
      - scheduled
      - failed
      - created_at
      - updated_at

  - platform: rest
    name: Speedtest Upload
    resource: http://{{SERVERIP}}:8080/api/speedtest/latest
    value_template: "{{ value_json.data.upload }}"
    unit_of_measurement: "Mbps"
    scan_interval: 1800  # 30 minutes in seconds
    json_attributes_path: "$.data"
    json_attributes:
      - id
      - server_id
      - server_host
      - server_name
      - url
      - scheduled
      - failed
      - created_at
      - updated_at

sorry for the double reply, but this should sort anyone out with home assistant for a while. I was working on a custom integration but this is much easier and does the job.

Thanks again

19ban19 commented 4 months ago

I’m running HA in a container same as speedtest tracker. It would be nice if there would be integration in HA or HACS integration available

thanks

soulripper13 commented 4 months ago

Has anyone been able to use a script or button to run the test in home assistant?