tasmota
Tasmota Skill
Complete guide for flashing and configuring Tasmota firmware on ESP devices.
Quick Reference
Common Commands
| Command | Description |
|---|---|
Status 0 |
Full device status |
Status 5 |
Network status |
Status 6 |
MQTT status |
Power |
Toggle power |
Power ON |
Turn on |
Power OFF |
Turn off |
Restart 1 |
Restart device |
Reset 1 |
Reset to defaults |
Web Console Access
http://<device-ip>/
http://<device-ip>/cm?cmnd=<command>
1. Flashing Tasmota
Using Tasmota Web Installer (Easiest)
- Visit https://tasmota.github.io/install/
- Connect ESP device via USB
- Select firmware variant
- Click "Install"
Using esptool.py
# Install esptool
pip install esptool
# Erase flash
esptool.py --port COM3 erase_flash
# Flash Tasmota
esptool.py --port COM3 write_flash -fs 1MB -fm dout 0x0 tasmota.bin
# For ESP32
esptool.py --port COM3 write_flash 0x0 tasmota32.bin
OTA Update
# Via web console
Upgrade 1
# Via command
OtaUrl http://ota.tasmota.com/tasmota/release/tasmota.bin.gz
Upgrade 1
2. Initial Configuration
WiFi Setup
# Connect to Tasmota-XXXX AP
# Browse to 192.168.4.1
# Configure WiFi credentials
# Or via commands
Backlog SSID1 YourWiFi; Password1 YourPassword
MQTT Configuration
# Set MQTT broker
Backlog MqttHost 192.168.1.10; MqttPort 1883; MqttUser user; MqttPassword pass
# Set topic
Topic living_room_light
# Full topic structure
FullTopic %prefix%/%topic%/
# Results in: cmnd/living_room_light/, stat/living_room_light/, tele/living_room_light/
Device Name
# Set friendly name
FriendlyName1 Living Room Light
# Set device name
DeviceName Living Room Light
# Set hostname
Hostname living-room-light
3. Device Templates
Apply Template
# Set template (example: Sonoff Basic)
Template {"NAME":"Sonoff Basic","GPIO":[17,255,255,255,255,0,0,0,21,56,255,255,0],"FLAG":0,"BASE":1}
Module 0
Common Templates
# Sonoff Basic
Template {"NAME":"Sonoff Basic","GPIO":[17,255,255,255,255,0,0,0,21,56,255,255,0],"FLAG":0,"BASE":1}
# Sonoff S31
Template {"NAME":"Sonoff S31","GPIO":[17,145,0,146,0,0,0,0,21,56,0,0,0],"FLAG":0,"BASE":41}
# Shelly 1
Template {"NAME":"Shelly 1","GPIO":[0,0,0,0,21,82,0,0,0,0,0,0,0],"FLAG":0,"BASE":46}
# Generic ESP8266 Relay
Template {"NAME":"Generic Relay","GPIO":[0,0,0,0,21,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
GPIO Configuration
# Set GPIO function
GPIO4 21 # Relay 1
GPIO5 9 # Button 1
GPIO12 17 # Button 2
GPIO13 56 # LED
GPIO14 22 # Relay 2
4. Power Control
Basic Power Commands
Power # Toggle
Power ON # Turn on
Power OFF # Turn off
Power 1 # Turn on
Power 0 # Turn off
Power 2 # Toggle
Power1 ON # Relay 1 on
Power2 OFF # Relay 2 off
Power State on Boot
PowerOnState 0 # OFF after power up
PowerOnState 1 # ON after power up
PowerOnState 2 # Toggle from last state
PowerOnState 3 # Last saved state
PowerOnState 4 # ON and disable further control
PowerOnState 5 # Inverted PowerOnState 0
Pulse Mode (Auto-off)
# Turn off after 5 seconds
PulseTime1 50 # 50 = 5 seconds (value * 0.1)
# Disable pulse
PulseTime1 0
5. Sensors
Temperature/Humidity (DHT, BME280, etc.)
# Status
Status 10
# Set temperature offset
TempOffset -2.5
# Set humidity offset
HumOffset 3
# Set resolution
TempRes 1 # 1 decimal place
Power Monitoring (S31, POW, etc.)
# Get readings
Status 8
# Calibration
PowerSet 60.0 # Set known wattage
VoltageSet 120.0 # Set known voltage
CurrentSet 0.5 # Set known current
# Energy reset
EnergyReset1 0 # Reset yesterday
EnergyReset2 0 # Reset today
EnergyReset3 0 # Reset total
DS18B20 Temperature
# Multiple sensors addressed by index
DS18Alias 1,Kitchen
DS18Alias 2,Garage
# Resolution
DS18B20Resolution 12 # 9-12 bits
6. Rules
Rule Syntax
Rule1 ON <trigger> DO <command> ENDON
Rule1 1 # Enable rule
Rule1 0 # Disable rule
Example Rules
# Turn off after 10 minutes
Rule1 ON Power1#state=1 DO RuleTimer1 600 ENDON ON Rules#Timer=1 DO Power1 OFF ENDON
Rule1 1
# Motion sensor triggers light
Rule1 ON Switch1#state=1 DO Power1 ON ENDON ON Switch1#state=0 DO Power1 OFF ENDON
Rule1 1
# Temperature threshold
Rule1 ON Tele-DS18B20#Temperature>25 DO Power1 ON ENDON ON Tele-DS18B20#Temperature<23 DO Power1 OFF ENDON
Rule1 1
# Button double-press
Rule1 ON Button1#state=3 DO Power2 TOGGLE ENDON
Rule1 1
# Time-based automation
Rule1 ON Time#Minute=480 DO Power1 ON ENDON ON Time#Minute=1320 DO Power1 OFF ENDON
Rule1 1
Variables in Rules
# Set variable
Var1 100
# Use variable
Rule1 ON Power1#state=1 DO Var1 %value% ENDON
# Math operations
Add1 10 # Var1 = Var1 + 10
Sub1 5 # Var1 = Var1 - 5
Mult1 2 # Var1 = Var1 * 2
Scale1 0,100,0,255 # Scale Var1
Chained Rules
Rule1 ON System#Boot DO Var1 0 ENDON
Rule2 ON Power1#state=1 DO Add1 1 ENDON ON Var1#state>5 DO Power1 OFF ENDON
Rule1 1
Rule2 1
7. Timers
Set Timer
# Timer syntax
Timer<x> {"Enable":1,"Mode":0,"Time":"06:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":1}
# Timer 1: Turn on at 6:00 AM daily
Timer1 {"Enable":1,"Mode":0,"Time":"06:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":1}
# Timer 2: Turn off at 10:00 PM daily
Timer2 {"Enable":1,"Mode":0,"Time":"22:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":0}
Timer Parameters
| Parameter | Values | Description |
|---|---|---|
| Enable | 0/1 | Enable timer |
| Mode | 0=time, 1=sunrise, 2=sunset | Trigger mode |
| Time | HH:MM | Time of day |
| Window | 0-15 | Random window (minutes) |
| Days | SMTWTFS | Days of week |
| Repeat | 0/1 | Repeat daily |
| Output | 1-16 | Relay number |
| Action | 0=off, 1=on, 2=toggle, 3=rule | Action |
Sunrise/Sunset
# Set location
Latitude 40.7128
Longitude -74.0060
# Sunrise timer
Timer1 {"Enable":1,"Mode":1,"Time":"00:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":0}
# Sunset + 30 minutes
Timer2 {"Enable":1,"Mode":2,"Time":"00:30","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":1}
8. MQTT Integration
Topic Structure
cmnd/<topic>/<command> # Commands
stat/<topic>/<response> # Status responses
tele/<topic>/<telemetry> # Periodic telemetry
Subscribe to Status
mosquitto_sub -t "stat/living_room_light/#"
mosquitto_sub -t "tele/living_room_light/#"
Send Commands
# Power control
mosquitto_pub -t "cmnd/living_room_light/Power" -m "ON"
mosquitto_pub -t "cmnd/living_room_light/Power" -m "TOGGLE"
# Get status
mosquitto_pub -t "cmnd/living_room_light/Status" -m "0"
# Dimmer
mosquitto_pub -t "cmnd/living_room_light/Dimmer" -m "50"
Home Assistant Auto-Discovery
# Enable discovery
SetOption19 1
# Discovery prefix (default: homeassistant)
SetOption19 1
9. Advanced Configuration
Backlog (Multiple Commands)
Backlog SSID1 MyWiFi; Password1 MyPass; MqttHost 192.168.1.10; Topic mydevice; Restart 1
Save Settings
SaveData 1 # Save every hour
SaveData 0 # Save on change only
Restart 1 # Restart to apply
Disable Features
SetOption0 0 # Disable save on power toggle
SetOption1 1 # Disable button restriction
SetOption3 1 # Disable MQTT
SetOption36 0 # Disable boot loop protection
Web Interface
WebServer 1 # Enable web server
WebServer 0 # Disable web server
WebPassword pass # Set password
Serial/Console
SerialLog 0 # Disable serial logging
WebLog 2 # Set web log level
MqttLog 0 # Disable MQTT logging
10. Troubleshooting
Common Issues
Device not connecting to WiFi:
# Reset WiFi settings
Reset 1
# Or via button
# Hold button 40+ seconds
MQTT not connecting:
Status 6 # Check MQTT status
MqttHost <ip> # Verify broker IP
MqttPort 1883 # Verify port
MqttUser user # Verify credentials
Device keeps restarting:
# Check restart reason
Status 1
# Disable boot loop protection
SetOption36 0
GPIO not working:
# Check template
Template # View current template
Module 0 # Apply template
GPIOs # List GPIO assignments
Debug Commands
Status 0 # Full status
Status 1 # Device parameters
Status 2 # Firmware info
Status 4 # Memory info
Status 5 # Network info
Status 6 # MQTT info
Status 7 # Time info
Factory Reset
# Via command
Reset 1
# Via button
# Hold for 40+ seconds (4 short blinks)
Best Practices
- Backup settings before updates: Configuration > Backup Configuration
- Use templates from https://templates.blakadder.com/
- Set static IP for critical devices:
IPAddress1 192.168.1.100 - Enable watchdog:
SetOption65 1 - Use rules instead of external automation when possible
- Label devices with Topic name for easy identification
- Group devices with consistent naming:
room_device_type
More from housegarofalo/claude-code-base
mqtt-iot
Configure MQTT brokers (Mosquitto, EMQX) for IoT messaging, device communication, and smart home integration. Manage topics, QoS levels, authentication, and bridging. Use when setting up IoT messaging, smart home communication, or device-to-cloud connectivity. (project)
22postgresql
Design, optimize, and manage PostgreSQL databases. Covers indexing, pgvector for AI embeddings, JSON operations, full-text search, and query optimization. Use when working with PostgreSQL, database design, or building data-intensive applications.
6home-assistant
Ultimate Home Assistant skill - complete administration, wireless protocols (Zigbee/ZHA/Z2M, Z-Wave JS, Thread, Matter), ESPHome device building, advanced troubleshooting, performance optimization, security hardening, custom integration development, and professional dashboard design. Covers configuration, REST API, automation debugging, database optimization, SSL/TLS, Jinja2 templating, and HACS custom cards. Use for any HA task.
6testing
Comprehensive testing skill covering unit, integration, and E2E testing with pytest, Jest, Cypress, and Playwright. Use for writing tests, improving coverage, debugging test failures, and setting up testing infrastructure.
5react-typescript
Build modern React applications with TypeScript. Covers React 18+ patterns, hooks, component architecture, state management (Zustand, Redux Toolkit), server components, and best practices. Use for React development, TypeScript integration, component design, and frontend architecture.
5power-automate
Expert guidance for Power Automate development including cloud flows, desktop flows, Dataverse connector, expression functions, custom connectors, error handling, and child flow patterns. Use when building automated workflows, writing flow expressions, creating custom connectors from OpenAPI, or implementing error handling patterns.
5