sudo pip install pyping
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from skplugins import addValuePlugin, addEventPlugin, addValue, addEvent
from skplugins.checker.network.ping import ping
server = '192.168.1.1'
while True:
# Check sunshine
plugin = ping(destination="8.8.8.8", count=1)
addValuePlugin(server, 'home:internet:available', plugin)
#Sleep
time.sleep(5)