Giter Club home page Giter Club logo

hassio-speedtest-addon's Introduction

SpeedTest Home Assistant Addon

Home Assistant has a native integration with Speedtest.net. However, it uses a third-party speedtest implementation in python that may not produce accurate measures. This addon aims to integrate the official speedtest binary with Home Assistant to mitigate this problem.

There have been previous attempts to do this, but imply the installation of custom scripts and the speedtest-cli directly into the operating system. This project overcomes this issue by creating an add-on that doesn't imply any modification in the underlying system.

Installation

  1. Install the official speedtest integration

  2. Disable automatic runs of this integration

    1. Go to the integrations page of your Home Assistant instance and click in CONFIGURE in the SpeedTest integration.

      speedtest integration page

    2. Click on the three dots the SpeedTest integration card.

    3. Click on System options.

      speedtest options page

    4. Disable the automatic execution of this integration by ensuring that Enable polling for updates is disabled.

      speedtest polling setting

      If you don't see this option ensure that your HomeAssistant is updated and you have refreshed your page after installing the SpeedTest integration.

    5. You should see the SpeedTest integration card with a symbol on the top right that indicates that polling is disabled.

      speedtest polling disabled

  3. Click the Home Assistant My button below to open the add-on on your Home Assistant instance.

  4. Add this addon repository to your addon store.

  5. Install the SpeedTest addon.

  6. Create an automation that runs this addon as often as you want. Use the action service hassio.addon_start to start the addon 6b87c29e_speedtest_addon.

Configuration

Example basic add-on configuration:

accept_eula: true
accept_rgpd: true

In this case, the addon would choose a random SpeedTest server each time it runs. It is recommended to specify a server_id to have comparable measurements. The server_idis an integrer.

You can run this add-on with following the configuration to see in the addon log which servers are the closest to you:

accept_eula: true
accept_rgpd: true
print_closest_servers: true

After that, you should remove the print_closest_servers and add the server_id with the id of your choice.

An example of a configuration with a configured server_id is:

accept_eula: true
accept_rgpd: true
server_id: 48096

Alternatively, you can use this command to identify servers that are close to you: curl https://c.speedtest.net/speedtest-servers-static.php. The server_id is called id in the returned XML table. (If you access this link with your web browser instead of using curl, please have in mind that it doesn't respond an html page, but rather a xml table. You can see the results by view the source-code of the page.)

Licensing

To use this addon you must accept the SpeedTest's End User License Agreement, Terms of Use and Privacy Policy. They are available at these links: . https://www.speedtest.net/about/eula . https://www.speedtest.net/about/terms . https://www.speedtest.net/about/privacy

After reading these policies you could accept them by turning on the accept_eula and accept_rgpd in the addon's configuration tab.

hassio-speedtest-addon's People

Contributors

flosch-dev avatar mrsuicideparrot avatar si458 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jpettitt si458

hassio-speedtest-addon's Issues

not work after last update

