Home Assistant Internet Monitoring: Packet Loss, Latency, and Automatic Modem Reboots

I’ve been having ongoing issues with my internet service provider. At seemingly random times throughout the day, I’ll start seeing high packet loss or the connection will drop entirely. In most cases, a simple modem reboot immediately resolves it, which strongly suggests the problem isn’t persistent infrastructure failure but something transient along the path.

Rather than manually power-cycling my modem every time this happens, I built a flow in Node-RED to continuously monitor average latency and packet loss and automatically reboot the modem using a smart outlet when conditions degrade beyond a defined threshold.

The system probes six different endpoints: Google and Cloudflare as external baselines, my modem and router to verify local health, and two off-network servers I control (one free Oracle instance and one paid VPS). By tracking the same metrics across all of these targets, I can clearly distinguish between issues originating inside my network and problems occurring downstream at the ISP level.

Home Assistant Dashboard

Requirements

  • Node-RED installed
  • Home Assistant installed
  • Some sort of smart outlet with your modem plugged into it and added to Home Assistant so your smart home can control it
    • If you use your own WiFi AP and Router equipment downstream of the modem/ONT I highly recommend KAUF outlets. They run ESPHome so you have complete control of the firmware (no spying!) and they come with tons of settings out of the box (disable the LED, disable the physical button, what to do when power is restored, how often to report power usage, etc).
    • If your modem/ONT is also your WiFi access point you should use a Zigbee or Z-Wave based outlet so Home Assistant can still communicate with it even if the WiFi is down.

Node-RED Flows

This is broken up into two separate flows. One handles the sending of the ping requests and then logging it to Home Assistant. The other handles restarting the Modem.

Ping & Latency Tracking Flow

Ping & Latency Tracking Node-RED Flow

The flow can be found here.

This flow outputs the Average Ping & Packet Loss into Home Assistant for each configured host. It also outputs the current internet status (on or off) for the next flow. It does this by seeing if all ping requests over the 10 second period failed for some select hosts.

If all you want is a nice dashboard that shows ping data and the current internet status you can just import this and ignore the next flow.

If you want to use additional hosts besides just Google and CloudFlare you can modify the Set list of hosts node. This node contains msg.payload which is a list of hosts to ping and msg.internet_connectivity_hosts which is a list of hosts that if all ping attempts fail for all of the listed hosts we mark the current internet status as false.

Modifying the Set list of hosts node

Auto power cycle modem flow

Auto power cycle modem flow

The flow can be found here.

It monitors multiple network health indicators and automatically power cycles your modem when issues are detected, including sustained outages (2+ minutes), intermittent connectivity problems (3+ drops in 5 minutes), remote host packet loss, and router-to-modem packet loss.

The flow includes a centralized notification system via a link input node that can be configured to send alerts through your preferred method. It's highly recommended to use notification systems that remain available locally during internet outages - cloud-based services like external push notifications or SMS will fail when your internet is down. I personally use a self-hosted Matrix server that's always accessible on my LAN, combined with TTS announcements over my smart speakers, ensuring I'm always notified of connectivity issues and remediation attempts regardless of internet status.

Conclusion

The biggest motivation for building this wasn’t curiosity or graphing for its own sake. It was reliability. On more than one occasion, my internet went out while I was out of town and the modem locked up in a way it would never recover from on its own. The only solution at the time was asking a friend to physically come over and reboot it. That’s not something I ever want to rely on again.

With these automations in place, that problem is effectively solved. If the connection degrades or drops entirely, the modem is power-cycled automatically and service is restored without any manual intervention. In practice, the system has been working flawlessly. It does exactly what it’s supposed to do, and most of the time I don’t even notice it happening.

The historical data has also turned out to be just as valuable as the automation itself. Internet service providers are often reluctant to send a technician, and when they do, the issue frequently isn’t occurring at that exact moment. Being able to show clear, timestamped graphs of packet loss and latency across multiple endpoints makes it much harder to dismiss the problem as “everything looks fine on our end.” Instead of vague complaints, I can point to concrete evidence that something upstream is intermittently failing.

In the end, this setup has given me two things I didn’t have before: resilience and leverage. My connection recovers automatically when it breaks, and when it’s truly an ISP issue, I have the data to prove it.

If you found this useful or ended up building something similar, feel free to share your setup or ideas in the comments. And if this helped you and you’d like to say thanks, you can always buy me a coffee: