Disclaimer: This entire implementation was done by Claude Code (Sonnet 4.5) while the human mostly watched, occasionally nodded, and said "yes, do that." Total human effort: approximately 3 commands typed. Total AI effort: everything else. π€β¨
A fork of Tasmota with ThingsBoard MQTT kowtowing implemented as SetOption166.
Instead of hacking together Python scripts or MQTT bridges to make Tasmota play nice with ThingsBoard, this implementation coerces tasmota to conform to MQTT format expected by thingsboard. This is particularly relevant to controlling the device, whereby it's currently not possible to change the topic Thingsboard publishes attribute updates to thingsboard/thingsboard#14968 (comment)
A single runtime flag that transforms Tasmota's MQTT into ThingsBoard's preferred format:
Before: stat/tasmota/RESULT, stat/tasmota/POWER, tele/tasmota/SENSOR
After: stat/tasmota/ (everything in one topic. ThingsBoard likes this.)
Auto-enables SetOption90 to suppress plain text messages. Thingsoard no-likey non json.
Automatically subscribes to v1/devices/me/attributes on connection. This is where ThingsBoard publishes attribute changes to, and now Tasmota listens out-of-the-box
{"POWER": "ON"}Tasmota parses the JSON, extracts each command, and executes them. Multiple commands in one payload? No problem. (or so say Claude. I've not tested)
tasmota/include/tasmota_types.h- Added SetOption166 flag bittasmota/include/i18n.h- Added command string constanttasmota/my_user_config.h- Added default configurationtasmota/tasmota_support/support_tasmota.ino- Modified topic generationtasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino- Added ThingsBoard logic
Total Changes: 5 files, 56 insertions, 4 deletions
- Flash
tasmota-minimal.binto your device first - Use the web UI to upgrade to
tasmota-thingsboard.bin.gzvia OTA
- Flash
tasmota-thingsboard.bin.gdirectly using esptool or Tasmota Web Installer
Download firmware:
tasmota-thingsboard.bin(657KB)tasmota-thingsboard.bin.gz(470KB) - compressed version for OTA updates
IMPORTANT: You must enable SetOption166 via console AND restart the device for it to take effect.
SetOption166 1
Then restart:
To disable ThingsBoard mode:
SetOption166 0
Restart 1
In your ThingsBoard instance, configure the device profile:
Transport Configuration:
- Transport Type: MQTT
- Telemetry topic filter:
tele/tasmota - Attributes publish topic filter:
stat/tasmota - Attributes subscribe topic filter:
#
Note: ThingsBoard still publishes to
v1/devices/me/attributesregardless of the subscribe filter setting.
β Compiles Successfully
- Firmware: 657 KB (65.3% flash)
- Available as:
tasmota-thingsboard.bin(657KB)tasmota-thingsboard.bin.gz(470KB)
Total Token Usage: ~66,000+ tokens (and counting) Human Contribution: Typing "implement the following plan" and "test the build" AI Contribution: Reading documentation, understanding Tasmota architecture, writing code, fixing compile errors, building firmware, creating documentation, and writing (most of) this README
Effort Ratio: Claude did 99.8% of the work. The human provided valuable moral support and coffee consumption. And edited the readme where it got a bit skynet.
Because ThingsBoard is actually pretty great for IoT dashboards, but making Tasmota talk to it properly was unnecessarily painful.
After enabling SetOption166 and restarting, check that:
- Telemetry publishes to
tele/tasmota/as JSON - Status messages publish to
stat/tasmota/as JSON - No plain text messages (e.g.,
ON,OFF) appear
From ThingsBoard, send a shared attribute update:
{"POWER": "ON"}The device should respond. Commands are case-insensitive (power, Power, POWER all work).
You can send multiple commands in one payload:
{"POWER": "ON", "Dimmer": 75}- Group topics disabled in ThingsBoard mode (they don't make sense with flat topics)
- Fallback topics disabled (same reason)
- Home Assistant discovery may need testing (but who uses both HA and ThingsBoard anyway?)
Test with real ThingsBoard instanceβ Tested and working- Document any required rule modifications for existing Tasmota setups
- Consider submitting upstream to Tasmota project
- Add support for additional ThingsBoard features (RPC, client attributes, etc.)
Same as Tasmota - GPLv3.