{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:38Z","message":"Error: [0] Cannot read from socket: ","level":"error"}
{"type":"log","timestamp":"2024-04-30T07:49:43Z","message":"Error: [0] Cannot open socket","level":"error"}
./run: line 58: null: unbound variable
./run: line 60: null: unbound variable

Syntax error operand expected

Raspberry Pi 4, homeassistant 2023.4.2

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started 
s6-rc: info: service fix-attrs: starting 
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting 
s6-rc: info: service legacy-cont-init successfully started 
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun speedtest (no readiness notification)
s6-rc: info: service legacy-services successfully started
[19:29:22] INFO: Starting speed test
{"type":"log","timestamp":"2023-04-10T18:29:23Z","message":"Configuration - No servers defined (NoServersException)","level":"error"}
[19:29:23] DEBUG: Speedtest output: 
./run: line 39: *8/10000: syntax error: operand expected (error token is "*8/10000")
./run: line 40: *8/10000: syntax error: operand expected (error token is "*8/10000")
[19:29:23] INFO: --------- Speed test ended ---------
[19:29:23] INFO: Download measured:
[19:29:23] INFO: Upload: 
[19:29:23] INFO: Ping: 
[19:29:23] INFO: --------- ---------
./run: line 19: 4: unbound variable
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
accept_eula: true
accept_rgpd: true
server_id: 15553
debug: true

binary_sensor.speedtest_running does not update

When I launch speed test from an automation the sate of binary_sensor.speedtest_running does not change. I'd like to be able to have an entity displayed for binary_sensor.speedtest_running with a tap action to start the test and have the entity state reflect that it's actually running but it doesn't seem to work.

My current workaround is to set a helper to "running" and and then wait for the upoload value to update and clear the helper.

alias: Internet Speed Test
description: ""
trigger: []
condition: []
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.speed_test_running
  - service: hassio.addon_start
    data:
      addon: 6b87c29e_speedtest_addon
  - wait_for_trigger:
      - platform: state
        entity_id:
          - sensor.speedtest_upload
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.speed_test_running
mode: single

Translation not used

Hi, just installed your addon and noticed that the entities are duplicated, I have Spanish as my HAOS language and the SpeedTest integration uses Spanish entity names speedtest_descarga, speedtest_subida...
imagen

I don't know if the name of the entity can be fetched somehow to use the same or maybe add it to the config file of the addon, it's non-breaking but an improvement

Unable to get the integration to start

Hey, love this idea to use the speedtest.net CLI for more accurate results, but having trouble getting the addin to start. Log below, let me know if I'm missing anything.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun speedtest (no readiness notification)
s6-rc: info: service legacy-services successfully started
[12:52:06] INFO: Starting speed test

You may only use this Speedtest software and information generated
from it for personal, non-commercial use, through a command line
interface on a personal computer. Your use of this software is subject
to the End User License Agreement, Terms of Use and Privacy Policy at
these URLs:
https://www.speedtest.net/about/eula
https://www.speedtest.net/about/terms
https://www.speedtest.net/about/privacy

License acceptance recorded. Continuing.

Ookla collects certain data through Speedtest that may be considered
personally identifiable, such as your IP address, unique device
identifiers or location. Ookla believes it has a legitimate interest
to share this data with internet providers, hardware manufacturers and
industry regulators to help them understand and create a better and
faster internet. For further information including how the data may be
shared, where the data may be transferred and Ookla's contact details,
please see our Privacy Policy at:
http://www.speedtest.net/privacy

License acceptance recorded. Continuing.
jq: error: syntax error, unexpected QQSTRING_START, expecting $end (Unix shell quoting issues?) at , line 1:
Media","interface":{"internalIp":"","name":"eth0","macAddr":"","isVpn":false,"externalIp":""},"server":{"id":11445,"host":"lon.host.speedtest.net","port":8080,"name":"Structured
jq: 1 compile error
./run: line 33: *8/1000000: syntax error: operand expected (error token is "*8/1000000")
jq: error: syntax error, unexpected QQSTRING_START, expecting $end (Unix shell quoting issues?) at , line 1:
Media","interface":{"internalIp":"","name":"eth0","macAddr":"","isVpn":false,"externalIp":""},"server":{"id":11445,"host":"lon.host.speedtest.net","port":8080,"name":"Structured
jq: 1 compile error
./run: line 34: *8/1000000: syntax error: operand expected (error token is "*8/1000000")
jq: error: syntax error, unexpected QQSTRING_START, expecting $end (Unix shell quoting issues?) at , line 1:
Media","interface":{"internalIp":"","name":"eth0","macAddr":"","isVpn":false,"externalIp":""},"server":{"id":11445,"host":"lon.host.speedtest.net","port":8080,"name":"Structured
jq: 1 compile error
[12:52:25] INFO: --------- Speed test ended ---------
./run: line 38: down_load_speed: unbound variable
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Add-on resets custom entity icon

Prior to installing speedtest add-on, I defined custom icons for the entities in the integrated Speedtest. After installing and running the add-on, the custom icons do not show up on the entities when displayed (reverts back to default speedometer icon). The custom icons are still defined in the entity's settings.

Addon keeps spamming logs with errors

Recently, in the supervisor logs these two errors keep appearing

Registratore: homeassistant.components.hassio.data
Fonte: components/hassio/data.py:497
Integrazione: Home Assistant Supervisor ([documentazione](https://www.home-assistant.io/integrations/hassio), [problemi](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+hassio%22))
Prima occorrenza: 11:29:44 (363 occorrenze)
Ultima registrazione: 21:26:16

Could not fetch changelog for 6b87c29e_speedtest_addon:

and

Registratore: homeassistant.components.hassio.handler
Fonte: components/hassio/handler.py:612
Integrazione: Home Assistant Supervisor ([documentazione](https://www.home-assistant.io/integrations/hassio), [problemi](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+hassio%22))
Prima occorrenza: 11:29:44 (363 occorrenze)
Ultima registrazione: 21:26:16

Client error on /addons/6b87c29e_speedtest_addon/changelog request 0, message='Attempt to decode JSON with unexpected mimetype: application/octet-stream', url=URL('http://172.30.32.2/addons/6b87c29e_speedtest_addon/changelog')

FEATURE REQUEST: display server name/id as entity/attribute

It would be amazing if you could display the test server name/id number as either a new entity OR attached to the entities in the attributes

Like what the old speedtest integration did

This would allow you to see which server the test was run against if you didn't specify a test serverid

Leaving server_id as null doesn't work

The add-on settings can't currently be saved with the server_id set to null, which as I understand is the way for it to auto-select a server when it runs. The example configuration in the readme has null there, so it seems like this might be a UI or validation bug?

Error - No servers defined

Even when the server is defined, the speedtest addon stopped working.

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun speedtest (no readiness notification)
s6-rc: info: service legacy-services successfully started
[14:00:37] INFO: Starting speed test
{"type":"log","timestamp":"2023-06-24T13:00:37Z","message":"Configuration - No servers defined (NoServersException)","level":"error"}
[14:00:37] DEBUG: Speedtest output: 
./run: line 46: *8/10000: syntax error: operand expected (error token is "*8/10000")
./run: line 47: *8/10000: syntax error: operand expected (error token is "*8/10000")
[14:00:38] INFO: --------- Speed test ended ---------
[14:00:38] INFO: Download measured: 
[14:00:38] INFO: Upload: 
[14:00:38] INFO: Ping: 
[14:00:38] INFO: --------- ---------
./run: line 26: 4: unbound variable
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Add-On is Not Listed on Add-on Page

I'm using Home Assistant OS as a virtual machine. Already installed speedtestdotnet integration. Disabled auto-polling. (My speedtest integration menu is different from your readme, I guess it's about version. There is no frequency menu.)

resim
resim

Then added repository URL;

resim

But when I search the Add-on repository, speedtest-addon is not listed;

resim

In the supervisor logs, I can see 1 new repository is added, here is supervisor logs;

23-02-13 17:07:47 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/MrSuicideParrot/hassio-speedtest-addon repository 23-02-13 17:07:48 INFO (MainThread) [supervisor.store] Loading add-ons from store: 69 all - 1 new - 0 remove 23-02-13 17:09:15 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository 23-02-13 17:09:15 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/MrSuicideParrot/hassio-speedtest-addon repository 23-02-13 17:09:15 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository 23-02-13 17:09:15 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository 23-02-13 17:09:18 INFO (MainThread) [supervisor.store] Loading add-ons from store: 69 all - 0 new - 0 remove

After "Check Updates" button on add-on repository, no luck.

Thanks for the project, I'm getting inaccurate results between speedtestdotnet integration results and official speedtest-cli results (on another machine), I hope this add-on will solve the issue.

Feature Request: Specify Server in Script, Not Fixed iin Config

Hi There

Thanks for this excellent add-on - it does seem to give more accurate/consistent results than the HA built-in, and is also very useful for running a test on demand.

I have a feature request please. I would like to be able to specify the speedtest server for each run, rather than just fixed in the config. My use case is running speedtests on a dual wan load-balanced set-up, using routing rules to make sure that traffic to a specific speedtest server only goes via a specific WAN port (i.e. provider).

Hopefully it might be useful to others as well!

Thanks

Documentation update

Great addon. Please add a small note to the Installation guide.

  1. Create an automation that runs this addon as often as you want.

Update to:
6. Create an automation that runs this addon as often as you want. Use the action service: hassio.addon_start to start the addon: 6b87c29e_speedtest_addon.

I made the mistake to use the service: homeassistant.update_entity which will trigger the broken integrated version instead of the addon.

Sensor becomes unavailable because it's not updated

The add-on works, but it doesn't update my upload and download sensor, because the speed doesn't change.
I think it would help to add more digits, currently my download always reads 58 Mbit/s and my upload 10.

Any way to add more detail to the measurement? My ping gets updated.

This somehow seems worse then the original speedtest

No offence - but i have a 1Gbps connections, but somehow i get results like :

License acceptance recorded. Continuing.
[23:26:17] INFO: --------- Speed test ended ---------
[23:26:17] INFO: Download measured: 166.62
[23:26:17] INFO: Upload: 91.86
[23:26:17] INFO: Ping: 8.502
[23:26:17] INFO: --------- ---------
null
[23:26:17] INFO: Speedtest Download updated
null
[23:26:17] INFO: Speedtest Upload updated
null
[23:26:18] INFO: Speedtest Ping updated

The old speedtest used to give me somewhere between 400 - 600 on a good day. Still wildly inaccurate of course.
I'm running this in VMware on a bridged network connection. I checked the /sys/net/speed file and it's a 1000, so it is getting that right.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.