logo elektroda
logo elektroda
X
logo elektroda

[BK7321N] How to change the firmware on the LTC LXU407 smart plug with BK7321N chip?

uszatekmis  11 1632 Cool? (0)
📢 Listen (AI):

TL;DR

  • Modifies an LTC LXU407 smart plug with BK7231N/BK7321N and BL0942 to remove Tuya cloud dependence and flash custom firmware.
  • Opens the compact case via a triangular screw under the sticker, then flashes the board with pogo-pin P50-B1 contacts instead of soldering.
  • Uses pin 6 for LED_n/WifiLED_n, pin 9 for Btn 1, and pin 26 for Rel 1, with startup script `backlog PowerSave 1; startDriver B0942`.
  • Tuya-cloudcutter could not flash it because of soft 1.1.8, and voltage readings are usually overestimated so calibration is advisable.
Generated by the language model.
Good morning.
As I've been using a dozen or so smart sockets of one type for over two years, I've finally matured into trying to make them cloud free.
I use them for Home Assistant with LocalTuya integration (which in itself no longer requires the cloud), but I wanted to change the firmware completely.
The socket is quite compact (that's what I was looking for), with tuya-cloudcutter it is unfortunately impossible to sflash it (soft 1.1.8).
But to the edge. It looks like this:

Smart WiFi socket next to its original packaging on a table. .

Once I found the right way to open the case it went quite straightforward.
Under the sticker is a screw with an unusual head (triangular keyway).

View of the bottom part of a smart socket with the sticker removed, revealing a triangular screw head. .

After unscrewing it and gently removing the top, the interior with the stick-on antenna begins to be visible.

The image shows the interior of an opened smart plug, revealing the electronic circuit board. .

You can already find the Beken chip, but I couldn't imagine flashing by touching the chip feet directly (but I was prepared to do so).
However, after gently peeling off the antenna

Interior of a dismantled smart socket showing electronics and a detached antenna.
and placing the socket upside down with the pins and DELICIOUSLY treating them with a hammer, everything comes out nicely.

Image of the interior of a dismantled smart socket with visible electronic components. .

It remains to be seen what this has on board - BK7231N and BL0942.

Close-up of a circuit board featuring a Beken BK7231N chip and other electronic components. .

The best hides on the opposite side of the board where the chip is.

Inside of a disassembled smart plug showing a circuit board.

This is where simple flashing remains. It is possible to solder, but I, due to the large number of devices to be reworked, went for spring-loaded pins (pogo-pin) type P50-B1, available on a large Polish shopping portal.

Interior of a smart socket with connected pogo pins. .

Pin configuration:
pin 6 - LED_n 1 / WifiLED_n
pin 9 - Btn 1
pin 26 - Rel 1

Startup script:
backlog PowerSave 1; startDriver B0942

I still use

alias mode_wifi setPinRole 6 WifiLED_n
alias mode_relay backlog setPinRole 6 LED_n; SetPinChannel 6 1;
mode_wifi
addChangeHandler WiFiState == 4 mode_wifi
addChangeHandler WiFiState != 4 mode_relay

I noticed that the voltage indication is not very accurate (usually overestimated), so calibration is rather advisable.

About Author
uszatekmis wrote 22 posts with rating 2 . Live in city Rzeszów. Been with us since 2007 year.

Comments

p.kaczmarek2 11 Mar 2025 09:51

Do you perhaps have backups of the socket charge? We are collecting them for analysis. Calibration is always a must, this can be done via WebApp: https://obrazki.elektroda.pl/9806170900_1741682879_bigthumb.jpg... [Read more]

uszatekmis 11 Mar 2025 10:22

. Hi. Yes, of course I have a copy of the batch, in fact I still have about 12 such slots not converted. I will send on pw (?). As for calibration, of course - I know how to do it, I've already done... [Read more]

p.kaczmarek2 12 Mar 2025 14:32

If searching by name/chip/manufacturer does not work, or more specifically if something is missing from our list: https://openbekeniot.github.io/webapp/devicesList.html Then please report to me, or even... [Read more]

uszatekmis 12 Mar 2025 19:55

. I am already correcting myself - template attached. . Here I also accept criticism :-) I made a new dump on the test AP - it does not contain sensitive data. [Read more]

p.kaczmarek2 13 Mar 2025 15:39

Thanks for sharing the batch (for publication with the test SSID), it is now here: https://github.com/openshwprojects/FlashDumps/commit/b9c617c581f88e5ad4f883716009c67a473addd1 Config Tuya: ... [Read more]

uszatekmis 13 Mar 2025 16:44

