A Python utility that monitors internet connectivity by pinging an external address and controls a Tasmota power plug when connectivity fails.
- Monitors internet connectivity by pinging a configurable external address
- Automatically cycles power to a Tasmota smart plug when connectivity fails
- Configurable ping interval, failure threshold, and restart delay
- Runs as a systemd service for automatic startup on boot
- Comprehensive logging
This tool is particularly useful for:
- Remote locations with unreliable internet connections
- Campers, RVs, or mobile setups that need automatic internet recovery
- Automatically resetting modems/routers when internet connectivity fails
- Any scenario where you need to power cycle a device when connectivity is lost
-
Clone this repository:
git clone https://github.com/yourusername/RouterPing.git cd RouterPing
-
Edit the configuration file
router_ping.ini
to match your setup:[General] ping_address = 8.8.8.8 ping_interval = 60 max_failures = 3 ping_timeout = 2 restart_delay = 30 [Tasmota] plug_ip = 192.168.1.100 username = password = relay = 1
-
Run the installation script as root:
sudo ./install.sh
ping_address
: The address to ping (e.g., google.com or 8.8.8.8)ping_interval
: Time between pings in secondsmax_failures
: Number of consecutive failed pings before toggling the plugping_timeout
: Timeout for each ping in secondsrestart_delay
: Time to wait in seconds before turning the plug back on
plug_ip
: IP address of the Tasmota power plugusername
: Username for Tasmota device (if required)password
: Password for Tasmota device (if required)relay
: Relay number (usually 1)
Check the service status:
systemctl status router_ping.service
View logs:
journalctl -u router_ping.service
or
cat /var/log/router_ping.log
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.