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

Ping Integration - Default Interval Too Long? #105163

Closed
XtremeOwnageDotCom opened this issue Dec 6, 2023 · 26 comments · Fixed by #105191
Closed

Ping Integration - Default Interval Too Long? #105163

XtremeOwnageDotCom opened this issue Dec 6, 2023 · 26 comments · Fixed by #105191
Assignees

Comments

@XtremeOwnageDotCom
Copy link

XtremeOwnageDotCom commented Dec 6, 2023

The problem

Let's think of the use-cases for a ping sensor.

You want to use it to see when a certain device is online. You want to trigger an automation based on that device being online.

Perhaps, you just want to see if your internet is up.

In basically every use-case I can think of for using a ping, a 5 minute interval is EXTREMELY long. Its too long to be useful for monitoring connectivity, its too long to be used for triggering automations based on devices turning on.....

And- waiting 5 minutes for your "presence detection" to function, is not very keen either.

I honestly, cannot think of a single valid use-case where only pinging once every 5 minutes seemed like a good idea.

Now, previously, this was not an issue as the interval was adjustable via the configuration. However, now, its defaulted to every 5 minutes, per the documentation.

While, the documentation does have steps for how to create an automation to execute your ping for you....

I do not believe this is user friendly, or the best default value that can be specified here.

ICMP is extremely low bandwidth, and uses extremely few resources.

I vote this should be moved to a much more sane interval, of say, 5 seconds, instead of 5 minutes.

What version of Home Assistant Core has the issue?

2023.12.0

What was the last working version of Home Assistant Core?

2023.11.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ping

Link to integration documentation on our website

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

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

@home-assistant
Copy link

home-assistant bot commented Dec 6, 2023

Hey there @jpbede, mind taking a look at this issue 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 issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign ping 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)


ping documentation
ping source
(message by IssueLinks)

@Claudio1L
Copy link

The problem

Let's think of the use-cases for a ping sensor.

You want to use it to see when a certain device is online. You want to trigger an automation based on that device being online.

Perhaps, you just want to see if your internet is up.

In basically every use-case I can think of for using a ping, a 5 minute interval is EXTREMELY long. Its too long to be useful for monitoring connectivity, its too long to be used for triggering automations based on devices turning on.....

And- waiting 5 minutes for your "presence detection" to function, is not very keen either.

I honestly, cannot think of a single valid use-case where only pinging once every 5 minutes seemed like a good idea.

Now, previously, this was not an issue as the interval was adjustable via the configuration. However, now, its defaulted to every 5 minutes, per the documentation.

While, the documentation does have steps for how to create an automation to execute your ping for you....

I do not believe this is user friendly, or the best default value that can be specified here.

ICMP is extremely low bandwidth, and uses extremely few resources.

I vote this should be moved to a much more sane interval, of say, 5 seconds, instead of 5 minutes.

What version of Home Assistant Core has the issue?

2023.12.0

What was the last working version of Home Assistant Core?

2023.11.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ping

Link to integration documentation on our website

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

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

can't agree more

@GitHubGio70
Copy link

GitHubGio70 commented Dec 6, 2023

can't agree more

Need configurable polling, base time 5 sec

@Smandurlo
Copy link

The gui version is not flexible as the yaml is. What is funny to me is the gui should be more easy to manage, but in reality it gets more cumbersome. Now we have to create an automation to updates the entities. Fine. If I add another ping entity I need to update the automation. And if I want the device tracker only, i have to disable the ping (enabled by default) and enable the device tracker (disabled by default). And for the device tracker there is not the consider home option. Should I make another automation for it? I really think it should be reconsidered with more options like what kind of ping to enable while creating the entity, and a custom update and consider home time for the integration.

@ABEIDO
Copy link

ABEIDO commented Dec 6, 2023

Nice to see ping coming into the gui.

But im using alot of ping sensors both for my servers and for my other stuff like tvs and so on. Never had any problems with those.

But now with the 5 min, its way too long to get my automations running ok. Example i have a movie mode that switches hdmi input and other functions when HTPC is answering ping, now i must must wait 5 min? And sure you could do what was suggested with homeassistant.update_entity service. But that feels totally backwards and not user friendly, especially as the funtionality was there before as one could set it in the sensor config.

I have diffrent intervals on diffrent ping sensors depending what im tracking and automating and i think people have alot of different needs. A configurable polling is needed. As in my usecase a fixed interval on 60 secs would be ok but in others not ok

Also when adding and target by adding both device_tracker(disabled) and ping (enabled) its gets more cluttered, i t would be better if you choose between the 2 when adding what you want and only add that.

As in the Asus Router integration its possible to set custom intervals and also diffrent intervals on diffrent entities., can even tweak with the consider home if device tracker is used via that integration
https://github.com/Vaskivskyi/ha-asusrouter

@Smandurlo
Copy link

Same with fritzbox, but not the scanning time for entity

@haforme
Copy link

haforme commented Dec 7, 2023

