How can I flash a Moes 2-gang wall switch with a WB2S module and make OpenBeken control the external Tuya MCU that drives the relays and LEDs?
This is a TuyaMCU device, so the WiFi module talks to the application MCU over UART using the TuyaMCU protocol, and you must cut the RX/TX traces between the WB2S and the Tuya MCU to flash it because that UART is shared [#20550037] Flashing the WB2S itself is straightforward with RX, TX, GND and 3.3V: start the flasher, power-cycle the board, and make a 2 MB backup first [#20550126] After flashing OpenBeken, create `autoexec.bat` with `startDriver TuyaMCU`, then define the channels and map them to Tuya DPIDs; for this 2-gang switch, dpID 1 is relay/channel 1 and dpID 2 is relay/channel 2 [#20550037][#20550764] The working config is `setChannelType 1 toggle`, `linkTuyaMCUOutputToChannel 1 bool 1`, `setChannelType 2 toggle`, `linkTuyaMCUOutputToChannel 2 bool 2` [#20550764] If you want to identify any other dpIDs, watch the OpenBeken logs while pressing buttons or try them as `val` mappings, but HASS discovery for TuyaMCU is not implemented, so Home Assistant setup must be done manually in YAML [#20550819][#20551590]
AI summary based on the discussion. May contain errors.
I have bought some Moes 2 gang wall switch(WIFI+RF433) to flash with open beaken but there is a problem. It uses another MCU (66F31965) for all application control and uses WB2S (bk7231T) just to deal with Tuya via RX1 and TX1 of the module. - First of all I could not flash WB2S by bk_writer1.60.exe by any way which I tried. When I connect CEN to GND, it continues counting from zero to 15 seconds and then shows failed. If I disconnect the CEN from the GND, immediately it stops and shows failed. - Assume that I could flash it, how could I program it to deal with MCU(66F3165) to read the input switches and control the output relays and backlight LEDs? Any one can help?
This is a TuyaMCU device.
WiFi module is controling the MCU via UART, via TuyaMCU protocol.
You must cut RX/TX traces between WiFI module and TuyaMCU to flash, because the UART port for flashing is used for TuyaMCU as well.
We have a good TuyaMCU support in OpenBeken. It should be easy to run.
First you can also consider doing TuyaMCU capture:
https://www.elektroda.com/rtvforum/topic3970199.html#20528459 but that's not 100% necessary.
If you decide to desolder temporarily MCU for flashing, then you can use this guide:
[youtube]
https://www.youtube.com/watch?v=Yb3zXtBdSnE [/youtube]
Basically, after flashing openBeken, in Web App -> LittleFS, create autoexec.bat with "startDriver TuyaMCU", then reboot, then start pressing buttons and watch Web App Logs to see which dpID are used for relays. For example, press button 1, and watch log to see what happens there, which dpID is logged. Then press button 2, etc.
Then you can continue writing the config to map relays to OBK channels, like in linked examples.
I will help more if that's needed, we can do that step by step.
Thank you for your fast answer.
I bought 4 of this switch. I de-soldered one of WB2S modules and it can not be flashed by any way. I am not sure whether it's burnt or OK.
If it has been burnt, can I replace it with 8266? because I think WB2S can not be bought separately in our region.
As I saw in the videos, flashing WB2S is very hard and not as easy as WB3S which I flashed before on another device.
I have to connect the CEN to GND in less than a second or reconnect the power before 15 seconds? right?
Thanks again.
I could flash WB2S easily with your flasher and it works well.
I followed the links which you have mentioned, I copied the lines for autoexec.bat but it just has 1 channel and my switch is 2 gangs.
How can I add second channel?
I logged the info, when I press the switch 1 then the log is : publishing 1 (or 0) to channel 1
but when I press the switch 2 it will log some info which I can not understand the proper dpID.
Can you help me?
this is my log:
Thank you very much, now everything works well except for home assistant.
I have to config. OBK to introduce home assistant my device as a 2 gang switch. But I don't know how.
By the way in addition to dpID 1 and dpID 2, there were two other logs for dpID 7 and dpID 8 which were introducing a value. What about them? Are they related to other parameters like backlight state or timer or ....?
Also how can I learn the commands which are being used in autoexec.bat like: linkTuyaMCUOutputToChannel 1 bool 1 Where have the commands been explained?
Manual dpID reverse-engineering with Tuya app and OBK
You can also try setting them from OBK and observe what happens. You can link them as 'val' (value) to any other channel and then use setChannel [idx] [val] and see what happens. I am curious myself, so please try it!
Hello. Sorry for the off-topic question. I need some specific help. I purchased 4 of the same switches on Aliexpress as in this thread (3 single-channel, 1 dual-channel). They look exactly the same, only version 7, program version 2.02. With prolonged use, it turned out that they periodically lose the WiFi network and cannot connect to it on their own. The seller does not make contact, as the complaint period has already expired. Later, I bought another similar switch from another seller, also version 7, but version of the original program 2.1.6. This switch is stable. I learned how to read and write the firmware to the module using the bk7231flasher program, but I still can’t convert the switches to your program, because I don’t understand how they will work further, as I understand, they will no longer work with the Tuya program. Therefore, I decided to flash the modules with a more recent original program for Tuya. But simply copying from one module to another does not help, probably because they get the same MAC address, or maybe there are other reasons. Therefore, I am looking for original firmware for such switches (3 for single-channel and one for two-channel) with a version not lower than 2.1.6. Do you have saved backups that you could share with me? Or maybe you know where you could get such firmware? I will be glad for any help. Thank you in advance.
Reflashing 2MB from one device to another will not work. It seems there is some kind of RF/per-device calibration data in one of the memory sections, it's not just limited to MAC. WiFi may not work after such operation.
Why do you want to use Tuya program? We can help you with OBK setup.
You can also stay with Tuya and update Tuya firmware via their app.
You are right, WiFi does not work if you flash the second switch with a backup copy of the first one. It is difficult for me to deal with these issues, since this is a new area for me, and my age is far from young. I figured out Tuya, but I don't know anything about OBK. Decided to start with a simpler solution to this question, so as not to bother you with every simple (for you) issue. Tuya does not offer me updates for these devices. Maybe there is some other solution for updating the firmware? If I can't find an easy solution with a firmware update, where can I get information to learn about your system?
Suggest opening a device-specific configuration topic
You can also just open a separate topic, put some information on your device (model name, where it was bought, what it does, some photos of the PCB) and we will guide you step by step through the configuration.
>>20621351 Although it does not work, but I searched my PC and unfortunately I couldn't find any Tuya backup. Because I reinstalled my windows and many info. have been lost. Anyway sorry about that, I couldn't help. By the way, I'm not so young either (about 50), but OBK saved me from Tuya disaster, which I suffered from for many years. With OBK firmware, you can get rid of the cloud and internet.
Thank you for your attempt to help me. Before giving up Tuya, I would like to have more information. What else, besides switches, will I need to switch to OBK (do I need additional equipment)? What program in the smartphone controls the equipment? In addition to the switches, I also have an IR remote control to control my old air conditioner. There is also an outlet. I can control them through Tuya, but they will also have to be redone (if possible). I don't know the answers to these questions yet. I do not understand English, I use a translator, this also creates difficulties. And I'm already 60 years old... I can't do without help. But my switches are exactly the same as yours, I'm not sure if I need to open a new topic, if I find answers to my questions and start converting my equipment to OBK, then your experience will help me a lot.
There are many ways to control OBK devices. First of all, you can control them directly via their web page. Every device hosts an HTTP page that can be accessed with any browser. Then, you can use an external system like Home Assistant. Or you can use some Tasmota apps from Google Play (we have Tasmota compatibility).
I am not sure about IR remote, we may not have the air conditioner protocol supported yet.
So you have the same switch as in this topic?
Thanks for the clarifications. So no additional hardware is needed?
Will automation scripts not be available when managing through a browser? I already realized that it is very convenient.
I looked on Google Play, there are several Tasmota applications, you need to figure out what their differences are.
Yes, I have exactly the same switch, only the board version is not 6.1, but 7.0. Release date 2022-08-19. The WiFi module says not WB2S, but CB2S. But this, as I understand it, is not important.
OpenBeken supports WB2S and CB2S without extra hardware
No additional hardware is needed. The Home Assistant is not required, but it can help; it can do more automation. Home Assistant requires additional hardware, but it's not necessary to have Home Assistant. You can do simple automation on only OpenBeken with scripts, with SendGet command (switch can send command to light on given static IP address), etc., with Tasmota Device Groups, etc. Both WB2S (BK7231T) and CB2S (BK7231N) are supported.
Hello. I flashed the module with your firmware, configured WiFi. But what to do next? I can solder, but I don't understand anything about programming. I need a 'step-by-step' instruction.
And do you have the same device as in the first post? The TuyaMCU 2-gang wall switch?
Well, then go to the Web App, open the LittleFS tab, and create autoexec.bat with the content that is in post 6 of this topic. Save and reboot. It should create 2 buttons on the main panel and allow you to control the relays.
Hi all! I don't know what to do anymore. Maybe someone will advise something.
I flashed the switch, made autoexec.bat, one switch works fine. And the second, exactly the same, only turns on via WiFi, but does not want to turn off. And the LED blinks all the time, although the first one does not blink. But the button on the switch itself turns on and off.
I suspect that Tuya's MCU has crashed. What else can be done? Share your experience.
Hello.
Here is my journal. I turned the lamp on and off first via WiFi (the lamp turned on but did not turn off), then I turned the lamp off, on and off again with the physical button (the lamp turns on and off normally).
I updated the firmware, but it didn't help.
Hi Newly I bought one more of that switch, but inside is totally different. I bought this Moess switch from Amazon. They changed wifi module with ZTE model. And they omitted Tuya MCU, can I flash the same openbeken firmware on this new wifi module? If yes what about the flash procedure?
Hi I bought a MOES triple switch and would like to hook it up to HA: How is the easiest and best way without soldering the module to change the firmware to "friendly" for HA?
EDIT: The switches are going into the cabinet, and under HA I am ordering zigbee.
Desoldering the chip enabled BK7231 flashing tool connection
Hello First of all, a huge thank you for the software development and clear tutorials and descriptions. I purchased some Moes WIFI+ RF433 switches: 3-Gang (WB2S - BK7231T) and 2-Gang (CB2S - BK7231N). Unloading and configuring OpenBK went without any problems, pairing with HA via MQTT also. My question is about the RF433 support, because I am thinking about buying Vice switches for them (wall panel with RF433 transmitter).
Added after 19 [minutes]:
jaro.44 wrote:
How is the easiest and best way without soldering the module to change the firmware to HA "friendly"?
Hey, I programmed without desoldering the module, but I had to desolder the chip highlighted in the picture, because I could not connect BK7231 GUI Flash Tool to the module.
✨ The discussion revolves around flashing and configuring the Moes 2 gang wall switch (WIFI+RF433) using OpenBeken firmware. Users encountered issues with the WB2S module, which is controlled via UART by a TuyaMCU protocol. Solutions included cutting RX/TX traces for flashing, using specific tools like bkWriter and BK7231GUIFlashTool, and creating an autoexec.bat file for configuration. Users shared experiences with flashing, programming for dual channels, and integrating with Home Assistant (HA). Some users faced challenges with different versions of the switches and their firmware stability, while others explored the potential of RF433 support. The conversation also touched on the transition from Tuya to OpenBeken for better control and automation without cloud dependency. AI summary based on the discussion. May contain errors.
TL;DR: For 2-gang Moes WIFI+RF433 switches, "TuyaMCU device" is the key diagnosis: flash WB2S with RX, TX, GND and 3.3V, then map dpID 1 and dpID 2 in OpenBeken. This FAQ helps OpenBeken users solve flashing, UART, MQTT and Home Assistant setup issues. [#20550037]
Why it matters: The switch is not a simple GPIO relay device; the WiFi module talks to a separate MCU, so flashing and configuration must respect the shared UART path.
Alternative
Chip/module
Radio
OpenBeken note
WB2S
BK7231T
WiFi
Supported; flash with RX, TX, GND, 3.3V
CB2S
BK7231N
WiFi
Supported; used in similar Moes boards
ZTE
Zigbee equivalent
Zigbee
Not a WiFi WB2S/CB2S module
Key insight: Treat this Moes wall switch as a TuyaMCU product. First isolate the shared UART for flashing, then let OpenBeken’s TuyaMCU driver map dpID values to channels.
Quick Facts
WB2S flashing needs only 4 connections: RX, TX, GND and 3.3V; the recommended workflow starts flashing, power-cycles the module, and makes a 2 MB backup first. [#20550126]
The working 2-gang OpenBeken mapping uses dpID 1 → channel 1 and dpID 2 → channel 2, both as bool toggles. [#20550764]
The original failure mode included CEN held to GND for 15 seconds, after which bk_writer1.60.exe reported failure. [#20550017]
Home Assistant discovery was not implemented for this TuyaMCU device type in the thread, so MQTT YAML had to be written manually. [#20550819]
Board variants in the thread included version 6.1, version 7.0, release date 2022-08-19, and original program versions 2.02 and 2.1.6. [#20624011]
How do I flash a Moes 2-gang WIFI+RF433 wall switch with a WB2S BK7231T module using OpenBeken?
Flash it through the WB2S UART using RX, TX, GND and 3.3V.
Isolate the UART from the TuyaMCU before flashing.
Start BK7231GUIFlashTool or bkWriter 1.60.
Power-cycle the module, then make a 2 MB backup before writing OpenBeken.
The expert advice was: "Flashing WB2S is very easy." The module does not need CEN held low for the described successful method. [#20550126]
Why does bk_writer 1.60 fail to flash a WB2S module when CEN is connected to GND?
It fails because the flashing UART is still shared with the TuyaMCU in this switch. The user saw a 0-to-15-second countdown, then failure, while CEN stayed grounded. When CEN was disconnected, the failure appeared immediately. The recommended fix was not a longer CEN hold. Isolate RX and TX from the MCU, then flash through RX, TX, GND and 3.3V. [#20550037]
What is a TuyaMCU device, and how does OpenBeken communicate with it over UART?
A TuyaMCU device uses a separate MCU for application control, while the WiFi module exchanges Tuya protocol frames over UART. "TuyaMCU" is a device architecture that keeps relay, button and LED logic in a secondary microcontroller, while the WiFi module sends and receives datapoint commands over RX/TX serial lines. OpenBeken starts the TuyaMCU driver and maps dpID values, such as 1 and 2, to OpenBeken channels. [#20550037]
Why do I need to cut or isolate RX and TX traces between the WiFi module and TuyaMCU before flashing?
You isolate RX and TX because the same UART handles both flashing and TuyaMCU communication. If the TuyaMCU remains connected, it can drive or load the serial lines during programming. The thread states that the WiFi module controls the MCU over UART using the TuyaMCU protocol. Therefore, cutting traces or temporarily desoldering the interfering chip gives the flasher clean access to the WB2S module. [#20550037]
How do I configure autoexec.bat in OpenBeken for a Moes 2-gang TuyaMCU switch with dpID 1 and dpID 2?
Create autoexec.bat in LittleFS and map both Boolean dpIDs to toggle channels.
This configuration makes OpenBeken expose 2 channels. Channel 1 follows dpID 1, and channel 2 follows dpID 2. Save the file and reboot the device after editing. [#20550764]
How can I identify which TuyaMCU dpID controls each relay, backlight LED, timer, or other function in a Moes wall switch?
Identify dpIDs by watching OpenBeken logs while pressing buttons or changing settings. Start TuyaMCU, reboot, then press switch 1 and switch 2 separately. The log shows entries such as processing dpId 1 or processing dpId 2. For deeper reverse engineering, capture traffic before flashing and test functions in the Tuya app. You can also link a value dpID to a spare channel and send setChannel [idx] [val]. [#20550819]
What do TuyaMCU dpID 7 and dpID 8 value messages usually mean on Moes WIFI+RF433 switches?
Their meaning was not identified in the thread, but they are value-type TuyaMCU datapoints. The log showed dpID 7 and dpID 8 as DP_TYPE_VALUE with 4 data bytes and raw integer value 0. The expert suggested testing them from OpenBeken as val channels, then observing device behavior. They may represent extra functions, but the thread does not prove backlight or timer mapping. [#20550819]
How do I add a 2-gang OpenBeken TuyaMCU switch to Home Assistant manually with MQTT YAML?
Add two MQTT switch entries, one for channel 1 and one for channel 2. Use your actual OpenBeken device topic instead of WindowsOBK.
name and unique_id can be chosen freely. [#20551590]
Where can I find the MQTT state_topic and command_topic names for an OpenBeken device?
Find them on the OpenBeken MQTT page in the Web App. The thread example showed three topic patterns: command topic cmnd/obkLEDstripWindow/[Command], publish data topic obkLEDstripWindow/[Channel]/get, and receive data topic obkLEDstripWindow/[Channel]/set. For a 2-gang switch, channel 1 uses /1/get and /1/set; channel 2 uses /2/get and /2/set. [#20551590]
What is LittleFS in OpenBeken, and why is autoexec.bat created there?
LittleFS stores script files that OpenBeken can run at boot, including autoexec.bat. "LittleFS" is a flash-based file system that stores small OpenBeken configuration files, letting users add startup scripts without rebuilding firmware or hard-coding device templates. In this switch, autoexec.bat starts the TuyaMCU driver and maps dpID 1 and dpID 2 after every reboot. [#20627392]
WB2S vs CB2S — what is the difference between BK7231T and BK7231N modules for OpenBeken flashing?
WB2S uses BK7231T, while CB2S uses BK7231N, and both are supported by OpenBeken. The thread included Moes switches with WB2S on 3-gang devices and CB2S on 2-gang devices. Another user had a board version 7.0 switch dated 2022-08-19 with CB2S. The configuration concept stays similar, but the firmware build must match BK7231T or BK7231N. [#20624115]
Why does copying a full 2 MB Tuya firmware backup from one BK7231 switch to another break WiFi?
Copying a full 2 MB backup breaks WiFi because the flash contains device-specific calibration data. The thread states it is not limited to the MAC address. RF or per-device calibration sections can differ between modules. After cloning one switch backup to another, WiFi did not work. Make a backup for safety, but do not use it as a universal Tuya firmware image. [#20621331]
What should I do when a Moes switch flashed with OpenBeken turns on over WiFi but will not turn off, while the physical button still works?
Compare logs from WiFi control and physical button control, then verify TuyaMCU state messages. One reported switch turned on by WiFi but would not turn off, while the touch button worked normally. The expert first advised power-cycling, then requested a larger Web App log showing both control paths. A useful failure sign is missing or different TuyaMCU State frames after the WiFi off command. [#20632489]
How can I stop the LED from blinking on a TuyaMCU switch after flashing OpenBeken, and what does tuyaMcu_defWiFiState 4 do?
Add tuyaMcu_defWiFiState 4 to autoexec.bat, then save and reboot. This command forces the WiFi state reported to the TuyaMCU as paired and connected to cloud. It can stop status LED blinking or other MCU-side issues. The thread also records an edge case: one switch still blinked and malfunctioned even after this line, so logs were needed. [#20632144]
What is the ZTE module in a newer Moes switch, and how is it different from WB2S or CB2S WiFi modules?
The ZTE module is a Zigbee module, not a WiFi WB2S or CB2S replacement. The thread identifies the Z marking as Zigbee and describes ZTE as a Zigbee equivalent of WB2S, CB2S and TYWE2S form factors. Therefore, the same OpenBeken WiFi flashing process for BK7231T or BK7231N does not apply to that newer Moes switch. [#21039004]
AI summary based on the discussion. May contain errors.