core icon indicating copy to clipboard operation
core copied to clipboard

Speedtest stuck on configuration fail fresh install (RPi3)

Open WolwX opened this issue 1 year ago • 3 comments

The problem

Hello,

Fresh try to use speedtest official intégration but stuck at initial auto configuration.

Network work fine, tested with Fast integration it's ok.

Using speedtest on a browser connected to the same network as the Rapsberry Pi 3 is ok.

Cloud it's OK too in another integrations.

Screenshots. Screenshot_20240215_212007_Home Assistant Screenshot_20240215_212025_Home Assistant Screenshot_20240215_212045_Home Assistant

What version of Home Assistant Core has the issue?

2024-2-1

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?

No response

Additional information

No response

WolwX avatar Feb 15 '24 20:02 WolwX

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.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


speedtestdotnet documentation speedtestdotnet source (message by IssueLinks)

home-assistant[bot] avatar Feb 15 '24 20:02 home-assistant[bot]

Nothing in the logs?

gjohansson-ST avatar Feb 16 '24 10:02 gjohansson-ST

Nothing in the logs?

No ... nothing in my supervisor log.

After rebooting speedtest created 3 sensors but still blanck.

Screenshot_20240216_123719_Home Assistant.jpg

Screenshot_20240217_091351_Chrome.jpg

WolwX avatar Feb 17 '24 08:02 WolwX

Not sure what you mean with supervisor log? It's the normal log (Home Assistant Core) you should look at (which seems to be the one you look at according to the printscreen).

I think best would be to use a computer and expand the full log and see if you see the entries from speedtest there somewhere.

gjohansson-ST avatar Feb 24 '24 22:02 gjohansson-ST

Same issue here.

