3.5 KiB
3.5 KiB
name, description, version, author, license, platforms, metadata
| name | description | version | author | license | platforms | metadata | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| tasmota | Use when controlling Tasmota WiFi plugs. | 1.0.0 | user | MIT |
|
|
Tasmota Remote Control
Always-on Rules
1. Network discovery first
Before any command, discover the plug's current IP. Methods:
- Router client list (web UI)
ping 192.168.1.XXXsweep from your LAN subnet- Tailscale IP if Tailscale is running (
tailscale ip list) - Never guess an IP — verify first.
2. Local HTTP before MQTT
Start with plain HTTP commands (http://<ip>/?cmnd=...). Only fall back to MQTT if the app you used before required it.
3. Tailscale for remote access (preferred)
Since Tailscale is installed on this system, the recommended remote path is:
tailscale upon the controlling devicetailscale ip listto find the plug's Tailscale IP- Send HTTP commands to
http://<tailscale-ip>/as if on LAN - No port forwarding, no router reconfiguration needed.
4. Command syntax
Use the standard Tasmota HTTP API:
Power ON/Power OFFPower TOGGLEStatus 1to read current state- Full list at
http://<ip>/→cmndsection
5. Verify before acting
After sending a command, immediately read back status:
http://<ip>/→Status 1- Or
http://<ip>/cmnd?Powerto see the last sent command acknowledged
Pitfalls (generalizable rules + why)
- Pitfall: Stale IP after DHCP renewal — Why: Tasmota retains its last static IP config but may rejoin DHCP. Always re-discover after network restarts.
- Pitfall: MQTT broker not reachable — Why: Tasmota's built-in MQTT requires a running broker; if you haven't configured one, HTTP is the reliable fallback.
- Pitfall: Tailscale not running on both sides — Why: Remote access via Tailscale requires Tailscale active on the controlling device AND the network where the plug lives.
When to Use
- "Turn on/off the Tasmota plug"
- "Is the plug on or off?"
- "Set the plug to a specific state"
- "Check plug status"
Common Commands
List/Verify
# Discover plug IP first (replace subnet)
python3 -c "import ipaddress, subprocess; [print(ip) for ip in ipaddress.IPv4Network('192.168.1.0/24') if subprocess.run(['ping', '-c', '1', '-W', '1', str(ip)], capture_output=True).returncode == 0]"
# Check if Tailscale is active
tailscale status
tailscale ip list
Control
# Turn on
curl -s 'http://192.168.1.42/?cmnd=Power%20ON'
# Turn off
curl -s 'http://192.168.1.42/?cmnd=Power%20OFF'
# Toggle
curl -s 'http://192.168.1.42/?cmnd=Power%20TOGGLE'
# Read status
curl -s 'http://192.168.1.42/'
Via Tailscale (remote)
# Replace with Tailscale IP
curl -s 'http://100.103.XX.XX/?cmnd=Power%20ON'
References (depth for sometimes-needed detail)
references/api.md— Tasmota HTTP API command reference (full cmnd list)references/mqtt.md— Tasmota MQTT topic structure and broker setupreferences/tailscale.md— Tailscale setup for Tasmota remote access
Quick Probe Script
The following script verifies the plug is reachable before sending commands. Save as scripts/verify_tasmota.sh and make executable.
#!/usr/bin/env bash
# Verify Tasmota plug reachable via HTTP
set -e
IP="${1:-192.168.1.42}" # override via $1 or default
timeout 2 curl -s -o /dev/null -w '%{http_code}' "http://$IP/" | grep -q '^2' && echo "OK: $IP reachable" || echo "FAIL: $IP not reachable (check IP, Tailscale, or network)"