logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

[bk7231n / cbu / mcu] Milfra MFA05F Motion Sensor Light Switch, teardown and dpId

gokeeper 4122 38
ADVERTISEMENT
  • #31 21224168
    roywalker777
    Level 3  
    >>21221857 Does anyone have a device with original firmware? We need to see what is being sent back and forth over the UART...
  • ADVERTISEMENT
  • #32 21243160
    DexEdson
    Level 4  
    >>21221857 My PIR sensor didn't work either until I played with the datapoints 101 and 102. Sometimes it just stops working again though and I have to reset
  • #33 21243180
    divadiow
    Level 38  
    >>21156301

    can someone do this and post the file from their MFA05F please
  • ADVERTISEMENT
  • #34 21243224
    p.kaczmarek2
    Moderator Smart Home
    Maybe you need to script a dp 101 or 102 send (with required value - which one?) in autoexec.bat?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #35 21296271
    amymariegerlach
    Level 5  
    Can someone help me please. I bought a couple of these switches to replace some cheap hubspace motion switches that were malfunctioning in my home. I successfully flashed openbeken onto the first one but I unchecked the auto config button in the easy UART flasher because I kept receiving errors, thinking I would be able to configure the device like I normally do with Tasmota devices, through the device access point. I have logged into the access point and configured my SSID info. I'm not really computer smart and don't know how or where to paste the data that is found in the beginning of this thread (dpIds, device status from tuya website, and autoexec.bat). I'm in the online app for my device and can view all of the different tabs but again don't know what to paste or where to put it to define this switch. I've found the template in screen shot 2 below but it looks like no pins or flags are transferring over and the device is still not configured even though I have "green" in the last photo.

    in case it matters...I did update to the newest firmware via OTA


    OpenBK7231N user interface with buttons for configuration, restart, and launching the web application. OpenBeken device configuration page with various settings. Screenshot of the Tuya device configuration interface.
  • ADVERTISEMENT
  • #37 21300900
    amymariegerlach
    Level 5  
    Thanks for the link.

    OK, I got the autoexec.bat file pasted into the correct location and my switch has been partially configured (see 1st pict)

    User interface for configuring OpenBK7231N device.

    I say partially because the template still has all of the generic info and nothing showed up in the pins section (pict 2)

    Device configuration template with empty fields and Tuya chip identifier.

    Am I needing to insert the other two files from the first post, the dplds, and the device status from tuya website? If yes, where do they go?
  • #38 21305821
    p.kaczmarek2
    Moderator Smart Home
    You only need autoexec.bat. This is TuyaMCU device, so no pins are used except the UART1 port, which is used for MCU communication.
    Helpful post? Buy me a coffee.
  • #39 21313159
    psyko_chewbacca
    Level 7  
    Am I the only one that has reliability issues regarding PIR motion detection with these units?

    Whatever sensitivity setting I choose (Low, Med, High), the switch will sometimes (more often than not) take a very long time to toggle ON the relay.
    Switch is in a windowless room and light sensor is supposedly deactivated.

    Overall not a whole lot impressed, it kinda defies the purpose if I need to press the button to turn ON the light 75% of the time.

Topic summary

✨ The discussion centers on the Milfra MFA05F motion sensor light switch, which uses a BK7231N chip on a CBU board with a Tuya MCU. Initial issues with device functionality were resolved by configuring the MQTT server and setting local time via the tuyaMcu_sendCurTime command, as the PIR sensor operates only during certain times (DPIDs 101 and 102). The user shared the full autoexec.bat script and device template, which was accepted into the OpenBeken device database. Flashing the device requires holding the MCU reset (RST) pin to ground during power-on to enable serial flashing, as the MCU and WiFi module are tightly integrated. Attempts to separate PIR sensor data from relay control were complicated by hardcoded MCU firmware, with no direct datapoint logging for motion detection in ESPHome or Tasmota. Sensitivity settings exist but require MCU communication. Some users reported intermittent PIR reliability and delays in relay activation. The device template includes key DPIDs for switch, relay status, PIR sensor, and brightness sensor. The community suggests sending periodic state queries and enabling TuyaMCU queue flags for stability. The original MFA05 with an ESP board is noted as simpler to flash and modify, but the MFA05F with BK7231N and Tuya MCU is more complex due to integrated MCU control.

FAQ