. I bought all of them on our Polish auction portal. I think they were even from the same seller. Over an extended interval (roughly over the course of 1.5 years) [Read more]

p.kaczmarek2 13 Mar 2025 18:28

I have yet to test such products from them: RF remote controlled relay socket - LXU200 - short test, interior... . Simple timer LXU09 - instructions, interior, cell from inside (holding) But... [Read more]

uszatekmis 14 Mar 2025 07:29

I have read that there is something like this. But in my case, due to the large number of different types of sensors (in total it will add up to more than 50 of various types - temperature, humidity, power,... [Read more]

p.kaczmarek2 14 Mar 2025 07:59

And you will have these 50 devices connected via WiFi? After changing the firmware, you can also always connect an additional sensor to any device on free pins. It is only worth ensuring that the method... [Read more]

uszatekmis 14 Mar 2025 08:15

. I will not "be" but "have" connected. Not all at once of course, as some are battery operated devices most of their lives "sleeping" but waking up at events. I have quite an extensive home network... [Read more]

p.kaczmarek2 15 Mar 2025 12:46

I didn't have time to write back, but overall you're right, there is a tiny bug - setPinChannel doesn't set the channel value. I'll try to add a test and fix the handling of this situation. I only see... [Read more]

FAQ

TL;DR: For Home Assistant users converting the LTC LXU407 to fully local control, the thread shows 3 confirmed GPIO roles and one practical rule: "calibration is always a must." Open the plug via the hidden triangular screw, flash through rear test pads with pogo pins, then use OpenBeken with the BL0942 driver and post-flash calibration for accurate power data. [#21478189]

Why it matters: This FAQ gives a repeatable, low-damage path from Tuya firmware to OpenBeken on a compact BK7231N smart plug.

Option Cloud status What the thread confirms Best fit
LocalTuya Cloud not required after setup The plug already worked in Home Assistant this way Keep stock firmware, local control
OpenBeken Fully reflashed Relay, LED, button, BL0942, scripts, and calibration were discussed Full local firmware control

Key insight: The LTC LXU407 is unusually serviceable for a compact plug because the main obstacle is a hidden triangular screw, not permanent glue. Once opened, the rear pads make repeat flashing practical with pogo pins.

Quick Facts

  • The confirmed OpenBeken mapping for the LTC LXU407 is GPIO 6 = LED_n/WifiLED_n, GPIO 9 = Btn, GPIO 26 = Rel, with startDriver BL0942 and PowerSave 1 used at startup. [#21474564]
  • The case uses 1 hidden screw under the sticker, and its head is a triangular keyway, which explains why the plug can look glued shut before teardown. [#21474564]
  • The owner had about 12 similar sockets left to convert, which is why a non-solder flashing method mattered in real use. [#21474942]
  • Night LED control was scheduled with 22:00:00 to disable the LED and 06:00:00 to restore relay-status indication, using OpenBeken clock events. [#21479012]
  • The same user planned for more than 50 mixed sensors and devices in Home Assistant, so central aggregation was preferred over storing all history inside each plug. [#21478988]

How do I open the LTC LXU407 smart plug without destroying the case, and where is the hidden screw located?

Open it by removing the sticker first, because the hidden screw sits underneath it and uses a triangular head. Then unscrew it, lift the top carefully, peel back the stick-on antenna, and push the PCB out from the pin side. The successful method here was: 1. remove the sticker and screw, 2. lift the top gently, 3. tap the pin bases out of the plastic to free the board. [#21474564]

What is the correct pin configuration for flashing the LTC LXU407 smart plug with a BK7231N chip and BL0942 energy metering?

The confirmed functional mapping is GPIO 6 for the LED, GPIO 9 for the button, and GPIO 26 for the relay. The thread lists them as 6 = LED_n/WifiLED_n, 9 = Btn 1, and 26 = Rel 1, and the same roles appear again in the JSON template added to the device database. [#21478189]

Which OpenBeken startup command and pin roles should I use for the LTC LXU407 to get the relay, button, LED, and BL0942 working?

Use backlog startDriver BL0942; PowerSave 1; and assign GPIO 6 to LED_n, GPIO 9 to Btn, and GPIO 26 to Rel. For Wi-Fi indication, the thread also uses an alias that temporarily switches GPIO 6 to WifiLED_n, then returns it to relay-state LED behavior after connection. [#21474564]

Why does the voltage reading on the LTC LXU407 with BL0942 appear too high after flashing, and how should I calibrate it?

The voltage reads high because the raw post-flash measurement is not calibrated for this hardware. The thread states that voltage was usually overestimated and that calibration is required, with WebApp calibration described as easy and recommended after conversion, especially when doing several plugs in one batch. [#21474910]

What is a pogo pin P50-B1, and why is it useful for flashing BK7231N devices without soldering?

"Pogo pin P50-B1 is a spring-loaded contact pin that makes temporary electrical contact, avoiding permanent solder joints during repeated flashing." It was chosen here because the owner had many plugs to rework, and pressing pogo pins onto the rear pads was faster than soldering wires onto every BK7231N board. [#21474564]

What is BL0942, and how does it differ from BL0937 in smart plugs with power monitoring?

"BL0942 is an energy-measurement chip that provides power-related readings in a smart plug, and this LXU407 uses it with the OpenBeken BL0942 driver." In this thread, BL0937 appears only as the metering chip used in older or similar plug models, while the LXU407 itself is consistently identified as BK7231N plus BL0942. [#21478412]

How does OpenBeken compare with LocalTuya for making Tuya smart plugs cloud-free in Home Assistant?

LocalTuya already gave local Home Assistant control here, but OpenBeken replaced the firmware completely. The owner used LocalTuya without needing the cloud, yet still wanted a full firmware change for a more complete cloud-free setup with direct scripting, device templates, and onboard features like charts. [#21474564]

What is the easiest way to back up the original Tuya firmware from a BK7231N smart plug before reflashing it?

Make a flash dump before pairing, then submit only an unpaired backup. The thread confirms that unpaired dumps are preferred so no SSID leaks, and one safe dump from this plug was later published after being redone on a test access point. The practical sequence was: 1. dump first, 2. verify it is unpaired, 3. flash new firmware after backup. [#21478189]

Why does setPinChannel not immediately change the LED state in OpenBeken, and when do I need to use SetChannel as well?

setPinChannel changes the pin-to-channel link, but it does not immediately set the channel value. The thread identifies this as a small bug, so the LED may not change until the channel itself updates. Use SetChannel as well when you need an immediate LED state, such as forcing channel 0 to 0 for LED-off mode. [#21480625]

How can I configure an OpenBeken script to turn the smart plug LED off at night and restore relay-status indication in the morning?

Create one alias that maps GPIO 6 to LED_n on channel 0 and forces SetChannel 0 0, then another alias that restores relay mode and updates channel 0 from relay state. The working schedule used addClockEvent 22:00:00 0xFF 234 mode_none and addClockEvent 06:00:00 0xFF 123 mode_relay, with mode_relay corrected to use !$CH1. [#21480625]

What causes some Tuya smart plugs like the LTC LXU407 or NAS-WR07W to be easy to open while others seem heavily glued?

Build variation causes it, not one universal enclosure design. The discussion says some series are tightly glued while others open easily, and even similar devices from the same family can differ. In this LXU407 case, the plug was not glued at all and was held mainly by one unusual screw plus the plastic pin mounts. [#21474910]

Where should I submit an unpaired Tuya flash dump and an OpenBeken JSON template so the LTC LXU407 can be added to the device database?

Submit the unpaired Tuya dump to the FlashDumps collection and add the OpenBeken JSON template to the webapp device list source. The thread explicitly points to the flash-dump repository for safe, unpaired backups and to the devices.json source list used by the searchable OpenBeken device database. [#21476696]

What should I watch out for when using a hammer, clamp, or other mechanical method to remove the PCB from a compact smart plug safely?

Use controlled force on the metal pin bases, not random force on the case walls or PCB edges. The successful teardown here involved gently tapping the bases of the mains pins out of the plastic, while the first plug survived worse than later attempts. That means technique matters, especially on compact housings with strong plastic and tight internal fits. [#21474942]

How can I use OpenBeken charts on a power-monitoring socket, and when is it better to store measurements in Home Assistant instead?

Use OpenBeken charts when you want measurement history hosted directly on the socket, but store data in Home Assistant when you manage many device types centrally. The thread says charts run on similar sockets, yet the owner chose Home Assistant aggregation because the installation would exceed 50 devices across power, temperature, humidity, brightness, and opening sensors. [#21478988]

What extra sensors can be connected to free pins on BK7231N devices after flashing OpenBeken, and how should I choose a sensible mounting method?

You can connect additional sensors to free pins after flashing, but mount them where the reading remains physically meaningful. The thread gives temperature as the clearest example: measure outside the case, not inside it. That rule matters because enclosure heat, mains parts, and cramped placement can distort any sensor you add to a BK7231N device. [#21479006]
Generated by the language model.
%}