Skip to content

ikidd/RouterPing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RouterPing

A Python utility that monitors internet connectivity by pinging an external address and controls a Tasmota power plug when connectivity fails.

Features

  • 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

Use Case

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

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/RouterPing.git
    cd RouterPing
    
  2. 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
    
  3. Run the installation script as root:

    sudo ./install.sh
    

Configuration Options

General Section

  • ping_address: The address to ping (e.g., google.com or 8.8.8.8)
  • ping_interval: Time between pings in seconds
  • max_failures: Number of consecutive failed pings before toggling the plug
  • ping_timeout: Timeout for each ping in seconds
  • restart_delay: Time to wait in seconds before turning the plug back on

Tasmota Section

  • plug_ip: IP address of the Tasmota power plug
  • username: Username for Tasmota device (if required)
  • password: Password for Tasmota device (if required)
  • relay: Relay number (usually 1)

Monitoring

Check the service status:

systemctl status router_ping.service

View logs:

journalctl -u router_ping.service

or

cat /var/log/router_ping.log

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published