home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.87k stars 29.55k forks source link

Ping performance changes after every reboot #114314

Open dpremo-ul opened 5 months ago

dpremo-ul commented 5 months ago

The problem

I've seen this going on for at least several months. I wouldn't be surprised if it was happening before I noticed.

I have a Binary Sensor set up to track whether my HA has access to the internet. (I used to manage this in yaml but I think that's no longer supported. I think it pings 8.8.8.8 but I can't find where to verify that.)

I also have a sensor set up like this (I transcribed it so apologies if typos):

- platform: template
  sensors:
    ping:
      friendly_name: "Ping Average"
      unique_id: ping_average
      unit_of_measurement: 'ms'
      value_template: "{{ state_attr('binary_sensor.internet_connectivity', 'round_trip_time_avg') }}"

Here's the problem: Every time Home Assistant reboots -- whether because I update it or because of a power outage -- Ping Average performance is different. This is difficult to describe, so here's a screenshot:

image

In the image, I have History cards for 'Last 60 Minutes', 'Last 8 Hours', and 'Last 14 Days'. The 'Uptime' graph shows Home Assistant's uptime. Color change in this graph indicates that Home Assistant rebooted. The 'Ping Average' graph shows the Ping Average sensor.

In the 'Last 60 Minutes' card, you can see that from 9:48 AM to about 10:05 AM, Ping Average hovered around 15ms with steady spikes of about 65ms. Around 10:05 AM, the power goes out momentarily and Home Assistant reboots. (There's not enough time before the next reboot to spot a trend here.) Around 10:11 AM, power goes out again, and Home Assistant reboots. Here we have a new trend: Ping Average hovers around 15ms, but the spikes now max out at 30ms, and sometimes the spikes last longer.

In the 'Last 14 Days' card, more trends can be seen, and more HA reboots can be seen. Each time HA reboots, there is a different trend.

This suggests that none of the data is reliable. Why does Ping Average swing so much each time Home Assistant reboots?

What version of Home Assistant Core has the issue?

core-2024.3.3

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

Ping

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

- platform: template
  sensors:
    ping:
      friendly_name: "Ping Average"
      unique_id: ping_average
      unit_of_measurement: 'ms'
      value_template: "{{ state_attr('binary_sensor.internet_connectivity', 'round_trip_time_avg') }}"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 5 months ago

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)

issue-triage-workflows[bot] commented 2 months ago

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.

Otiel commented 2 months ago

I'm not sure if this is the same issue, but every time I reboot HA, all my ping integrations (a few local IP addresses and some on Internet) fail intermittently for about 2-3 hours, before stabilizing.

For instance:

Screenshot_20240625-182814

bdraco commented 2 months ago

Please see https://community.home-assistant.io/t/2024-5-tracking-down-instability-issues-caused-by-integrations/724441

Otiel commented 1 month ago

Thanks @bdraco. I have found my issue, and it wasn't caused by the Ping integration, even though it was the only sign that something wasn't right.

In case others are in the same boat: I had performance issues (with the Ping and also when browsing HA) due to a custom component, namely https://codeberg.org/raboof/ha-gpio, which I have replaced with https://github.com/jdeneef/ha_gpiod and that fixed my issue.