I use the five-minute interval myself for logic that I wrote that declares a device off-line are a certain number of sequential tests that fail to screen out false positives, but configurability is the key to covering the needs of many. My vote is to either move it back to YAML or add the ability to set the scan time via the GUI. That way all of us can configure what we need. Need I say any more?

@ABEIDO
Copy link

ABEIDO commented Dec 7, 2023

I testing a workaround to stay in yaml and thereby be able to configure interval:

Before with ping platform:

binary_sensor server:
    platform: ping
    host: xx.xx.xx.xx
    name: SERVER
    count: 2
    scan_interval: 60

After with commandline instead:

command_line:
- binary_sensor:
    name: SERVER
    unique_id: binary_sensor_server
    icon: mdi:power
    device_class: connectivity
    command: ping -W 1 -c 1 xx.xx.xx.xx > /dev/null 2>&1 && echo ON|| echo OFF
    scan_interval: 60
    value_template: '{{ value }}'

Is there any downside to doing like this until ping is adjusted or if it stays like this?

@Solarunit
Copy link

I was using 30 sec interval ping for pinging local PC in automation.
I don't like that this option is missing from the UI now. I was trying the workaround from the documentation but I don't see any input field I can put my custom value (some screenshots please how to do it?)

I also not sure how to use this new automation with custom interval in my old automation 🤷

nohn added a commit to nohn/homeassistant-core that referenced this issue Dec 7, 2023
nohn added a commit to nohn/home-assistant.io that referenced this issue Dec 7, 2023
@jpbede
Copy link
Member

jpbede commented Dec 7, 2023

I vote this should be moved to a much more sane interval, of say, 5 seconds, instead of 5 minutes.

Yes, I agree, it was the refresh interval of the ping binary sensor I used here, bad decision, happens. #105191 will fix this in the next patch release.

And for the device tracker there is not the consider home option.

