logo elektroda
logo elektroda
X
logo elektroda

[CB3S/BK7231N] Flashing Lamex LXM170 single light switch with our Tasmota/esphome style firmware

p.kaczmarek2  0 2208 Cool? (+1)
📢 Listen (AI):

TL;DR

  • Lamex LXM170 single WiFi light switch with a CB3S/BK7231N module was flashed from cloud firmware to OpenBeken.
  • BK7231 Easy Flash Tool read the Tuya configuration and generated an OBK template, automatically mapping the relay, WiFi LED, and button GPIOs.
  • The switch cost 60 zlotys, about $15, and the detected pins were relay P6, WiFi LED P26, and button P10.
  • The flash succeeded with RX, TX, GND, and 3.3V wiring, and the switch was ready for Home Assistant without guessing any configuration.
  • The simplest version lacks RF and no-neutral mode, so it suits users who want a basic cloud-to-Home-Assistant conversion.
Generated by the language model.
The packaging of the WiFi light switch M170 on a wooden table.
Hello, today I will show you another firmware change guide for a WiFi light switch popular in our country. Device will be flashed with OpenBeken , futhermore, we will also automatically detect GPIO configuration for this device with our BK7231 Easy Flash Tool.

Purchase of LXM170
I did the flashing for the reader, who sent me this device, But I know where the switch was purchased:
Advertisement for the Lamex LXM170 touch switch with price offer.
60 zlotys (about 15$) for the switch, it's not that bad, especially since it's in our country....
Description is mainly a marketing boast in every possible way:
Single-zone touch light switch with WiFi, promoted as a product from LAMEX, featuring a prominently lit LED button and mobile app control capability.
POLISH PRODUCER LAMEX - are they sure? I rather think it's a Tuya product imported from China?
Presentation of functions and benefits of the Lamex WiFi switch.
Time for some specifics:
Installation instructions and technical specifications of the light switch. That is, it's the simplest switch as possible, no RF, no "no-neutral" mode, etc.
Packaging:
Packaging of M170 light switch. The packaging of the WiFi light switch M170 on a wooden table. Packaging of the LXM170 light switch with technical specifications.

Content - although there are screws:
Wiring diagram of a light switch with descriptions for neutral and live wires. Contents of the LXM170 switch box protected by foam. Screws in a transparent bag inside a box. Back of Lamex LXM170 WiFi light switch with technical information and manufacturer markings.


Teardown of LXM170
Now removing the front:
Close-up of the WiFi module in the LXM170 switch Back panel of the LXM170 WiFi light switch with visible labels and specifications. WiFi module in LXM170 light switch without casing Close-up of the CB3S module in a WiFi switch.
So here we have a WiFi module (probably something from BK7231), a pushbutton controller in SOIC, a three-legged LDO and a transistor from relay control. Let's look further:
Internal PCB of LXM170 switch with CB3S module. PCB of the WiFi module in the LXM170 light switch
The module is a CB3S:
https://developer.tuya.com/en/docs/iot/cb3s?id=Kai94mec0s076
By the way, you can also see the place for the RF chip in SOIC8 along with the oscillator, but here it is not soldered.


Flashing our firmware
Let's upload OBK:
https://github.com/openshwprojects/OpenBK7231T_App
In order to do it, we use our flasher:
https://github.com/openshwprojects/BK7231GUIFlashTool
Solder RX, TX and GND and 3.3V:
Applied flux:
CB3S module on a circuit board.
Flashed:
CB3S WiFi module with visible RX, TX, and GND pins.
Soldered:
WiFi module with soldered wire on a workbench. .
Flasher layout:
Setup for flashing firmware on LXM170 WiFi light switch.
Flasher correctly reads Tuya configuration with Read operation:
Code: YAML
Log in, to see the code
You can generate an OBK template from this, e.g. here:
https://openbekeniot.github.io/webapp/templateImporter.html
Template:
Code: JSON
Log in, to see the code

Human-readable description:

Device seems to be using CB3S module, which is BK7231N chip.
- Relay (channel 1) on P6
- WiFi LED on P26
- Button (channel 1) on P10

The OBK configuration is ready, no need to guess anything. You can already make the connection with Home Assistant.

For more info, you should take a look at the Elektroda com channel on Youtube:
https://www.youtube.com/@electrodacom

