logo elektroda
logo elektroda
X
logo elektroda

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

gokeeper 4278 38
ADVERTISEMENT
  • #1 21055031
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5
    I recently purchased a few milfra mfa05f motion sensor light switches, they use CBU board with tuya mcu.

    All issued fixed now! Here are some photos, screenshots, dpids and autoexect.bat

    MILfra MFA05F motion sensor light switch. Motion sensor light switch model MFA05F with connected wires. Close-up image of the inside of a light switch enclosure. PCB board with electronic components and connected wires Close-up of an electronic board above a motion sensor light switch. Circuit board with mounted electronic components and a button. Smart switch packaging with Google Assistant and Amazon Alexa logos. Photo of MFA05F light switch box with Wi-Fi option checked. MFA05F motion sensor light switch interface on a phone screen with PIR, ON, timing, and setting icons. Screenshot of motion sensor light switch settings in a mobile app.


    dpIds

    
    1
    开关1
    switch_1	Boolean	
    "{true,false}"
    
    14
    上电状态设置
    relay_status	Enum	
    {
      "range": [
        "off",
        "on",
        "memory"
      ]
    }
    
    15
    指示灯状态设置
    light_mode	Enum	
    {
      "range": [
        "none",
        "relay",
        "pos"
      ]
    }
    
    43
    光敏开关
    cds_switch	Boolean	
    "{true,false}"
    
    44
    光敏状态
    cds_state	Enum	
    {
      "range": [
        "on",
        "off"
      ]
    }
    
    
    45
    光照度检测阀值
    cds_threshold	Enum	
    {
      "range": [
        "default",
        "now"
      ]
    }
    
    46
    感应开关
    switch_pir	Boolean	
    "{true,false}"
    
    47
    感应状态
    pir_state	Enum	
    {
      "range": [
        "on",
        "off"
      ]
    }
    
    
    48
    感应灵敏度
    pir_sensitivity	Enum	
    {
      "range": [
        "low",
        "middle",
        "high"
      ]
    }
    
    49
    感应延时
    pir_delay	Integer	
    {
      "unit": "s",
      "min": 5,
      "max": 3600,
      "scale": 0,
      "step": 1
    }
    
    101
    PIR结束时间设置
    appointment_time	Integer	
    {
      "unit": "min",
      "min": 0,
      "max": 1440,
      "scale": 0,
      "step": 1
    }
    
    102
    PIR开始时间设置
    target_time	Integer	
    {
      "unit": "min",
      "min": 0,
      "max": 1440,
      "scale": 0,
      "step": 1
    }
    
    103
    定时
    timer	Raw	
    {
      "maxlen": 128
    }
    


    device status from tuya website

    
    {
        "result": {
          "properties": [
            {
              "code": "switch_1",
              "custom_name": "",
              "dp_id": 1,
              "time": 1713732560211,
              "value": true
            },
            {
              "code": "relay_status",
              "custom_name": "",
              "dp_id": 14,
              "time": 1713727545549,
              "value": "off"
            },
            {
              "code": "light_mode",
              "custom_name": "",
              "dp_id": 15,
              "time": 1713727545554,
              "value": "relay"
            },
            {
              "code": "cds_switch",
              "custom_name": "",
              "dp_id": 43,
              "time": 1713730746434,
              "value": false
            },
            {
              "code": "cds_state",
              "custom_name": "",
              "dp_id": 44,
              "time": 1713727545656,
              "value": "on"
            },
            {
              "code": "cds_threshold",
              "custom_name": "",
              "dp_id": 45,
              "time": 1713730823352,
              "value": "default"
            },
            {
              "code": "switch_pir",
              "custom_name": "",
              "dp_id": 46,
              "time": 1713727936883,
              "value": true
            },
            {
              "code": "pir_state",
              "custom_name": "",
              "dp_id": 47,
              "time": 1713727545679,
              "value": "on"
            },
            {
              "code": "pir_sensitivity",
              "custom_name": "",
              "dp_id": 48,
              "time": 1713730849083,
              "value": "middle"
            },
            {
              "code": "pir_delay",
              "custom_name": "",
              "dp_id": 49,
              "time": 1713727545700,
              "value": 5
            },
            {
              "code": "appointment_time",
              "custom_name": "",
              "dp_id": 101,
              "time": 1713727545856,
              "value": 1439
            },
            {
              "code": "target_time",
              "custom_name": "",
              "dp_id": 102,
              "time": 1713727545868,
              "value": 60
            },
            {
              "code": "timer",
              "custom_name": "",
              "dp_id": 103,
              "time": 1713727546706,
              "value": "AA=="
            }
          ]
        },
        "success": true,
        "t": 1713732562424,
        "tid": "a1b5376b002011efa39e7a9cb4325afa"
      }
    


    autoexec.bat

    
    //ntp
    startDriver NTP
    ntp_setServer 1.ca.pool.ntp.org
    
    startDriver TuyaMCU
    tuyaMcu_sendCurTime
    
    // set TuyaMCU baud rate
    //tuyaMcu_setBaudRate 115200
    // emulate being connected to cloud
    tuyaMCU_defWiFiState 4
    
    cleario
    
    //main relay
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 1 1 1
    setChannelLabel 1 relay
    
    //brightless sensor switch
    setChannelType 2 Toggle
    linkTuyaMCUOutputToChannel 43 1 2
    setChannelLabel 2 cbs
    //enable cbs sensor
    //setChannel 2 1
    
    //motion sensor
    setChannelType 3 Toggle
    linkTuyaMCUOutputToChannel 46 1 3
    setChannelLabel 3 pir
    //enable pir sensor
    //setChannel 3 1
    
    //motion sensor delay
    linkTuyaMCUOutputToChannel 49 2 4
    setChannelType 4 TextField
    setChannelLabel 4 PIR-delay
    //set motion sensor delay to 120s
    setChannel 4 120
    
    //motion sensor sensitivity
    linkTuyaMCUOutputToChannel 48 4 5
    setChannelType 5 LowMidHigh
    setChannelLabel 5 PIR-sensitivity
    //set motion sensor sensitivity to Mid
    setChannel 5 1
    
    //set status led to white while relay is off, red while relay is on
    tuyaMcu_sendState 15 4 1
    
    //set pir start time
    tuyaMcu_sendState 102 2 1
    
    //set pir end time
    tuyaMcu_sendState 101 2 1440
    
  • ADVERTISEMENT
  • #2 21058675
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Are you sure that you're mapping this to channel with a correct variable type?

    Have you tried to use tuyaMcu_sendState command to set state directly, without doing the channel mapping?
    Helpful post? Buy me a coffee.
  • #3 21062630
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5
    Thanks for the reply, I tried tuyaMcu_sendState but same result. However, I found out as soon as I configured mqtt server, the status LED / DPid 15 works as expected. I have tuyaMCU_defWiFiState 4 in autoexec.bat all the time, no idea what's the connection with mqtt server.
  • #4 21062761
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Can you share your full autoexec.bat?

    The tuyaMCU_defWiFiState 4 can't just randomly work or not, are you sure that you are saving and either reexecuting autoexec.bat or restarting your device?

    Does the device fix itself after you power it on and off?
    Helpful post? Buy me a coffee.
  • #5 21062811
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5
    It isn't randomly work or not, it suddenly stopped working. I just found out it's because I didn't set local time, since the pir sensor will only work at centain time of the day (dpId 102 and 101). All good after I add tuyaMcu_sendCurTime.

    full autoexec.bat
    
    //ntp
    startDriver NTP
    ntp_setServer 1.ca.pool.ntp.org
    
    startDriver TuyaMCU
    tuyaMcu_sendCurTime
    
    // set TuyaMCU baud rate
    //tuyaMcu_setBaudRate 115200
    // emulate being connected to cloud
    tuyaMCU_defWiFiState 4
    
    cleario
    
    //main relay
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 1 1 1
    setChannelLabel 1 relay
    
    //brightless sensor switch
    setChannelType 2 Toggle
    linkTuyaMCUOutputToChannel 43 1 2
    setChannelLabel 2 cbs
    //enable cbs sensor
    //setChannel 2 1
    
    //motion sensor
    setChannelType 3 Toggle
    linkTuyaMCUOutputToChannel 46 1 3
    setChannelLabel 3 pir
    //enable pir sensor
    //setChannel 3 1
    
    //motion sensor delay
    linkTuyaMCUOutputToChannel 49 2 4
    setChannelType 4 TextField
    setChannelLabel 4 PIR-delay
    //set motion sensor delay to 120s
    setChannel 4 120
    
    //motion sensor sensitivity
    linkTuyaMCUOutputToChannel 48 4 5
    setChannelType 5 LowMidHigh
    setChannelLabel 5 PIR-sensitivity
    //set motion sensor sensitivity to Mid
    setChannel 5 1
    
    //set status led to white while relay is off, red while relay is on
    tuyaMcu_sendState 15 4 1
    
    //set pir start time
    tuyaMcu_sendState 102 2 1
    
    //set pir end time
    tuyaMcu_sendState 101 2 1440
    
    
  • #6 21062891
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    I see, is everything working correctly for you now? You may also want to enable TuyaMCU queue in the flags.
    Helpful post? Buy me a coffee.
  • #7 21063555
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5

    p.kaczmarek2 wrote:
    I see, is everything working correctly for you now?

    Yes, feel free to add the data to the device database.

    p.kaczmarek2 wrote:
    You may also want to enable TuyaMCU queue in the flags.

    Will do, thanks!
  • #8 21063862
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    gokeeper wrote:
    Yes, feel free to add the data to the device database.


    please post your device template from web app

    Screenshot from a web application showing device configuration.
  • #9 21063865
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5

    divadiow wrote:
    gokeeper wrote:
    Yes, feel free to add the data to the device database.


    please post your device template from web app

    Screenshot from a web application showing device configuration.

    This is a mcu device, I have included autoexec.bat in OP.
  • ADVERTISEMENT
  • #10 21063870
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    indeed but the template makes adding the device to device list easier
  • Helpful post
    #11 21063907
    gokeeper
    Level 4  
    Posts: 9
    Help: 2
    Rate: 5

    Got it, here it is

    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Milfra MFA05F Motion Sensor Light Switch",
      "model": "MFA05F",
      "chip": "BK7231N",
      "board": "CBU",
      "flags": "1024",
      "keywords": [
        "Milfra",
        "MFA05F",
        "Switch",
        "Motion Sensor",
        "BK7231N",
        "CBU",
        "MCU"
      ],
      "pins": {},
      "command": "",
      "image": "https://obrazki.elektroda.pl/9024105700_1714244652.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/viewtopic.php?p=21063870#21063870"
    }
    

  • #13 21064282
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Thank you, the PR is now accepted. The device should be soon live at:
    https://openbekeniot.github.io/webapp/devicesList.html
    We have 565 devices currently, but I would love to get to 600 soon!
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #14 21092088
    roywalker777
    Level 3  
    Posts: 4

    @gokeeper Can you explain how you flashed this? Did you have to desolder the CBU? I can't get mine to connect using the TX/RX, GND, and 3.3v on the connector. Don't suppose you made/can make a video?
  • ADVERTISEMENT
  • #16 21092594
    roywalker777
    Level 3  
    Posts: 4
    Same as yours... was trying to flash via serial.
  • #17 21153165
    DexEdson
    Level 4  
    Posts: 5
    Has anyone been able to flash this via serial without removing the chip? I received one that has firmware 2.1.17 so unfortunately I can't flash with cloudcutter. I have been trying to use ltchiptool, but it never connects to the chip. Connecting CEN to GND for 1/2 second seems to reset it since the light blinks, but no matter how many times I do it, ltchiptool never connects.
  • #18 21153171
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    This is TuyaMCU device. You can't really flash it as it is. You need to either remove the WiFi module, or remove the MCU, or cut the connection to MCU.

    Alternatively, if you can, and know how, you can put MCU in the RESET state for the time of the flashing.
    Helpful post? Buy me a coffee.
  • #19 21153263
    DexEdson
    Level 4  
    Posts: 5
    >>21153171 There is an RST pin, I will try connecting it to GND while flashing.
  • #20 21153264
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Let us know how it goes. How do you know which pin is MCU RST?
    Helpful post? Buy me a coffee.
  • #21 21154883
    DexEdson
    Level 4  
    Posts: 5
    >>21153264 It worked! There is a spot labeled 'RST' on the board. I kept it connected to GND during power on. Then I tapped CEN to GND a few times and eventually ltchiptool started flashing.

    I was hoping to be able to read the motion sensor data without triggering the relay, so I could use this switch on a circuit with smart bulbs. Unfortunately everything seems to be hard coded into the MCU. I installed ESPHome and set logging to verbose, but no datapoint is logged for motion detection. I'm still glad I was able to cut the cloud, I'll just have to find a different use for this thing.
  • #22 21155031
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Is it possible to set PIR sensitivity there?

    Maybe you could just remove the MCU and connect relay and PIR to WiFiModule.

    However, some PIRs have a sensitivity setup via PWM, so maybe you would also need to take care about that...
    Helpful post? Buy me a coffee.
  • #23 21156163
    DexEdson
    Level 4  
    Posts: 5
    >>21155031 There is a PIR sensitivity setting through the MCU. I wouldn't even need to move the relay... as long as the PIR is disconnected from the MCU and directly accessible from GPIO, the relay can be controlled by automation. But this is getting too complex for me, too bad this version is not as simple as the original MFA05. If anyone knows where to get the original MFA05 with the ESP board, please let me know!!
  • #24 21156232
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Do you have 2MB flash backup? Maybe there is a dpID to decouple relay from PIR? There are some dpIDs in the first post, did you check all of them? @divadiow ?
    Helpful post? Buy me a coffee.
  • #25 21156301
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    I can try to confirm existing info/get missing with full firmware backup or config extract.

    OpenBK user interface page displaying device status for Plug, USB1, and USB2.
  • #26 21163009
    ljnett
    Level 2  
    Posts: 2
    I got it flashed by holding rst to ground. When I try to apply the template it seems to take it but then just goes back to default. I updated autoexc.bat and then get the three switches as shown above, but pir does not appear to work. Can toggle the main relay just fine. Suggestions on what I am doing wrong?
  • #27 21163054
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    So what is your autoexec.bat now? If relays are working, then communication must be working. Maybe you need to send a query state every few seconds?
    Helpful post? Buy me a coffee.
  • #28 21164315
    ljnett
    Level 2  
    Posts: 2
    I used the autoexec.bat from the post above. It just appears PIR sensor and light sensor are not working. The relay toggles if I push the switch button or toggle it from the browser. I'm thinking I may just have a defective unit as I never tried it before flashing. If I can get the sensor working, I would also like to disconnect the relay from it.
  • #29 21177153
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12432
    Maybe TuyaMCU expects some extra data, like setting the sensitivity of the PIR sensor, at least once in it's lifetime?
    Helpful post? Buy me a coffee.
  • #30 21221857
    roywalker777
    Level 3  
    Posts: 4
    Did anyone get the PIR sensor to activate? @ljnett It's not defective, I have 2 of them and with Tasmota or ESPhome, they both are like that.

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.
Generated by the language model.

