logo elektroda
logo elektroda
X
logo elektroda

TuyaMCU analyzer - UART packet decoder for Tuya devices - dpID detector

p.kaczmarek2 16224 34

TL;DR

  • TuyaMCU Analyzer decodes eavesdropped TuyaMCU UART packets into dpID variables, showing each packet’s type, length, and values.
  • It accepts hex logs from RealTerm, colorizes packet bytes, auto-detects variable IDs, and includes sample files plus a compare tool.
  • The analyzer helps identify values such as dimmer levels that usually range from 0 to 1000, making it easier to map Tuya controls.
  • Examples cover switches, dimmers, thermometers, hygrometers, fan-speed controls, timers, and energy-monitor readings mapped into OpenBeken channels.
  • It cannot universally decode raw multi-measurement dpIDs from advanced Tuya electricity meters, because their byte format is device-dependent.
Generated by the language model.
ADVERTISEMENT
This content has been translated flag-pl » flag-en View the original version here
📢 Listen (AI):
  • #31 21291630
    theosoft
    Level 10  
    >>21291374
    I took a look at that json.
    Of course it could be the base, but with the XML i also adjust the decoder engine and handle repeating blocks.
    It is possible to translate strings, I realized more calculation for values.
    So i think that the XML is better.

    Regards
  • ADVERTISEMENT
  • #32 21835478
    io2345
    Level 9  
    To tell from the photo in post #2 both CH340 USB-Serial-Adapters have the RX-Line connected to the device (one on MCU RX and one on MCU TX). Is that correct?
  • ADVERTISEMENT
  • #33 21835480
    DeDaMrAz
    Level 22  
    io2345 wrote:
    To tell from the photo in post #2 both CH340 USB-Serial-Adapters have the RX-Line connected to the device (one on MCU RX and one on MCU TX). Is that correct?


    Correct, you can also use something like CH342 that has 2 UART's on single chip and single USB for convenience.
  • ADVERTISEMENT
  • #34 21835523
    io2345
    Level 9  
    Thank you. My problem is, that my two CH340 have power on the RX-Line. The newer one has 3,4V, the older one has even 5,2V. Can I get around that by simply using inline resistors, or can small capacitors help?
📢 Listen (AI):

Topic summary

✨ The discussion revolves around the TuyaMCU analyzer, a tool for decoding UART packets from Tuya devices, which helps identify dpID variables and their values. Users share updates on the software, including new features like dual UART capture, improved decoding options, and user interface enhancements. Participants discuss the requirements for using the analyzer, such as ensuring the device is running stock Tuya firmware and properly powered. Troubleshooting steps are provided for connecting devices and verifying UART communication. The conversation also touches on safety precautions when working with mains-powered devices and the potential for future updates to the analyzer's capabilities.
Generated by the language model.

FAQ

TL;DR: Captured dimmer packets show dpID 2 varying 0–570 on a 0–1000 scale [Elektroda, p.kaczmarek2, post #20528459] "Really very useful" [Elektroda, p.kaczmarek2, post #20528459] Analyzer v0.5 adds pause and crash fix [Elektroda, p.kaczmarek2, post #20729095]

Why it matters: Faster decoding lets you free Tuya devices from the cloud in minutes.

Quick Facts

• Supported UART baud rates: 9600 bps and 115200 bps [Elektroda, p.kaczmarek2, post #20630487] • Minimum hardware: 1× USB-to-UART dongle + 5 V feed to on-board AMS1117-3.3 V regulator [Elektroda, p.kaczmarek2, post #20528459] • Dual-port sniffing added in version 0.2 (may reorder packets due to SerialPort lag) [Elektroda, p.kaczmarek2, post #20562010] • Latest GUI release: v0.5 (pause, copy buttons, datetime crash fix) [Elektroda, p.kaczmarek2, post #20729095] • Limitation: Raw dpIDs in ≥ PLN 100 DIN-rail meters remain undecoded [Elektroda, p.kaczmarek2, post #20528459]

What exactly does TuyaMCU Analyzer do?

It splits every 0x55AA-framed UART packet into command, length, checksum and per-dpID fields, then labels each dpID with type (bool, value, enum, raw) and the captured value [Elektroda, p.kaczmarek2, post #20528459] This lets you see, for example, that dpID 1 toggles a relay and dpID 2 controls brightness.

Which hardware is the minimum required to sniff packets?

One USB-to-UART converter (≈US$2) and three wires—RX, TX, GND—are enough. Feed 5 V to the board before the AMS1117-3.3 V regulator so both Wi-Fi and MCU run safely at 3.3 V [Elektroda, p.kaczmarek2, post #20528459]

How can I capture packets without mains risk?

Power the device from the USB 5 V line, not from the live mains. If the internal PSU is isolated, mains feed is possible; otherwise use an opto-isolated UART or battery pack [Elektroda, DeDaMrAz, post #20632329]

Which baud rate should I try first?

Most TuyaMCU boards talk at 9600 bps. If nothing appears, switch to 115200 bps and press “Change” in the GUI to apply it [Elektroda, p.kaczmarek2, #20630423; #20630487].

The analyzer shows no data—could my board lack TuyaMCU?

Yes. Confirm a second microcontroller is present and powered. If flash dump reveals “baud” strings at 0x1F000 offset, TuyaMCU is likely present [Elektroda, p.kaczmarek2, post #20631789]

Can the program decode Raw dpIDs from energy meters?

No. High-end DIN-rail meters (> PLN 100) bundle several measurements in one Raw dpID with device-specific format; the analyzer cannot interpret it automatically [Elektroda, p.kaczmarek2, post #20528459]

How do I run a dual-UART capture?

Choose two COM ports in v0.2+, start capture, then operate the device. Expect occasional request/reply mis-ordering because of C# SerialPort latency [Elektroda, p.kaczmarek2, post #20562010]

Is packet order always reliable?

No. Dual-port mode can swap adjacent packets when the PC buffers unevenly. Re-sort them manually with the Compare Tool to avoid mis-mapping dpIDs [Elektroda, p.kaczmarek2, post #20562010]

How do I map decoded dpIDs to OpenBeken channels?

Use autoexec.bat lines:
  1. setChannelType
  2. linkTuyaMCUOutputToChannel Example: linkTuyaMCUOutputToChannel 1 bool 1 links dpID 1 to channel 1 [Elektroda, p.kaczmarek2, post #20528459]

Can I extend decoding with my own specifications?

Yes. A new XML-based engine lets you define commands, enums, and repeating blocks; each user can localize labels and calculations [Elektroda, theosoft, post #21284085]

Give me a 3-step basic capture procedure.

  1. Connect dongle RX to TuyaMCU TX and ground to ground.
  2. Start RealTerm in “Hex + spaces”, click “Capture to File”, then power the board.
  3. Operate the device, stop capture, and paste hex into Analyzer [Elektroda, p.kaczmarek2, post #20528459]
Generated by the language model.
ADVERTISEMENT