A simple Python tool to control WattBox outlets via HTTP/HTTPS.
- Auto-detects HTTP Basic or Digest Authentication
- Configurable via CLI arguments, environment variables, or
.envfile - Automatically follows redirects (HTTP → HTTPS)
- Ignores HTTPS certificate verification issues
- Control outlets: on, off, or reset
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- (Optional) Create a
.envfile for your credentials:
WATTBOX_URL=http://172.16.19.184
WATTBOX_USERNAME=your_username
WATTBOX_PASSWORD=your_passwordWith credentials in .env file:
python wattbox_controller.py -o 3 -a off
python wattbox_controller.py -o 3 -a on
python wattbox_controller.py -o 3 -a resetpython wattbox_controller.py --url http://172.16.19.184 --username admin --password secret -o 3 -a offAvailable Options:
--url,-u: WattBox base URL (default:http://172.16.19.184orWATTBOX_URL)--username: Username (default:wattboxorWATTBOX_USERNAME)--password: Password (default:wattboxorWATTBOX_PASSWORD)--outlet,-o: Outlet number (required)--action,-a: Action -on,off, orreset(default:off)--verbose,-v: Show detailed output--help,-h: Show help message
- Command line arguments (highest priority)
.envfile variables- Environment variables
- Default values
- Python 3.6+
- requests
- urllib3
- python-dotenv
- SSL certificate verification is disabled for self-signed certificates
- Store credentials in
.envfile (already in.gitignore) - Avoid passing credentials via command line in shared environments