FAQ

TL;DR: This FAQ maps 13 dpIDs and explains why “You only need autoexec.bat” for the Milfra MFA05F. It is for OpenBeken users who flashed the BK7231N/CBU switch but lost PIR behavior, LED control, or active-hour logic until time sync and DP 101/102 were set correctly. [#21305821]

Why it matters: The thread shows that this switch can look half-broken after flashing even when the relay works, because the MCU still expects time, UART commands, and valid PIR scheduling.

Wariant Moduł / architektura Jak go flashowano w wątku Główna konsekwencja
Starszy Milfra MFA05 ESP board Opisany jako łatwiejszy do flashowania Prostsza konfiguracja i mniej zależności od TuyaMCU
Nowszy Milfra MFA05F BK7231N + CBU + TuyaMCU tuya-cloudcutter lub serial po zablokowaniu MCU Wymaga autoexec.bat, dpID i synchronizacji czasu

Key insight: The PIR path is controlled by the external MCU, not by direct GPIO. If local time or DP 101/102 are wrong, the sensor can stop triggering even though Wi‑Fi, browser control, and the relay still work. [#21062811]

Quick Facts

  • pir_delay on dpID 49 accepts 5–3600 s in 1 s steps, so motion hold time is configurable over a full 59 min 55 s range. [#21055031]
  • The active PIR window uses dpID 102 start time and dpID 101 end time, each in 0–1440 min steps. A full-day window was set as 1 to 1440. [#21062811]
  • Serial flashing attempts used the connector with TX/RX, GND, and 3.3 V, but one user only succeeded after grounding the board RST point and pulsing CEN. [#21154883]
  • One blocked device reported Tuya firmware 2.1.17, which prevented use of tuya-cloudcutter and pushed the user toward ltchiptool over serial. [#21153165]
  • The shared device template identifies BK7231N, CBU, model MFA05F, and flag value 1024, while the maintainer said the project had 565 devices and wanted to reach 600. [#21063907]

How do I configure the Milfra MFA05F motion sensor light switch in OpenBeken using the autoexec.bat from the thread?

Use the posted autoexec.bat exactly, because this device is driven through TuyaMCU rather than normal GPIO pin mapping. 1. Start NTP and TuyaMCU, then call tuyaMcu_sendCurTime. 2. Define Wi‑Fi state with tuyaMCU_defWiFiState 4. 3. Create channels for relay, brightness switch, PIR switch, PIR delay, and PIR sensitivity, then send dpID states for LED mode and PIR hours. The working example sets PIR delay to 120 s, sensitivity to Mid, and active hours to 1–1440 min. [#21062811]

Why does the PIR sensor on the Milfra MFA05F stop working until tuyaMcu_sendCurTime and the DP 101/102 time window are set correctly?

The PIR stops because the MCU enforces an internal time schedule. The fix was not MQTT itself; it was sending local time with tuyaMcu_sendCurTime and keeping dpID 102 start time plus dpID 101 end time valid. The user confirmed the switch “suddenly stopped working” because local time was missing, and motion resumed after time sync was added. A full-day schedule was sent as start 1 min and end 1440 min. [#21062811]

What are the TuyaMCU dpIDs for the Milfra MFA05F, including relay, PIR, light sensor, sensitivity, delay, and timer functions?

The mapped dpIDs are: 1 relay switch_1, 14 power-on state, 15 status LED mode, 43 light-sensor enable, 44 light-sensor state, 45 light threshold mode, 46 PIR enable, 47 PIR state, 48 PIR sensitivity, 49 PIR delay, 101 PIR end time, 102 PIR start time, and 103 timer raw data. That gives 13 datapoints in the shared dump. Sensitivity supports low, middle, high, and delay spans 5–3600 s. [#21055031]

What is a TuyaMCU device, and how is it different from a normal OpenBeken device that uses direct GPIO pins?

A TuyaMCU device does not expose most functions as direct GPIO roles inside OpenBeken. "TuyaMCU" is a microcontroller-based control layer that handles sensors and relay logic over UART, instead of letting the Wi‑Fi chip drive each pin directly. On this MFA05F, OpenBeken mainly talks through UART1, while the external MCU owns PIR, timing, and mode logic. That is why the maintainer said you only need autoexec.bat, not a normal pin template. [#21305821]

What is the CBU module in a BK7231N switch, and why does it matter for flashing and configuration?

The CBU is the Wi‑Fi module fitted in this switch, and it matters because you flash that module, not the whole motion-control design. "CBU" is a BK7231N-based Wi‑Fi module that runs the network firmware, while a separate MCU still controls relay and sensor behavior through serial communication. That split explains why flashing OpenBeken alone does not automatically expose PIR as a direct sensor. The posted template names the board CBU and chip BK7231N. [#21063907]

How can I flash the BK7231N/CBU version of the Milfra MFA05F with tuya-cloudcutter instead of serial flashing?

Use tuya-cloudcutter only if your unit still supports that cloud exploit path. One user flashed this exact BK7231N/CBU MFA05F with tuya-cloudcutter and moved it to OpenBeken without serial work. Another user later reported firmware 2.1.17, which blocked cloudcutter and forced serial experiments instead. The practical rule from the thread is simple: if cloudcutter works on your firmware, it is easier than fighting the TuyaMCU board over serial. [#21092461]

What steps worked for flashing the MFA05F via serial with ltchiptool by holding the board RST pad to GND and pulsing CEN?

The successful serial method was to keep the board’s RST pad tied to GND during power-on, then pulse CEN to GND until ltchiptool connects. 1. Ground the pad labeled RST. 2. Power the board while RST stays low. 3. Tap CEN to GND a few times until flashing starts. The user said this finally worked after repeated failures, and the board light blinked during reset attempts. [#21154883]

Why does applying the web app template on this MFA05F seem to revert to default, while autoexec.bat still creates the working channels?

It happens because the template is not the main configuration mechanism for this TuyaMCU design. The maintainer explained that this device uses no normal pins except UART1, so the web template can still look generic while autoexec.bat creates working relay, PIR, and delay channels. A user saw the template appear to reset, yet the browser UI still exposed three switches after copying the script. In short, the script matters more than the template here. [#21305821]

How do I set the status LED mode, PIR delay, PIR sensitivity, and active hours on the Milfra MFA05F with tuyaMcu_sendState commands?

Send the settings directly to the MCU using the datapoint numbers from the working script. The thread uses tuyaMcu_sendState 15 4 1 for LED mode, links dpID 49 to a text field and sets 120 s delay, maps dpID 48 to LowMidHigh and sets value 1 for Mid, then sends dpID 102 start time 1 and dpID 101 end time 1440. Those values restored expected LED and PIR behavior on the posted unit. [#21062811]

What does the OpenBeken flag for TuyaMCU queue do, and when should it be enabled on devices like the MFA05F?

The thread recommends enabling the TuyaMCU queue when this switch is working but still depends on several UART commands and state exchanges. The maintainer suggested that the user “may also want to enable TuyaMCU queue in the flags” right after the final working setup was confirmed. The shared template later showed flags value 1024, which matches that recommendation in the posted device entry. Use it on MCU-driven devices where orderly command handling matters. [#21063907]

How can I troubleshoot a flashed MFA05F where the relay works from the browser but the PIR and brightness sensor do not respond?

First, verify time sync and the PIR schedule. 1. Add startDriver NTP, set an NTP server, and call tuyaMcu_sendCurTime. 2. Send valid dpID 101/102 active hours. 3. Explicitly set PIR sensitivity and delay at least once. The failure pattern in the thread was clear: relay control worked from the browser, but PIR and light-sensor behavior failed until time and schedule were corrected. Another user later said PIR sometimes still needed dpID 101/102 adjustments or a reset. [#21243160]

What is the difference between the older Milfra MFA05 with an ESP board and the newer MFA05F with BK7231N CBU and TuyaMCU?

The older MFA05 is easier to repurpose because it uses an ESP-based design, while the newer MFA05F adds a BK7231N CBU module plus a separate TuyaMCU. The thread explicitly calls the older version “easy to flash,” but the newer board needs cloudcutter compatibility or careful serial work. That hardware split also limits sensor access: on the MFA05F, PIR behavior stays inside the MCU unless you keep its UART protocol satisfied. [#21092461]

How could I capture or inspect the UART traffic from the MFA05F running original Tuya firmware to discover missing datapoints or initialization commands?

Keep one switch on original firmware and log the serial exchange between the Wi‑Fi module and the MCU. The thread proposed exactly that after users found missing PIR behavior under Tasmota and ESPHome. One participant asked for a device with original firmware so they could see “what is being sent back and forth over the UART,” and another requested a 2 MB flash backup or config extract to confirm missing datapoints. That is the cleanest path to discover hidden initialization. [#21224168]

What options are there for decoupling the PIR sensor from the relay on the Milfra MFA05F so it can be used with smart bulbs and automations?

You have only hardware-heavy options in this thread. The maintainer said you could remove the MCU, remove the Wi‑Fi module, or cut the MCU connection, then wire the relay and PIR differently. Another user wanted PIR events without relay triggering for smart bulbs, but found the behavior hard-coded in the MCU and saw no motion datapoint logged in ESPHome. The same reply warned that some PIR circuits may need PWM-based sensitivity handling, so the mod can grow complex fast. [#21155031]

Why is PIR motion detection on some MFA05F units unreliable even with the light sensor disabled and sensitivity set to low, medium, or high?

The thread never reached a final root cause, but it points to MCU-side initialization and schedule state. One user reported the light turned on late “more often than not,” even in a windowless room with the light sensor supposedly disabled. Others said PIR did not work until they changed dpID 101/102, and one unit sometimes needed a reset afterward. The best thread-backed explanation is incomplete MCU state, not a simple OpenBeken GPIO issue. [#21243160]
Generated by the language model.
ADVERTISEMENT