Function to check internet status

Hi I’m new to Hass.io. Is there a way to check internet status in Hass.io?
I want to reboot my router if Internet is not available in x minutes using a z-wave plug…

Thanks!

1 Like

You might be able to use the ping device tracker to track the router then use that to determine if the internet is available.

This isn’t exactly what you were asking for but here is something I use. It monitors my HA instance’s website and alerts me if it goes down. Fairly close to real time.

I also have the Speedtest component that measures my connection and if it goes down will return an error of sorts:

Thanks, I’ll see if this suits my needs :slight_smile:
About Speedtest, can this monitor internet connection in real time?

Thanks, I tried to add a binary sensor pinging 8.8.8.8 (google’s dns) but it didn’t get positive response.

Well I would do as I said and create a ping device tracker for the router.

3 Likes

Do you know if this sensor polls constantly? Or every minute, every 5 minutes?

Edit: Never mind, I found out that the default scan interval is 5 minutes. I changed this by adding scan_interval: 5

# Ping Google 
binary_sensor:
  - platform: ping
    host: 8.8.8.8
    scan_interval: 5
1 Like

any luck in solving this?

I’ve been using it for a month or two now. Never a problem. Set up exactly the way thorbj’s post shows.

I am using node-red-contrib-isonline node for checking network status. It is reliable and good.
If anybody wants to look into it please use the below link

5 Likes

…And suddenly it’s stopped working.

I’m getting “Entity not available: binary_sensor.internet_connection.”

And it appears to be true. I can’t find any reference to this entity.

My Configuration.yaml file contains the following, which hasn’t changed since May:

# Internet Status: ping host 8.8.8.8 with 2 packets every 60 seconds.
binary_sensor:
  - platform: ping
    host: 8.8.8.8
    count: 2
    scan_interval: 60
    name: Internet_Connection

Anyone else see this? Any idea where to look to find the problem?

I confirmed that I can ping the host 8.8.8.8 from other machines on my network, so it’s not that.

What’s your HA version? It works as expected on 0.101.3.

… but you have updated your HA since, haven’t you? :wink:

1 Like

Yeah, and I’d made some configuration.yaml changes which inadvertently messed up the ping sensor definition. Sorry, I should have posted that. I didn’t find it for a while, so I’d sort of forgotten the post, and since nobody replied I figured it would die on its own accord.