An automatic internet watchdog that locally reboots the supported T-Mobile home internet gateways.
10K+
TMHI Gateway Watchdog is a lightweight, self-hosted Docker application that monitors your internet connection and automatically reboots a supported T-Mobile Home Internet gateway when the cellular connection becomes unresponsive.
It is designed for the situation where your devices remain connected to Wi-Fi or Ethernet and the gateway is still reachable locally at 192.168.12.1, but the gateway has lost internet connectivity to the T-Mobile cellular network.
Instead of requiring someone to unplug the gateway, TMHI Gateway Watchdog signs in through the gateway's local management API and requests a reboot automatically.
TMHI Gateway Watchdog currently supports gateways that use the newer local TMI/v1 API:
The Nokia 5G21 uses a different CGI-based API and is not currently supported.
Gateway compatibility may change if T-Mobile releases firmware updates that modify the local API.
docker pull kevina1724/tmhi-watchdog:latest
Available architectures:
linux/amd64linux/arm64Create a new directory:
mkdir -p tmhi-watchdog
cd tmhi-watchdog
Create an environment file:
nano .env
Paste the following configuration:
# Dashboard/API port
WEB_PORT=8088
# T-Mobile gateway local API
GATEWAY_HOST=192.168.12.1
GATEWAY_PORT=8080
GATEWAY_USERNAME=admin
GATEWAY_PASSWORD=replace-with-your-gateway-admin-password
# Keep enabled during initial setup
DRY_RUN=true
WATCHDOG_ENABLED=true
# Internet monitoring
CHECK_INTERVAL_SECONDS=20
FAILURE_THRESHOLD_SECONDS=180
STARTUP_GRACE_SECONDS=60
# Reboot-loop protection
POST_REBOOT_GRACE_SECONDS=480
REBOOT_COOLDOWN_SECONDS=1800
MAX_REBOOTS_PER_24H=3
# Connectivity probes
PROBE_TIMEOUT_SECONDS=5
MINIMUM_SUCCESSFUL_PROBES=2
PROBE_URLS=https://connectivitycheck.gstatic.com/generate_204,https://www.cloudflare.com/cdn-cgi/trace,http://www.msftconnecttest.com/connecttest.txt
# Protects manual API actions
API_TOKEN=replace-with-a-long-random-token
# Storage and logging
DATABASE_PATH=/data/watchdog.db
LOG_LEVEL=INFO
# Optional comma-separated origins for a separate frontend
CORS_ORIGINS=
Generate a secure API token:
openssl rand -hex 32
Copy the generated value into:
API_TOKEN=your-generated-token
Create docker-compose.yml:
nano docker-compose.yml
Paste:
services:
tmhi-watchdog:
image: kevina1724/tmhi-watchdog:latest
container_name: tmhi-watchdog
restart: unless-stopped
pull_policy: always
env_file:
- .env
ports:
- "${WEB_PORT:-8088}:8000"
volumes:
- tmhi_watchdog_data:/data
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
volumes:
tmhi_watchdog_data:
Start the container:
docker compose up -d
Check its status:
docker compose ps
View logs:
docker compose logs -f tmhi-watchdog
Open the dashboard from another device on your network:
http://YOUR-DOCKER-SERVER-IP:8088
Find your Docker server's IP on Linux:
hostname -I
Useful URLs:
http://SERVER-IP:8088/http://SERVER-IP:8088/healthzhttp://SERVER-IP:8088/docshttp://SERVER-IP:8088/api/statushttp://SERVER-IP:8088/api/configDo not use localhost from your phone or another computer. Use the Docker server's LAN IP address.
Keep this enabled during setup:
DRY_RUN=true
Dry-run mode allows the application to detect outages and test reboot decisions without actually rebooting the gateway.
curl http://127.0.0.1:8088/healthz
docker compose exec tmhi-watchdog \
python -m tmhi_watchdog.cli connectivity
A working internet connection should report:
{
"online": true
}
docker compose exec tmhi-watchdog \
python -m tmhi_watchdog.cli gateway-test
Expected result:
{
"reachable": true,
"authenticated": true
}
reachable: true means the container can reach the gateway locally.authenticated: true means the configured administrator password works.Retrieve your API token:
TOKEN=$(sed -n 's/^API_TOKEN=//p' .env)
Send a manual reboot request:
curl -X POST \
-H "X-API-Token: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"force":false}' \
http://127.0.0.1:8088/api/reboot
With DRY_RUN=true, the gateway will not reboot.
Check the logs:
docker compose logs --tail=100 tmhi-watchdog
You should see a message similar to:
DRY RUN: gateway reboot would have been requested
Only enable real reboots after both the connectivity test and gateway authentication test succeed.
Edit .env:
DRY_RUN=false
Recreate the container:
docker compose up -d --force-recreate
Confirm the setting:
curl http://127.0.0.1:8088/api/config
The response should include:
{
"dry_run": false
}
Perform your first real reboot test while you are physically home and able to manually recover the gateway if necessary.
By default, TMHI Gateway Watchdog:
| Variable | Default | Description |
|---|---|---|
WEB_PORT | 8088 | Dashboard and API port on the Docker host |
GATEWAY_HOST | 192.168.12.1 | Local gateway address |
GATEWAY_PORT | 8080 | Local gateway API port |
GATEWAY_USERNAME | admin | Gateway administrator username |
GATEWAY_PASSWORD | Required | Gateway administrator password |
DRY_RUN | true | Prevents actual reboot commands |
WATCHDOG_ENABLED | true | Enables automatic monitoring |
CHECK_INTERVAL_SECONDS | 20 | Delay between connectivity rounds |
FAILURE_THRESHOLD_SECONDS | 180 | Continuous outage time before reboot consideration |
STARTUP_GRACE_SECONDS | 60 | Delay before monitoring begins |
POST_REBOOT_GRACE_SECONDS | 480 | Recovery time after a reboot |
REBOOT_COOLDOWN_SECONDS | 1800 | Minimum delay between reboot attempts |
MAX_REBOOTS_PER_24H | 3 | Maximum automatic reboots per rolling day |
PROBE_TIMEOUT_SECONDS | 5 | Timeout for each connectivity request |
MINIMUM_SUCCESSFUL_PROBES | 2 | Successful probes needed to consider internet online |
PROBE_URLS | Three defaults | Comma-separated connectivity test URLs |
API_TOKEN | Required | Protects manual API actions |
DATABASE_PATH | /data/watchdog.db | SQLite database location |
LOG_LEVEL | INFO | Application logging level |
CORS_ORIGINS | Empty | Allowed origins for a separate frontend |
Pull the newest image:
docker compose pull
Recreate the container:
docker compose up -d
Remove unused older images:
docker image prune -f
docker compose down
The event database remains stored in the Docker volume.
To also permanently delete the stored event database:
docker compose down -v
Check the container:
docker compose ps
Check the logs:
docker compose logs --tail=100 tmhi-watchdog
Verify the port is listening:
curl http://127.0.0.1:8088/healthz
Verify that:
192.168.12.18080adminAfter changing .env, recreate the container:
docker compose up -d --force-recreate
Confirm:
DRY_RUN=false
WATCHDOG_ENABLED=true
Review the logs for:
Change:
WEB_PORT=8090
Recreate the container:
docker compose up -d --force-recreate
Then open:
http://SERVER-IP:8090
8088 directly to the public internet..env to GitHub.API_TOKEN.This application can reboot the gateway only when:
It cannot reboot a gateway that is completely frozen, powered off, or no longer reachable through the local network. A locally controlled power relay may be useful as a hardware fallback.
GitHub:
https://github.com/kevin1724/tmhi-watchdog
Docker Hub:
https://hub.docker.com/r/kevina1724/tmhi-watchdog
TMHI Gateway Watchdog is an independent community project.
It is not affiliated with, endorsed by, maintained by, or supported by T-Mobile, Arcadyan, Sagemcom, Sercomm, or the HINT Control project.
Use this software at your own risk. Gateway firmware updates may change or disable the local management API.
MIT License
Content type
Image
Digest
sha256:a45596d28…
Size
53.8 MB
Last updated
2 months ago
docker pull kevina1724/tmhi-watchdog