2023.12 Ping integration changes & scan_interval

The ping change is a step back imo :frowning: From a simple config.yaml like below to having to disable polling on the integration, then create an automation to define the custom scan interval!

device_tracker:
  - platform: ping
    hosts:
      conor: 192.168.0.37
    count: 5
    scan_interval: 120
23 Likes

I mentioned this in a Github issue and the developer said that they don’t want to have the scan interval in the user interface.
Scan interval missing in UI for Ping (ICMP) ¡ Issue #105041 ¡ home-assistant/core (github.com)

4 Likes

I agree, seems to just complicate things for the user and add more strain to the event machine - unless it was there already!

4 Likes

What is the scan interval for the UI configured ping sensor?

I previously specified 60 sec and need to know if I should use the non polling option.

It looks like it is set to an update interval of 5 minutes.

2 Likes

Its 5 mins - it says so in the new documentation.
Backward step imho

6 Likes

Well that’s a slap on the wrist for me. :flushed: Always check the documentation first!

Is there an alternative to ping? I use it to open my electric gates when I get in my car. I have a little card that is plugged into a usb port in my car. Ping pings it every second and, when it gets a response, it opens the gate (this also works when I get home). Losing the ability to choose ping frequency seems utterly absurd.

4 Likes

You can create an automation that will override the default 5 mins. It is referenced in the ping integration documentation.
I agree this is a bad move and creates additional work for users to maintain old functionality.

5 Likes

I made an automation for mine already. Basically it is just check to see if the state of the ping sensor has not changed in three minutes and then it runs it again. I also set it to check on Home Assistant start.
With 1 second checks it is probably going to be noisy in your log viewer though.

alias: 3 minute interval for ping sensor
description: ""
trigger:
  - platform: homeassistant
    event: start
  - platform: state
    entity_id:
      - binary_sensor.internet_sensor
    for:
      hours: 0
      minutes: 3
      seconds: 0
condition: []
action:
  - service: homeassistant.update_entity
    target:
      entity_id:
        - binary_sensor.internet_sensor
        - binary_sensor.secondary_pi_hole
        - binary_sensor.primary_pi_hole
    data: {}
mode: single
4 Likes

You can still customise ping frequency but it’s a lot more work! You create an automation and call the update entity service:

alias: "Presence Detection: Ping phones every 3 minutes"
description: ""
trigger:
  - platform: time_pattern
    minutes: /3
condition: []
action:
  - service: homeassistant.update_entity
    target:
      entity_id:
        - device_tracker.tb
        - device_tracker.conor_phone
    data: {}
mode: single
3 Likes

Thanks. I saw that. I just wonder if there’s another approach that would be possible. I also hugely resent the condescending comment in the release notes “If you are using custom interval and really need it…”. Of course I, and no doubt many many others, really need it. We haven’t just made it up. Who would think a fixed 5 minutes is a sensible “upgrade”! Also, would a custom automation actually cause a ping to my device? I need a very prompt response.

5 Likes

But… Why? It’s not like this is an integration with a huge cluttered interface and we need to cut out the least relevant ones.
of course I want control over how often the pings are sent. Why do I need to make an automation just for that? Can someone explain that to me?

5 Likes

Probably to stop people setting it to silly values like 1 second and abusing servers they don’t own.

This approach may cause less flexibility. This is an “Apple approach”: we we’ll ban this, we’ll disable this, we’ll not implement this - because we know better what users need.
A simple check like “do not allow setting values < xxx” would be sufficient.

9 Likes

I’m not sure why. I personally would have really liked it to still be available. Perhaps it could have defaulted to a certain amount and then let us change the amount. If they add a tooltip explaining it and then conditionally show a warning if the user sets it below 30 seconds, then I think it could have worked really well.

Uptime Kuma as an example lets you set pings all the way down to 20 seconds.
Unless you’re adding heaps of devices to ping, most servers and devices should be able to handle frequent pinging.

5 Likes

This is correct. We got a lot of complaints in the past of people who used scan interval on any integration to hammer devices and services until they got Home Assistant blocked. The scan_interval option has been deprecated for a long time and is not allowed to be set via the UI. It is still possible for people, but you got to put in effort and hopefully know better what you’re doing to prevent abuse.

9 Likes

Ok, but if a user certainly knows that some value of “scan_interval” (like “60 sec”) will not harm the system - why not to allow him to set it?
This is HIS system. If he wants to break it - it’s his choice.
Once again, we can limit a value to (let’s say) 60 sec.

People are very inventive with blaming HA. For instance, they put a non-existing option_X to card_Y - and get angry “why it does not work”.

1 Like

Yeah but the server they are pinging may not be theirs.

So raising the bar to do this (as explained by balloob) is a good compromise IMO.

3 Likes

Hmm, do not think that this is a majority of using ping.
Well, I quite OK with deprecating “scan_interval” - using automations anyway. But imho this is reducing flexibility.