TL;DR: "565 devices are now listed, and 'It worked!' confirms serial flashing success" [Elektroda, p.kaczmarek2, #21064282; Elektroda, DexEdson, #21154883]. Use a 3-wire UART, hold RST low, tap CEN, then flash; add autoexec.bat to regain full PIR/relay control.

Why it matters: These steps cut Tuya cloud ties and restore 100 % local automation.

Quick Facts

• MCU & Wi-Fi: BK7231N on CBU daughter-board, 2 MB flash [Elektroda, DexEdson, post #21153263] • PIR delay adjustable 5 – 3600 s via dpID 49 [Elektroda, gokeeper, post #21055031] • Sensitivity levels: low / middle / high via dpID 48 [Elektroda, gokeeper, post #21055031] • OpenBeken database now lists 565 devices [Elektroda, p.kaczmarek2, post #21064282] • Firmware 2.1.17 blocks Cloudcutter OTA flashing [Elektroda, DexEdson, post #21153165]

What hardware is inside the Milfra MFA05F motion switch?

The wall switch hosts a BK7231N Wi-Fi SoC on a CBU Tuya module that talks to an STM-series MCU over UART. A PIR element, CDS light sensor and one 10 A relay share the MCU. No GPIOs from the BK7231N reach sensors directly [Elektroda, gokeeper, post #21055031]

Can I flash OpenBeken without desoldering the board?

Yes. Users succeeded by wiring 3.3 V, GND, RX, TX, holding the RST pad to GND during power-up, then tapping CEN to GND until ltchiptool syncs [Elektroda, DexEdson, post #21154883]

How do I enter flashing mode via UART?

  1. Connect 3.3 V, GND, RX→TX, TX→RX.
  2. Keep RST pad shorted to GND and power the module.
  3. Release RST, tap CEN to GND once or twice; console should show boot logs, then start flashing. [Elektroda, DexEdson, post #21154883]

Cloudcutter fails on firmware 2.1.17—what now?

Tuya blocked the exploit in 2.1.17, so OTA fails. Use the serial method described above or desolder the CBU. Edge-case: some units ship with glued shells, making pin access harder [Elektroda, DexEdson, post #21153165]

Which datapoints control the PIR schedule?

dpID 102 sets PIR start minute (0-1440) and dpID 101 sets end minute. If the time window excludes the current clock, motion reports stop [Elektroda, gokeeper, post #21062811]

My PIR sensor is silent after flashing—how can I fix it?

Make sure the device knows local time (tuyaMcu_sendCurTime) and push valid values to dpIDs 101/102 in autoexec.bat. Many users regained detection immediately after adding that line [Elektroda, gokeeper, post #21062811]

How can I decouple the relay from motion detection?

No public dpID does that. You must either cut the relay trace or remove the STM MCU and wire the PIR output to a BK7231N GPIO [Elektroda, p.kaczmarek2, post #21155031]

What does tuyaMCU_defWiFiState 4 do?

It makes the MCU think cloud is online, preventing some functions from locking. Add it once in autoexec.bat; save and reboot [Elektroda, p.kaczmarek2, post #21062761]

Do I need a WebApp template or just autoexec.bat?

“You only need autoexec.bat” for this TuyaMCU device; pin templates stay empty because UART is the sole connection [Elektroda, p.kaczmarek2, post #21305821]

How do I enable MQTT after migration?

Set mqtt_host and credentials, then restart. Once MQTT is active, dpID 15 (status LED mode) starts responding correctly, as one user observed [Elektroda, gokeeper, post #21062630]

How to adjust motion sensitivity and timeout?

Send tuyaMcu_sendState 48 4 X where X=0(low),1(mid),2(high). Send tuyaMcu_sendState 49 2 Y to set delay in seconds (5-3600) [Elektroda, gokeeper, post #21055031]

How do I back up the original firmware?

Run ltchiptool read_flash 0x0 0x200000 > backup.bin before flashing. A full 2 MB dump lets others compare UART frames later [Elektroda, divadiow, post #21156301]

Template settings reset after saving—why?

If your autoexec.bat clears IOs with cleario, any saved template disappears on reboot. Comment out cleario or re-apply template after you finish scripting [Elektroda, p.kaczmarek2, post #21163054]

Is the older ESP8266 version easier to hack?

Yes. The first MFA05 used an ESP-12 that flashes with standard 4-pin headers and exposes GPIOs, making relay/PIR separation trivial [Elektroda, gokeeper, post #21092461]
ADVERTISEMENT