This project monitors your internet connection for outages and automatically power-cycles your ISP modem via a Kasa smart plug if an outage is detected. It uses python-kasa for local control of the Kasa plug, ensuring the solution works even if the internet is down.
The following environment variables can be configured in the docker-compose.yml file:
| Variable | Default | Description |
|---|---|---|
PLUG_NAME | MySmartPlug | Local name of the Kasa smart plug. |
CHECK_INTERVAL | 60 | Time (in seconds) between internet connectivity checks. |
FAILURE_THRESHOLD | 3 | Number of consecutive connectivity check failures required to trigger a power cycle. |
RETRY_INTERVAL | 300 | Time (in seconds) to wait before rechecking after a power cycle. |
CHECK_HOSTS | 8.8.8.8,1.1.1.1 | Comma-separated list of hosts to ping for internet connectivity verification. |
Connectivity Check:
8.8.8.8, 1.1.1.1) to verify internet connectivity.Failure Detection:
FAILURE_THRESHOLD, the system power-cycles the modem by toggling the Kasa plug off and on.Retry Mechanism:
RETRY_INTERVAL before resuming connectivity checks.To view logs, run:
docker logs -f internet-monitor
Local Access to Kasa Plug: Ensure your Kasa smart plug is connected to the same network as the server running this application. Assign a static IP to the plug via your router.
Docker Host Network:
The container uses network_mode: host to communicate with devices on your local network. This is required for local control of the Kasa plug.
Adjusting Host Checks:
Add or remove IPs from the CHECK_HOSTS list to optimize connectivity checks for your region or ISP.
Feel free to submit issues or pull requests to improve this project.
This project is licensed under the MIT License. See the LICENSE file for more details.
Content type
Image
Digest
sha256:de27a68e9…
Size
33.7 MB
Last updated
2 months ago
docker pull ptsimpso/isp_monitor