Skills von pixel: tasmota/SKILL.md tasmota/references tasmota/scripts

This commit is contained in:
2026-11-08 05:46:08 +01:00
parent 96b7776a08
commit ce916c746a
5 changed files with 224 additions and 0 deletions
+110
View File
@@ -0,0 +1,110 @@
---
name: tasmota
description: Use when controlling Tasmota WiFi plugs.
version: 1.0.0
author: user
license: MIT
platforms: [linux, macos, windows]
metadata:
hermes:
tags: [Smart-Home, Tasmota, IoT, WiFi, Automation]
homepage: https://tasmota.github.io/
---
# 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.XXX` sweep 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:
1. `tailscale up` on the controlling device
2. `tailscale ip list` to find the plug's Tailscale IP
3. Send HTTP commands to `http://<tailscale-ip>/` as if on LAN
4. No port forwarding, no router reconfiguration needed.
### 4. Command syntax
Use the standard Tasmota HTTP API:
- `Power ON` / `Power OFF`
- `Power TOGGLE`
- `Status 1` to read current state
- Full list at `http://<ip>/` → `cmnd` section
### 5. Verify before acting
After sending a command, immediately read back status:
- `http://<ip>/` → `Status 1`
- Or `http://<ip>/cmnd?Power` to 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
```bash
# 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
```bash
# 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)
```bash
# 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 setup
- `references/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.
```bash
#!/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)"
```
```
+29
View File
@@ -0,0 +1,29 @@
---
name: tasmota-http-api
version: 1.0.0
---
# Tasmota HTTP API Command Reference
## Core `cmnd` commands
| Command | Description | Example |
|---------|-------------|---------|
| `Power ON` | Turn plug on | `http://<ip>/cmnd?Power=ON` |
| `Power OFF` | Turn plug off | `http://<ip>/cmnd?Power=OFF` |
| `Power TOGGLE` | Toggle state | `http://<ip>/cmnd?Power=TOGGLE` |
| `Status 1` | Read current state | `http://<ip>/` (returns JSON with `Status` field) |
| `GetConfig` | Read configuration | `http://<ip>/cmnd?GetConfig` |
| `Restart` | Reboot the plug | `http://<ip>/cmnd?Restart` |
## Optional `backlog` command
| `Backlog` | Execute multiple commands separated by `;` | `http://<ip>/cmnd?Backlog=Power%20ON;%20Status%201` |
## Full URL format
```
http://<tasmota-ip>/?cmnd=<command>
```
## Notes
- Tasmota ignores unknown `cmnd` values gracefully
- Some commands require the plug to be powered and network-responsive
- Use `Status 1` after any command to verify execution
",
+33
View File
@@ -0,0 +1,33 @@
---
name: tasmota-mqtt
version: 1.0.0
---
# Tasmota MQTT Topic Structure
## Default topics
| Direction | Topic Pattern | Description |
|-----------|---------------|-------------|
| Publish (command) | `cmnd/tasmota-<name>/<command>` | e.g. `cmnd/tasmota-switch/Power ON` |
| Publish (status) | `stat/tasmota-<name>/POWER` | e.g. `stat/tasmota-switch/POWER = ON` |
## Example MQTT messages
```json
# Command topic
{ "Power": "ON" }
```
```json
# Status topic
{ "POWER": "ON" }
```
## Broker setup in Tasmota
1. Configure MQTT broker address in Tasmota web interface → Configuration → MQTT
2. Set client name, username/password if required
3. Subscribe to `stat/#` to receive status updates
4. Publish to `cmnd/...` to send commands
## When to use MQTT instead of HTTP
- When integrating with Home Assistant or other MQTT-native platforms
- When you want local-network-only command without internet exposure
- When running a dedicated MQTT broker (mosquitto, EMQX, etc.)
",
+47
View File
@@ -0,0 +1,47 @@
---
name: tasmota-tailscale
version: 1.0.0
---
# Tasmota Remote Access via Tailscale
## Why Tailscale (for Tasmota control)
- No router port-forwarding required
- Works over internet as if plug were on LAN
- Encrypted connection via the Tailscale mesh VPN
## Setup steps
### 1. Install Tailscale on controlling device
```bash
# macOS/Linux
brew install tailscale
# Or download from tailscale.com
# Authenticate
tailscale up
```
### 2. Find the plug's Tailscale IP
```bash
tailscale ip list
```
- Look for the device name you assigned (or the MAC address if known)
- Typical format: `100.xx.xx.xx`
### 3. Send HTTP commands to the Tailscale IP
```bash
# Example: turn on the plug
curl -s 'http://100.103.XX.XX/?cmnd=Power%20ON'
# Example: check status
curl -s 'http://100.103.XX.XX/'
```
### 4. Verify Tailscale is active on both ends
- Both the controlling device AND the network where the plug lives must have Tailscale running
- If the plug is a standalone Tasmota device (not behind another router), it needs Tailscale installed too
- Or: flash Tasmota with Tailscale integration (see tasmotaucp or third-party firmwares)
## Troubleshooting
- **Plug not visible in `tailscale ip list`**: Check that the plug is powered and on the same local network as the Tailscale-enabled router/gateway
- **Connection timed out**: Verify the plug's local IP is reachable first (`ping <local-ip>`), then check Tailscale status
- **Best practice**: Reserve a static local IP for the plug via DHCP lease, then Tailscale will consistently map to the same Tailscale IP
",
+5
View File
@@ -0,0 +1,5 @@
#!/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)"