Summary
This was the simplest switch as possible, no extra features, but at least it was easy to cut from the cloud and connect to Home Assistant. It was a bit easier than the switch which we presented on YT , because here we didn't have to desolder the controller in the SOIC because it wasn't connected to the RX/TX pins (when something is connected to the RX/TX port it can interfere with programming), so I think I can easily this switch to someone looking for something to easily change firmware.

About Author
p.kaczmarek2
p.kaczmarek2 wrote 14600 posts with rating 12617 , helped 654 times. Been with us since 2014 year.

Comments

FAQ

TL;DR: For owners of the Lamex LXM170, this guide maps 3 GPIOs and shows a clean UART flash path at 3.3 V using BK7231 Easy Flash Tool. "No need to guess anything," because the tool reads the Tuya config and yields an OpenBeken template for Home Assistant-ready setup. [#20911905]

Why it matters: This thread turns a basic Tuya-style wall switch into a locally controlled BK7231N device with known pins, faster setup, and no cloud lock-in.

Option Firmware path GPIO setup Home Assistant path Flashing difficulty
Stock LXM170 Tuya factory firmware Hidden behind Tuya config Not described here No reflashing performed
LXM170 with OpenBeken BK7231 Easy Flash Tool + OBK Auto-detected from config dump Directly available after OBK setup Easier than the other switch mentioned

Key insight: The most valuable result is not just successful flashing. It is the recovered Tuya config: relay on P6, button on P10, and WiFi LED on P26, which removes trial-and-error during OpenBeken setup. [#20911905]

Quick Facts

  • The switch was bought for 60 zł, about $15, which makes it a low-cost candidate for firmware replacement. [#20911905]
  • The hardware is a single-gang mains light switch with no RF and no no-neutral mode, so the design stays simple. [#20911905]
  • The Wi-Fi module is CB3S, and the generated OpenBeken template identifies the chip as BK7231N on a CB3S board. [#20911905]
  • UART flashing used RX, TX, GND, and 3.3 V solder points, and the author notes the board flashed without removing the SOIC controller. [#20911905]
  • The imported template exposes 3 active pins: P6 relay, P10 button, and P26 WiFi LED, which is enough for immediate OpenBeken configuration. [#20911905]

How do I flash a Lamex LXM170 single light switch with OpenBeken using the BK7231 Easy Flash Tool?

Flash it over UART with OpenBeken and then import the detected pin mapping. 1. Solder RX, TX, GND, and 3.3 V to the LXM170 board. 2. Use BK7231 Easy Flash Tool to read the Tuya config and upload OpenBeken. 3. Generate or import the template so relay, button, and LED map correctly. The thread shows this worked on a CB3S-based LXM170 without manual GPIO guessing. [#20911905]

What is the CB3S module in the Lamex LXM170, and how does it relate to the BK7231N chip?

The CB3S is the Wi-Fi module installed on the LXM170, and in this switch it carries the BK7231N platform. "CB3S" is a Wi-Fi module that hosts the main control chip for Tuya-style devices, exposing UART and GPIOs used for flashing and switch control. The thread identifies the module visually as CB3S and the generated OpenBeken template labels the chip as BK7231N on a CB3S board. [#20911905]

Which pins on the LXM170 control the relay, button, and WiFi LED after flashing OpenBeken?

OpenBeken uses P6 for the relay, P10 for the button, and P26 for the WiFi LED on this LXM170. The generated template names them as Rel;1 on pin 6, Btn;1 on pin 10, and WifiLED_n;0 on pin 26. That 3-pin map came directly from the Tuya config readout, so no trial mapping was needed. [#20911905]

What solder connections do I need to make on the LXM170 for RX, TX, GND, and 3.3V flashing?

You need four UART power and data connections: RX, TX, GND, and 3.3 V. The thread explicitly says to solder those four lines before using the flasher, and the photos show the board wired for that purpose. Use 3.3 V, not a higher supply, because the flashing setup shown is for the low-voltage UART side of the CB3S module. [#20911905]

How do I read the original Tuya configuration from a CB3S-based switch before installing custom firmware?

Use the BK7231 Easy Flash Tool and run its Read function before changing firmware. In this case, the Read operation returned a Tuya config dump containing fields such as module: CB3S, rl1_pin: 6, bt1_pin: 10, and netled_pin: 26. That dump is the key artifact because it preserves the device’s original GPIO assignments. [#20911905]

What is OpenBeken, and why would someone use it instead of the stock Tuya firmware on a light switch?

OpenBeken is custom firmware used here to replace the stock Tuya firmware and enable local configuration. The thread shows two practical reasons: it cuts the switch off from the cloud and gives a ready path to Home Assistant after configuration. For this LXM170, OpenBeken also benefits from an imported template, so setup is faster than manual GPIO discovery. [#20911905]

How can I generate an OpenBeken template from the Tuya config dump for the Lamex LXM170?

Generate it by feeding the Tuya config dump into the OpenBeken template importer. The thread links a web importer and then shows the resulting JSON template for model LXM170, board CB3S, and chip BK7231N. That output includes the exact pin roles, plus metadata such as vendor Tuya and keywords like 1 gang. [#20911905]

Why was the LXM170 easier to flash than the other switch mentioned in the thread where the SOIC controller had to be desoldered?

It was easier because the SOIC controller did not interfere with the RX/TX lines during programming. The author says the other switch required desoldering the SOIC controller, but this LXM170 did not, since that controller was not connected to the UART pins used for flashing. That removed one risky hardware step and simplified the job. [#20911905]

What is the BK7231 Easy Flash Tool, and how does it help auto-detect GPIO configuration on BK7231 devices?

BK7231 Easy Flash Tool is the utility used here to flash the device and read its Tuya configuration. It helps auto-detect GPIO roles by extracting config values such as rl1_pin, bt1_pin, and netled_pin, which the thread then converts into an OpenBeken template. That saves time because the user does not need to probe unknown pins manually. [#20911905]

How do I connect a flashed LXM170 running OpenBeken to Home Assistant?

Configure OpenBeken with the imported template, then add it to Home Assistant using that finished OBK setup. The thread states that once the OpenBeken configuration is ready, "no need to guess anything" remains and you can already make the connection with Home Assistant. For this switch, the required functional pins are already defined as relay, button, and WiFi LED. [#20911905]

What should I check if a CB3S/BK7231N switch is not entering flash mode or not responding over UART?

Check the four wiring points first and then look for anything loading the UART lines. Confirm RX, TX, GND, and 3.3 V are soldered correctly, because those are the only connections shown for flashing. Also inspect whether another on-board controller shares RX/TX, since the thread warns that devices connected to the UART port can interfere with programming. [#20911905]

How does OpenBeken compare with ESPHome or Tasmota-style firmware for a BK7231N light switch like the LXM170?

In this thread, OpenBeken is presented as a Tasmota/ESPHome-style alternative for a BK7231N switch, not as an inferior clone. The practical comparison is that OpenBeken gives template-based local control on this CB3S board and supports Home Assistant after flashing. The author frames the guide as a firmware change for users wanting that style of integration on BK7231 hardware. [#20911905]

What safety precautions should I take when opening and flashing a mains-powered WiFi wall switch such as the Lamex LXM170?

Treat it as a mains device and work only on the low-voltage side during flashing. The thread shows the switch is a wall light switch and that flashing uses a 3.3 V UART connection, so you should open the housing carefully, expose the board, and solder only the required low-voltage pads. Avoid powering or handling the mains section while the device is disassembled. [#20911905]

Where can I find the CB3S datasheet and pinout information when identifying Tuya-based switch hardware?

The thread points directly to Tuya’s CB3S module page for identification details. That external page is used after the teardown confirms the module marking, and the board photos support the match. In practice, the thread combines that module reference with the config dump, which is more useful than a generic pinout because it reveals the exact pins used in this switch. [#20911905]

How do I verify whether a 'Polish producer' smart switch is actually a Tuya rebrand before buying it for firmware replacement?

Open the device or inspect seller materials for Tuya-style hardware clues, then confirm with the module and config. In this case, the listing says "POLISH PRODUCER LAMEX," but the teardown finds a CB3S module and the readout returns a Tuya-formatted config with fields like ap_ssid: SmartLife and module: CB3S. Those are strong signs of a Tuya-based rebrand suitable for replacement firmware. [#20911905]
Generated by the language model.
%}