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

Set ping interval to 15 seconds instead of 5 minutes #105191

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

nohn
Copy link
Contributor

@nohn nohn commented Dec 7, 2023

Proposed change

When moving ping integration from yaml to GUI instead of a configurable interval, a fixed interval of 5 minutes is used. An interval that long does not make much sense in a home automation context. This PR changes that interval to a way more sane 15 seconds.

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 Ruff (ruff format 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:

@home-assistant
Copy link

home-assistant bot commented Dec 7, 2023

Hey there @jpbede, mind taking a look at this pull request as it has been labeled with an integration (ping) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ping can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign ping Removes the current integration label and assignees on the pull request, 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 pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@jpbede jpbede changed the title set ping interval to 15 seconds instead of 5 minutes allowing to continue using ping sensor in more realistic automation scenarios set ping interval to 15 seconds instead of 5 minutes Dec 7, 2023
@jpbede jpbede added this to the 2023.12.1 milestone Dec 7, 2023
@jpbede
Copy link
Member

jpbede commented Dec 7, 2023

Thanks, I would have done that in a few seconds also 👍 It was the default refresh interval of the binary sensor platform I used here

@jpbede
Copy link
Member

jpbede commented Dec 7, 2023

Please update the documentation aswell

@nohn
Copy link
Contributor Author

nohn commented Dec 7, 2023

Please update the documentation aswell

I've already prepared that in https://github.com/nohn/home-assistant.io/tree/sane_ping_interval. Should I open a PR for that as well?

@jpbede
Copy link
Member

jpbede commented Dec 7, 2023

Yes please

@jpbede jpbede changed the title set ping interval to 15 seconds instead of 5 minutes Set ping interval to 15 seconds instead of 5 minutes Dec 7, 2023
Copy link
Member

@jpbede jpbede left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@jpbede jpbede merged commit 22119a2 into home-assistant:dev Dec 7, 2023
23 checks passed
@Mariusthvdb
Copy link
Contributor

when we still had the scan_interval, we were told not to set this too high, as it might cause a lot of network traffic, and the reliability of this tracker on mobile phones is a bit questionable, as those tend to not use the network all the time in order to save battery.
scan_interval of 1 minutes was advised.

setting it to 15 secs by default now is rather high from that perspective, and now forces users that dont need that to disable polling and manually update by means of the automated homeassistant.update_entity service.

fully aware this is hard to please everyone, but flooding the network with those pings (especially when having more than a few devices pinged) cant be the final choice of the team?

the 15 secs timing seems a less than default requirement, and users needing that could easily set it in an automation.

re-adding the consider_home option might be better choice for everyone, as that truly blows to finetune this tracker.

@frenck
Copy link
Member

frenck commented Dec 7, 2023

@Mariusthvdb It was discussed and revised in: #105199

@Mariusthvdb
Copy link
Contributor

o sorry, I missed that, thanks.
tbh, I wonder if that interval is still not too high, (couldnt other traffic cause these pings to not even be finished before the next already is issued?) but I guess we will see.

anyways, thanks for the ping and re-adjusting.

@nohn
Copy link
Contributor Author

nohn commented Dec 7, 2023

o sorry, I missed that, thanks. tbh, I wonder if that interval is still not too high, (couldnt other traffic cause these pings to not even be finished before the next already is issued?) but I guess we will see.

anyways, thanks for the ping and re-adjusting.

The solution would be bringing all config options that existed in YAML back to the GUI.

@frenck
Copy link
Member

frenck commented Dec 7, 2023

The solution would be bringing all config options that existed in YAML back to the GUI.

Sorry, that won't be happening. We don't allow scan interval configuration in the UI.

../Frenck

@nohn
Copy link
Contributor Author

nohn commented Dec 7, 2023

Sorry, that won't be happening. We don't allow scan interval configuration in the UI.

../Frenck

What is the reason for that? Specifically for the ping sensor there are so many different scenarios where different intervals totally make sense and using automations for that is crude, to put it mildly.

@frenck
Copy link
Member

frenck commented Dec 7, 2023

Let's keep that out of scope for this PR, as it has nothing to do with the contents of the code reviewed here. If you want to learn and discuss these things, our Discord server and community forums are the right places.

../Frenck

@haforme
Copy link

haforme commented Dec 7, 2023

It appears that the HA development team is concerned that low ping times can affect the performance of HA, the network and the device its pinging and has settled on a 15 second interval in #105191. Maybe a solution would be to allow the users to configure the scan_interval but not set it lower than 15 seconds.

@frenck
Copy link
Member

frenck commented Dec 7, 2023

Maybe a solution would be to allow the users to configure the scan_interval but not set it lower than 15 seconds.

As per above, we don't allow that in our architecture.

Please also see: #105199

@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 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.

Ping Integration - Default Interval Too Long?
6 participants