2024-02-29 12:01:28.527 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 223, in post
return await super().post(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
result = await self._flow_mgr.async_init(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 345, in async_init
result = await self._async_handle_step(flow, flow.init_step, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/config_flow.py", line 71, in async_step_init
self._servers = self.hass.data[DOMAIN].servers
~~~~~~~~~~~~~~^^^^^^^^```

ShiiroSan avatar Feb 29 '24 12:02 ShiiroSan

I have the same issue. See logs below.

For me, it seemed to work fine when using the ‘Auto detect’ server configuration. But it broke the moment I saved the configuration after selecting my internet provider’s own speedtest server.

Core: 2024.2.5 Supervisor: 2024.02.1 Operating System: 12.0 Frontend: 20240207.1

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 09:49:46 (8 occurrences)
Last logged: 09:53:18

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 223, in post
    return await super().post(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 345, in async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/config_flow.py", line 71, in async_step_init
    self._servers = self.hass.data[DOMAIN].servers
                    ~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'speedtestdotnet'

The debug logging also doesn’t seem to add much new information:

2024-03-03 11:05:55.261 DEBUG (MainThread) [homeassistant.components.speedtestdotnet.coordinator] Finished fetching speedtestdotnet data in 0.325 seconds (success: False)

Didel avatar Mar 03 '24 09:03 Didel

I have tested and it works fine for me.

But as both of you have an error on line 71 for self._servers = self.hass.data[DOMAIN].servers but this line is not on 71 but on line 78 it tells me that both of you have a custom component installed and you're not using the core integration.

I recommend you remove this custom version you have and. use the core one, or raise an issue at the custom component repository

gjohansson-ST avatar Mar 03 '24 10:03 gjohansson-ST

I have tested and it works fine for me.

But as both of you have an error on line 71 for self._servers = self.hass.data[DOMAIN].servers but this line is not on 71 but on line 78 it tells me that both of you have a custom component installed and you're not using the core integration.

I recommend you remove this custom version you have and. use the core one, or raise an issue at the custom component repository

Hello,

Excuse me but I'm using the core version of Speedtest. I don't know how to use another version.

I installed it from the main menu .... So if my file are different that's not because I use an unusual version of the plugin :/

WolwX avatar Mar 03 '24 10:03 WolwX

Not sure what you mean with supervisor log? It's the normal log (Home Assistant Core) you should look at (which seems to be the one you look at according to the printscreen).

I think best would be to use a computer and expand the full log and see if you see the entries from speedtest there somewhere.

I Will try to join a full text log from my computer when possible.

WolwX avatar Mar 03 '24 10:03 WolwX

Sorry, you're right. there was a prior change modifying the line numbers which I didn't notice before.

When exactly do you get this error.

  • At HA startup?
  • When configuring options?
  • Any other time?

gjohansson-ST avatar Mar 03 '24 11:03 gjohansson-ST

Sorry, you're right. there was a prior change modifying the line numbers which I didn't notice before.

When exactly do you get this error.

  • At HA startup?
  • When configuring options?
  • Any other time?

For me, the integration was working fine with the ‘auto detect’ server configuration option (at least for half a year, if not longer). The moment I used the configuration option to select a Speedtest server from the list and stored the configuration, the integration stopped working. It looks like it tries to start, throws above error, then tries to restart itself resulting in an error-loop. I also couldn't change the configuration any more, because when I tried to open the configuration form (the one where I could change the server), I got a pop-up message saying something about a 500 internal error.

I did restart HA in the mean time, and it looks to work properly again now though. It seems to have stored the server I have selected previously, and manually restarting the integration works fine (and results in new speedtest measurements).

Didel avatar Mar 03 '24 11:03 Didel

Ok So just to clarify. Ha was already running and the integration was working fine and updating it's data. You went and clicked on config entry options for the integration to change the server from the default auto detect to select something. When pressing submit the above error happened?

I somehow don't understand why it would blow up (and doesn't for me when I'm testing.

gjohansson-ST avatar Mar 03 '24 12:03 gjohansson-ST

Ok

So just to clarify.

Ha was already running and the integration was working fine and updating it's data.

You went and clicked on config entry options for the integration to change the server from the default auto detect to select something.

When pressing submit the above error happened?

Yes, exactly.

I somehow don't understand why it would blow up (and doesn't for me when I'm testing.

Interestingly, when looking at the list of available servers, it looked like I only saw a few of the servers I should see. I understand the list is being loaded from speedtest and somehow coming up with nearby servers, but the list I am seeing now is much longer than the list I saw yesterday. Interestingly, the server I have now configured was not always present in this list...

Didel avatar Mar 03 '24 13:03 Didel

Ok, so speedtest just stopped working again. I didn’t change anything at all since my earlier report that things were working again. The three sensors (up/down/ping) reported unavailable. After reloading the integration, I’m back in the same error-loop as above.

On the bright side: I’m able to reproduce the error message when trying to configure the server when in the error-loop:

Config-flow kon niet geladen worden: 500 Internal Server Error Server got itself in trouble

Didel avatar Mar 03 '24 17:03 Didel

I'll try to stop spamming after this, but I still believe this is relevant information:

I haven't changed / done anything since the error-loop above, and looking at the graph of the Download entity, I see the following:

Scherm­afbeelding 2024-03-04 om 08 41 25

It seems that all of a sudden it started working again early in the morning (around 05:30 am), and then stopped working all of a sudden again just now, without any restart, reboot, or anything else happening to the HA system.

More interesting, the logs indicate the following message:

Logger: homeassistant.components.speedtestdotnet.coordinator Source: helpers/update_coordinator.py:345 Integration: Speedtest.net (documentation, issues) First occurred: 3 maart 2024 om 17:52:23 (2 occurrences) Last logged: 08:31:28

Error fetching speedtestdotnet data: Selected server is not found.

That kind of speaks for itself? And that seems to match my earlier findings:

Interestingly, when looking at the list of available servers, it looked like I only saw a few of the servers I should see. I understand the list is being loaded from speedtest and somehow coming up with nearby servers, but the list I am seeing now is much longer than the list I saw yesterday. Interestingly, the server I have now configured was not always present in this list...

Obviously, the selected server (https://t-mobile.speedtestcustom.com) is available and working properly.

Didel avatar Mar 04 '24 07:03 Didel

Happens to me when configuring.

Following message might appears some times: image

ShiiroSan avatar Mar 04 '24 08:03 ShiiroSan

Hello,

I've the same issue, I tried to install speedtest from HA (2024.3.3) The only thing that I found in the log related to speedtest integration is the following log :

File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/config_flow.py", line 71, in async_step_init
KeyError: 'speedtestdotnet'

Hope that helps

coco673 avatar Mar 31 '24 07:03 coco673

@gjohansson-ST Thank you for the update. I just updated my HomeAssistant to 2024.4 (which has just been released), which includes the fix you mentioned. Since my earlier comment, nothing has changed regarding the Speedtest integration or its settings. Speedtest currently still can't load any results (the Upload, Download and Ping sensors all show 'Unavailable'). When using the 'Configure' option of the integration, no option shows as selected in the 'select server' dropdown (so also not the 'auto detect' option), and the server I had selected earlier is not present in the list of available servers.

The error logs show the following:

2024-04-03 21:21:02.610 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/coordinator.py", line 76, in _async_update_data
return await self.hass.async_add_executor_job(self.update_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/coordinator.py", line 62, in update_data
self.api.get_servers(servers=[server_id])
File "/usr/local/lib/python3.12/site-packages/speedtest.py", line 1353, in get_servers
raise NoMatchedServers()
speedtest.NoMatchedServers
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/coordinator.py", line 78, in _async_update_data
raise UpdateFailed("Selected server is not found.") from err
homeassistant.helpers.update_coordinator.UpdateFailed: Selected server is not found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/speedtestdotnet/__init__.py", line 35, in _async_finish_startup
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 287, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: Selected server is not found.

Your help is very much appreciated. Considering this ticket is closed, please either re-open this ticket or let me know if I should open a new ticket.

Didel avatar Apr 03 '24 19:04 Didel

@gjohansson-ST I can still confirm the same behavior as before the update: Sometimes the server can't be found, no measurements happen and the sensors report unavailable. Then at seemingly random moments the server is found and proper measurements can be made. Then, just as random, the 'connection' seems to be lost again and the sensors report unavailable again.

image

Didel avatar Apr 05 '24 14:04 Didel

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.

The issue is still present.

image

Didel avatar Jul 04 '24 17:07 Didel