There is already a PR (#104881) for it, which hasn't made it into this release.

@nohn
Copy link
Contributor

nohn commented Dec 7, 2023

Not sure whether current or next is correct, my guess was current: home-assistant/home-assistant.io#30192

If next is the correct documentation branch, I'll open one there.

jpbede pushed a commit that referenced this issue Dec 7, 2023
set ping interval to a more sane value of 15 seconds instead of 5 minutes. fixes #105163
@jladefoged
Copy link

Curious:
Why not let users set a custom ping interval in the UI?
I've have ping sensors set to 10, 30 and 60 seconds so I need to make automations for all of them anyway regardless of the default interval.
Adding a ping sensor in the UI, disabling a setting in the integration and creating an automation to actually making the sensor functional don't seem very user friendly.

@jpbede
Copy link
Member

jpbede commented Dec 7, 2023

There is a very long history around the scan_interval and why we don't want it in the UI anymore.

After the scan_interval was introduced many, many releases ago, people started to reduce the intervals to low values like one second. Hammering external services, causes third parties to start blocking Home Assistant users, local systems being overloaded and much more.

Next, we saw different extensions on the scan_interval e.g. nightly scan intervals for devices not being updated at night, different scan intervals for cars when they are home or on the road and so on. The list is long.

Don't get us wrong, we see the need and sure there are tons of use cases for scan_interval, but we need to find common sense on this like having a sane interval out of the box for each integration and it prevents users to fill in a option they don't understand. Making it a service or make use of the homeassistant.update_entity service is sure a little more complex and maybe not that user friendly but it provides the maximum of flexibility then having tons of different scan_interval options.

@Smandurlo
Copy link

I can understand the too fast scan interval problem, but people that don't fully understand the problem, will replicate it as soon as they understand how to to do it again (eg telling them to make an automation to update the entity). Maybe, but I am not an expert, you could just add the scan_interval with a minimum that doesn't create any problem for each integration and let people increase it as they need to and add a disclaimer. I mean, if they don't understand something, we should help them to understand thing otherwise we end like Apple

@ABEIDO
Copy link

ABEIDO commented Dec 7, 2023

Yeah thats a good premise to start with, educate/guide before limiting a user.

Running a custom update on the entity with lower intervals will im my book cause exactly the same effect but with a bit more hassle to the user. So even if you find a way to limit the user the user will always find a way around any limits put on them.

Another example on a workaround i pasted is the one above by using commandline then ping in the command will also create the same effect you are trying to avoid by the limitation on interval on the more user friendly ui ping setup.

As i feel that the proposed 15 secs is to low in many of my usecases i will most likely do the above.

@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.

@tvdsluijs
Copy link

I just saw this in my Home Assistant after I just updated it

The Ping YAML configuration is being removed
This stops working in version 2024.6.0. Please address before upgrading.
Configuring Ping using YAML is being removed.

Now what?

@XtremeOwnageDotCom
Copy link
Author

I just saw this in my Home Assistant after I just updated it

The Ping YAML configuration is being removed This stops working in version 2024.6.0. Please address before upgrading. Configuring Ping using YAML is being removed.

Now what?

Now, you follow the directions documented in the GUI (with a link to more external documentation), and remove the ping sensors from your configuration.yaml.

If, your concern is regarding the interval, all of the details you need to know are listed above.

Otherwise, if your ping sensor is not working as expected and documented, I'd recommend opening a new ticket.

@tvdsluijs
Copy link

Now, you follow the directions documented in the GUI (with a link to more external documentation), and remove the ping sensors from your configuration.yaml.

If, your concern is regarding the interval, all of the details you need to know are listed above.

Otherwise, if your ping sensor is not working as expected and documented, I'd recommend opening a new ticket.

Ohhh great, how come I never thought of that. Thank you for pointing me in the right direction.

@AllardKatan
Copy link

There is a very long history around the scan_interval and why we don't want it in the UI anymore.

After the scan_interval was introduced many, many releases ago, people started to reduce the intervals to low values like one second. Hammering external services, causes third parties to start blocking Home Assistant users, local systems being overloaded and much more.

Next, we saw different extensions on the scan_interval e.g. nightly scan intervals for devices not being updated at night, different scan intervals for cars when they are home or on the road and so on. The list is long.

Don't get us wrong, we see the need and sure there are tons of use cases for scan_interval, but we need to find common sense on this like having a sane interval out of the box for each integration and it prevents users to fill in a option they don't understand. Making it a service or make use of the homeassistant.update_entity service is sure a little more complex and maybe not that user friendly but it provides the maximum of flexibility then having tons of different scan_interval options.

I understand this reasoning but I wholeheartedly disagree with the method chosen here. PLEASE do it something like this:

  • Allow configurable ping times per device from the UI, with a minimum setting of e.g. 15 seconds
  • introduce an 'advanced options' tab on the UI, where you can check 'allow shorter times', which gives you a warning dialog if you check it
  • Also, either add a 'use ping as device tracker' option to the ping UI or add a UI configuration for device trackers. Currently, the deprecation of ping in YAML also removed the possibility to use ping as a platform in YAML-defined device trackers without breaking the consider_home and interval functionalities that are essential to device trackers.

@danmrossi
Copy link

I've been trying in my own thread to get the old functionality back and seem to be hitting a brick wall there too. i only updated to 2023.12.0 from 2023.11.3 because i wanted the fix from the frontend section that fixed issues with when creating an automation and decide to back out of it instead of saving and it kept it around so then you gotta delete it yourself.

i am all for change and what not but not when functionality is lost or certain functions is locked out from the end user and then just getting told to read the documentation, like it's some bloody bible and when the going gets tough the responses disappear.

I cannot understand their beloved documentation and i am an IT guy for the past 25 years by trade, i setup complex networks for million dollar companirs and firewalls and do cybersecurity and whatnot and even i cant get my head around the documentation, how is anyone else in the HA world unless your a programmer.

Like how does this response help anyone from "Joost Lekkerkerker"

"Look, setting a custom update interval isn't an issue specific for a single integration. To avoid having every integration implement their own way of doing scan interval, we have made something that is way more flexible that will suite probably everyone's need. The update_entity service.

This service gives you way more freedom than just an inpout field when configuring an integration.

  1. you can change the update interval whenever you want...."

This guy rambles on and on

Suffice to say just get told to check the documentation and that i have some figuring out to do and they close my ticket on me.

Great work guys. Not. YAML made sense and was easier this bullshit now. NO.

@danmrossi
Copy link

like in my example my "trigger" is related to what my yaml code had set for the ping interval amongst other things. what is calling a homeassistant.update_entity service going to do now that i cant ping my own bloody equipment WHEN I WANT IT TO

@nohn
Copy link
Contributor

nohn commented Dec 8, 2023

Comments on closed tickets are unlikely to be read. Also, please let's keep it professional here.

I have opened a discussion over in the Home Assistant community, whether home assistant is directced for a good direction: https://community.home-assistant.io/t/is-home-assistant-shifting-towards-a-different-audience/652238

frenck pushed a commit that referenced this issue Dec 8, 2023
set ping interval to a more sane value of 15 seconds instead of 5 minutes. fixes #105163
@Atari59
Copy link

Atari59 commented Dec 9, 2023

with the Ping GUI integration de State of the entity also changes from "connected"(or Disconnected) to "home". IMHO the Home state is not a correct connectivity state

@Smandurlo
Copy link

Smandurlo commented Dec 9, 2023 via email

@Solarunit
Copy link

Solarunit commented Dec 9, 2023

The only problem with ping interval was external pinging services.
Why not introduce a new ping integration for pinging only local devices on you LAN? 💡
Where you can set whatever ping interval you want.
This should solve the problem, right?

@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2024
enioo22 pushed a commit to enioo22/bzutech-core that referenced this issue Jan 9, 2024
…105191)

set ping interval to a more sane value of 15 seconds instead of 5 minutes. fixes home-assistant#105163
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.