home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.03k stars 30.17k forks source link

Speedtestdotnet : Error fetching speedtestdotnet data: Unable to connect to servers to test latency #89854

Closed Jiraod closed 1 month ago

Jiraod commented 1 year ago

The problem

The problem I can't make the speedtest integration to work. As soon as I install it, I have this error "Retrying setup: Unable to connect to servers to test latency." The log only has one line : "Error fetching speedtestdotnet data: Unable to connect to servers to test latency". And I'm not able to select any server.

Speedtest works perfectly on the other devices I use so it's not a network issue.

What version of Home Assistant Core has the issue?

core-2023.3.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

speedtestdotnet

Link to integration documentation on our website

https://www.home-assistant.io/integrations/speedtestdotnet

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-03-17 10:23:51.151 ERROR (MainThread) [homeassistant.components.speedtestdotnet.coordinator] Error fetching speedtestdotnet data: Unable to connect to servers to test latency.

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @rohankapoorcom, @engrbm87, mind taking a look at this issue as it has been labeled with an integration (speedtestdotnet) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `speedtestdotnet` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign speedtestdotnet` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


speedtestdotnet documentation speedtestdotnet source (message by IssueLinks)

Champomix commented 1 year ago

Same issue for me. Init fails with this log image.

Outgoing 8080 port is open image

3pp63r6RU9VMbd commented 1 year ago

I got the same problem.

KitHubek commented 1 year ago

the same here, and if connect failed, integration dont do reconnect. stays unactive

if manual select server, and this server is not available, integration crashed with error:

500 Internal Server Error Server got itself in trouble

and nothing to do. Have to unistall it and install again, because cant change server to other

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

3pp63r6RU9VMbd commented 1 year ago

I got the lastest version of HomeAssistant and i got the same message "Le flux de configuration n'a pas pu être chargé: 500 Internal Server Error Server got itself in trouble"

agc93 commented 1 year ago

I'm still seeing this issue on the latest version of HA. Even if I can get the integration to work, the same errors pick up again when the automation next calls the service.

issue-triage-workflows[bot] commented 11 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

agc93 commented 11 months ago

I am still seeing this issue on the latest version of HA.

PetziAt commented 9 months ago

Similar on my site. Auto Detect is working. If I choose a server the extension is not longer operating.

Auto Detect is choosing a server in another country. My provider offers a speedtest.net server and it's working perfectly in the browser. Cannot choose the provider's server. Serverlist contains different servers every time I reload the service. Provider's server isn't listed by the extension.

Djamelito commented 9 months ago

Hello,

Same for me :

Logger: homeassistant.components.speedtestdotnet.coordinator Source: helpers/update_coordinator.py:332 Integration: Speedtest.net (documentation, issues) First occurred: 22:36:24 (1 occurrences) Last logged: 22:36:24

Error fetching speedtestdotnet data: Unable to connect to servers to test latency.

since some months for me.

thx for your support regards Djam

mikymigs commented 8 months ago

Hello,

Same issue here. A fix would be appreciated 🙏

Thanks a lot.

magicse commented 7 months ago

Hello,

Same issue here. A fix would be appreciated !

Thanks a lot.

Try use speedtest cli configuration.yaml

command_line:
  - sensor:
     command: '/usr/local/bin/speedtest --json --secure'
     name: SpeedTest Data
     unique_id: speedtest_data
     command_timeout: 90
     scan_interval: 3700
     value_template: >
       {{
         {
           "ping": value_json.ping,
           "download": value_json.download,
           "upload": value_json.upload
         }
           | to_json
       }}
     json_attributes:
       - ping
       - download
       - upload

template:       
  - sensor:
    - name: 'SpeedTest CLI Ping'
      unique_id: speedtest_data_ping
      icon: mdi:speedometer
      # TIME_MILLISECONDS: Final = "ms"
      unit_of_measurement: ms
      state_class: measurement
      state: "{{ (states('sensor.speedtest_data') | from_json).ping | round(2) }}"
    - name: 'SpeedTest CLI Download'
      unique_id: speedtest_data_download
      icon: mdi:speedometer
      # DATA_RATE_MEGABITS_PER_SECOND: Final = "Mbit/s"
      unit_of_measurement: Mbit/s
      state_class: measurement
      state: "{{ ((states('sensor.speedtest_data') | from_json).download / 1000 / 1000) | round(2) }}"
    - name: 'SpeedTest CLI Upload'
      unique_id: speedtest_data_upload
      icon: mdi:speedometer
      unit_of_measurement: Mbit/s
      state_class: measurement
      state: "{{ ((states('sensor.speedtest_data') | from_json).upload / 1000 / 1000) | round(2) }}"

also you could make changes in speedtest.py

        urls = [
            '://www.speedtest.net/speedtest-servers-static.php',
            'http://c.speedtest.net/speedtest-servers-static.php',
            '://www.speedtest.net/speedtest-servers.php',
            'http://c.speedtest.net/speedtest-servers.php',
        ]

to

        urls = [
            #'://www.speedtest.net/speedtest-servers-static.php',
            'http://c.speedtest.net/speedtest-servers-static.php',
            '://www.speedtest.net/speedtest-servers.php',
            'http://c.speedtest.net/speedtest-servers.php',
        ]
mikymigs commented 7 months ago

Try use speedtest cli configuration.yaml

Thank you! It's not quite the same as fixing this integration but at least I managed to make it work. I had to use a slightly different solution though because I wanted to use the last version of the CLI which is a binary executable, not .py file anymore. The final solution I used is described here: https://forum.hacf.fr/t/integrer-speedtest-cli-officielle-a-home-assistant/15436

magicse commented 7 months ago

Thank you! It's not quite the same as fixing this integration but at least I managed to make it work. I had to use a slightly different solution though because I wanted to use the last version of the CLI which is a binary executable, not .py file anymore. The final solution I used is described here: https://forum.hacf.fr/t/integrer-speedtest-cli-officielle-a-home-assistant/15436

Yes, your method is just as good. But I like python speedtest-cli because I can edit the list of links from which lists of servers are obtained. And according to my observations, the first link in the list gave me erroneous servers not from my country... and because of this, problems arose with assessing the speed. After I commented out the first link, everything works fine for me.

speedtest-cli speedtest-cli speedtest original integration after comment first server link speedtest-originali

JPFOLLEGOT commented 4 months ago

Hello, Same issue here. A fix would be appreciated ! Thanks a lot.

Try use speedtest cli configuration.yaml

command_line:
  - sensor:
     command: '/usr/local/bin/speedtest --json --secure'
     name: SpeedTest Data
     unique_id: speedtest_data
     command_timeout: 90
     scan_interval: 3700
     value_template: >
       {{
         {
           "ping": value_json.ping,
           "download": value_json.download,
           "upload": value_json.upload
         }
           | to_json
       }}
     json_attributes:
       - ping
       - download
       - upload

template:       
  - sensor:
    - name: 'SpeedTest CLI Ping'
      unique_id: speedtest_data_ping
      icon: mdi:speedometer
      # TIME_MILLISECONDS: Final = "ms"
      unit_of_measurement: ms
      state_class: measurement
      state: "{{ (states('sensor.speedtest_data') | from_json).ping | round(2) }}"
    - name: 'SpeedTest CLI Download'
      unique_id: speedtest_data_download
      icon: mdi:speedometer
      # DATA_RATE_MEGABITS_PER_SECOND: Final = "Mbit/s"
      unit_of_measurement: Mbit/s
      state_class: measurement
      state: "{{ ((states('sensor.speedtest_data') | from_json).download / 1000 / 1000) | round(2) }}"
    - name: 'SpeedTest CLI Upload'
      unique_id: speedtest_data_upload
      icon: mdi:speedometer
      unit_of_measurement: Mbit/s
      state_class: measurement
      state: "{{ ((states('sensor.speedtest_data') | from_json).upload / 1000 / 1000) | round(2) }}"

also you could make changes in speedtest.py

        urls = [
            '://www.speedtest.net/speedtest-servers-static.php',
            'http://c.speedtest.net/speedtest-servers-static.php',
            '://www.speedtest.net/speedtest-servers.php',
            'http://c.speedtest.net/speedtest-servers.php',
        ]

to

        urls = [
            #'://www.speedtest.net/speedtest-servers-static.php',
            'http://c.speedtest.net/speedtest-servers-static.php',
            '://www.speedtest.net/speedtest-servers.php',
            'http://c.speedtest.net/speedtest-servers.php',
        ]

How do you gain access to speedtest.py file to crmment it ?

JPFOLLEGOT commented 4 months ago

My HA runs on a VirtualBox, and SSH 22222 is almost impossible to configure in such situation, Your patch of speedtest.py would have probably solved my error. "homeassistant.exceptions.ConfigEntryNotReady: Unable to connect to servers to test latency." It is a pitty, but I gave up and uninstalled Speedtest. Thanks.

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.