In this guide i’ll explain how to use fping command to check network devices status (online/offline) and your internet connection status under custom component i have created.
but first, make sure fping is installed on your system using the following command:
sudo apt-get install fping --yes
Now, under your configuration folder create new directory and name it “custom_components”, and inside create another one and name it “sensor”.
Next, create new file and name it “device_status.py” and the result should look like this:
add the following text to “device_status.py”, save it and restart Home-Assistant.
Now we will add the component configuration into configuration.yaml file by adding the following lines of code:
In this example we are using fping and pinging 184.108.40.206 (Google public DNS).
if there will be response it means that the internet connection is up, otherwise your internet connection is down.
Here is another example using Multiple device monitoring: