logo elektroda
logo elektroda
X
logo elektroda

Home Assistant Integration: Reflashing BK7231N in Tuya Smart DIN-rail Energy Meter TAC2121C

tomanyusers 9960 60
Best answers

How can I use this BK7231N Tuya DIN-rail energy meter in Home Assistant without Tuya, and what meter chip/driver does it need?

You don’t need a custom energy-meter chip driver here; the device uses a Tuya MCU on UART, the meter MCU is identified as V9911, and OpenBeken/OpenBK7231N can support it with the built-in TuyaMCU driver [#20305850][#20306116][#20319441] The working mapping is dpID 16 = relay/toggle, dpID 6 = raw voltage/current/power packet, dpID 1 = total energy (kWh), and dpIDs 3/4/11/18 carry historical/time/model data, so you can expose the measurements in Home Assistant through MQTT channels [#20306116][#20320571][#20352750] A proven autoexec starts TuyaMCU and NTP, sets channel types, links dpID 16 to channel 1, dpID 1 to the energy channel, and dpID 6 to the TAC2121C voltage/current/power parser [#20319441][#20320571] The meter will not report readings until it thinks the Wi‑Fi side is connected, so you must send `55AA000300010407` once at startup; after that it starts publishing periodically, and the same command also turns on the status LED [#20319781][#20320285][#20333072] Time sync also works via `tuyaMcu_sendCurTime`, but the month had to be fixed to 1–12 in the firmware, and RSSI can be sent with `tuyaMcu_sendRSSI` (or periodically) to show the Wi‑Fi bars on the LCD [#20323453][#20332622][#20369011]
ADVERTISEMENT

Topic summary

✨ The discussion focuses on integrating a Tuya Smart DIN-rail energy meter model TAC2121C, featuring a BK7231N chip, into Home Assistant by reflashing it with OpenBK7231N firmware to avoid using the Tuya cloud. The meter uses a V9911 energy measurement IC connected via UART to the BK7231N. Initial challenges included identifying the energy meter chip and decoding its UART communication protocol. Hex data captures revealed TuyaMCU packets with dpIDs conveying voltage, current, power, energy consumption, relay state, and device status. A critical discovery was the need to send a specific UART command (e.g., "uartSendHex 55AA000300010407") periodically to the TuyaMCU to initiate data reporting and relay control. Firmware updates added support for automatic time synchronization (NTP), RSSI reporting, and improved parsing of compound data packets. The OpenBK7231T_App firmware was customized with an autoexec.bat script linking TuyaMCU dpIDs to channels for toggle, voltage, power, current, and energy total, enabling MQTT integration with Home Assistant. Further refinements addressed data formatting, channel labeling, and multi-phase meter support using RAW_TAC2121C_VCP command with configurable channel offsets. The community also worked on debugging WiFi state synchronization and ensuring stable communication between the BK7231N and TuyaMCU. A 3-phase meter variant was tested with firmware adjustments to handle multiple dpIDs for each phase. The project is ongoing, with documentation and tutorials planned to assist users in reflashing and configuring these meters for local control without Tuya cloud dependency.

FAQ

TL;DR: Sending Wi-Fi-state frame 55AA0003000104xx every ≤6 h unlocks 100 % of TAC2121C energy data; “You will certainly get support for that device” [Elektroda, p.kaczmarek2, post #20305850]

Why it matters: Without that single UART packet the meter stays silent and Home-Assistant sees only heart-beats.

Quick Facts

• Measurement range: 80-260 V, 0-100 A, 0-60 kW (typical per Vangotech V9921 spec, CreationFactory). • Resolution: Voltage 0.1 V, Current 1 mA, Power 1 W [Elektroda, p.kaczmarek2, post #20306116] • MCU protocol: Tuya 0x55AA, 9600 bps, 8-N-1 [Elektroda, tomanyusers, post #20305709] • Keep-alive: Wi-Fi-state frame required every ~6 h to maintain streaming [Elektroda, tomanyusers, post #20320773] • Typical re-flash time: <5 min via CB3S UART pads [Elektroda, tomanyusers, post #20319498]

What UART command wakes the TAC2121C so it starts sending live data?

Send the Wi-Fi-state frame 55 AA 00 03 00 01 04 07. The meter then pushes voltage, current and power every few minutes [Elektroda, tomanyusers, post #20320773]

How often must that frame be resent?

The TuyaMCU times out after roughly six hours; resend the frame or automate it with addRepeatingEvent 21500 tuyaMcu_sendRSSI in autoexec.bat [Elektroda, tomanyusers, post #20320773]

Which dpIDs carry voltage, current, power and energy?

dpID 6 = V/I/P raw packet, dpID 1 = total kWh, dpID 16 = relay, dpID 18 = serial string. Phase-B and C can appear on dpID 7 and 8 in three-phase models [Elektroda, p.kaczmarek2, post #21337927]

How can I push RSSI to the LCD signal-strength icon?

Use tuyaMcu_sendRSSI without parameters; OpenBK inserts current RSSI and checksum automatically from v1.15.180 onward [Elektroda, p.kaczmarek2, post #20368895]

How do I rename MQTT topics to human-readable keys?

Add setChannelLabel 2 Voltage and similar lines in autoexec.bat. Labels propagate to homeassistant/ discovery payloads automatically [Elektroda, p.kaczmarek2, post #20352903]

Quick 3-step flashing guide?

  1. Remove front LCD, expose CB3S RX/TX/GND/3V3 pads. 2. Connect USB-TTL at 115200 bps and flash OpenBK7231 T with obk.bin (≈2 min). 3. Power cycle; the module opens its AP for Wi-Fi setup [Elektroda, tomanyusers, post #20319498]

Statistic: How accurate is the energy reading?

kWh counter increments in 0.01 kWh steps; forum users measured ≤1 % deviation against calibrated meters up to 3.6 kW load [Elektroda, tomanyusers, post #20305911]
ADVERTISEMENT