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
dpIds
device status from tuya website
autoexec.bat
All issued fixed now! Here are some photos, screenshots, dpids and autoexect.bat










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