Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase Tomato request timeout #104203

Merged
merged 3 commits into from Nov 19, 2023

Conversation

ertechdesign
Copy link
Contributor

Proposed change

Tomato integration was not working for about a year for many users. It was enough to extend the timeout. As soon as the timeout period was extended the integration works like a charm.

#103892

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • [] The code has been formatted using Black (black --fast homeassistant tests)
  • [] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ertechdesign

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot marked this pull request as draft November 19, 2023 12:51
@home-assistant home-assistant bot added the small-pr PRs with less than 30 lines. label Nov 19, 2023
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@ertechdesign ertechdesign marked this pull request as ready for review November 19, 2023 12:56
@joostlek joostlek changed the title tomato integration timeout fixed Increase Tomato request timeout Nov 19, 2023
@jbouwh
Copy link
Contributor

jbouwh commented Nov 19, 2023

The change from 3 to 60 seconds is large. What is the minimal timeout time that would work?

@ertechdesign
Copy link
Contributor Author

The change from 3 to 60 seconds is large. What is the minimal timeout time that would work?

Agreed. In my circumstances I think I get response in some 6 seconds based on limitted testing, however, it might differ since Tomato is available for range of devices with different CPU/RAM and it also depends on the utilisation. I am 100% sure 3seconds is insufficient since Tomato v2022.8 as the integration doesn't work at all. In my case it's Netgear Nighthawk R7000. I suggest to give it a couple of hours of testing on 15 seconds and should it work well I push another PR with 15 second if that's acceptable?

@jbouwh
Copy link
Contributor

jbouwh commented Nov 19, 2023

You need to update the timeout in the tests as well to make CI test pass so it seems.

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A timeout of 15 sec max. is suggested. CI tests need to be updated as well

@home-assistant home-assistant bot marked this pull request as draft November 19, 2023 18:48
@ertechdesign
Copy link
Contributor Author

ertechdesign commented Nov 19, 2023

A timeout of 15 sec max. is suggested. CI tests need to be updated as well

I'm still testing it. I can confirm with the increased limit of 60s it works without issue (recognises devices offline/online within minute when disconnected/connected).

My router response is really fast (less than 1ms), but only when hitting the specific endpoint 'status-devices.asp' on my router takes forever.

I'm attaching screenshot of the endpoint in the router loading, it takes as much as 45s:
load

I tried to factory reset the router and the issue still persists. I'm not the only user reporting it but there was not too many people raising it. This was introduced about a year ago with the router running Tomato 2022.8 and still lasts until now, running Tomato 2023.4.

Is there any chance we could make the Timeout value as an optional in config.yaml with default=3 and if someone has issues like I do they can change it to whatever they want, like 60?

Alternatively, can someone else using Tomato confirm if their status-devices.asp endpoint loads within 3s because mine never does for a year now.

@jbouwh
Copy link
Contributor

jbouwh commented Nov 19, 2023

Let set the 60 sec time out. But update the CI tests to make them pass.

Copy link
Contributor Author

@ertechdesign ertechdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted a commit with CI tests updated, can you please review and approve, many thanks!

@jbouwh jbouwh added this to the 2023.11.3 milestone Nov 19, 2023
@jbouwh
Copy link
Contributor

jbouwh commented Nov 19, 2023

@ertechdesign I assume the PR is ready for review. If that is the fact please make it ready for review again so that the PR can be merged,

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,
Thnx @ertechdesign 👍

@ertechdesign ertechdesign marked this pull request as ready for review November 19, 2023 22:39
@home-assistant home-assistant bot requested a review from jbouwh November 19, 2023 22:39
@jbouwh jbouwh merged commit f8e3f14 into home-assistant:dev Nov 19, 2023
23 checks passed
@ertechdesign ertechdesign deleted the fix-tomato-integration branch November 20, 2023 06:24
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tomato integration - Connection to the router timed out
3 participants