logo elektroda
logo elektroda
X
logo elektroda

Seeking Template for [BK7231N] Tuya 8-in-1 Air Quality Monitor PV28-CW After OpenBeken Flash

markiespark 4878 30
ADVERTISEMENT
  • #1 20965286
    markiespark
    Level 4  

    White air quality measurement device with a display showing values for CO2, PM2.5, HCHO, and TVOC.
    Hi,
    This is the device. It's wifi, and needs to be powered from USB, as the internal battery seems to quickly run down.

    I've managed, through luck and determination to get OpenBeken on this device using Tuya Cloudcutter on a Rpi4. Whilst there is no current template for it, I managed to flash it by choosing Tuya Generic and the PM2.5 device selected. Strangely, it put the device in cloudcut mode when the initial upload failed, but after another attempt at connecting the AP with connection errors, and more waiting, it finally uploaded OBK. I was lucky not to brick it.

    So far all I know is it's a BK7231N chip as indicated on the config screen (I'm a noob at OBK having only flashed one other device). As the flash was successful I didn't want to risk damaging the sensors opening it up. Updating the build via OTA also worked without any issues.

    It's a blank canvas, and I can't find a similar template to play with. Is there a way I can get more info experimenting from the web interface without damaging the unit? Also, is there a safe way to find out if it has a MCU?
  • ADVERTISEMENT
  • Helpful post
    #2 20966444
    p.kaczmarek2
    Moderator Smart Home
    Does it still go to sleep automatically (after firmware change)? If yes, it's TuyaMCU.
    Is there a baud key in Tuya config? If yes, then it's TuyaMCU.
    For TuyaMCU devices, you can try to query state via command:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md

    Added after 1 [minutes]:

    Tuya config extraction: https://www.youtube.com/watch?v=WunlqIMAdgw&ab_channel=Elektrodacom
    Helpful post? Buy me a coffee.
  • #3 20967673
    markiespark
    Level 4  
    Thanks for helping a noob.
    The device doesn't sleep when plugged into USB or internal battery (which lasts about half an hour on a full charge)

    Here's the output from startDriver TuyaMCU & tuyaMcu_sendQueryState at Debug log level in the web app:
    (I've replaced my actual wifi info with 'MYWIFI')

    Info:MAIN:Time 119, idle 195157/s, free 76168, MQTT 0(7), bWifi 1, secondsWithNoPing 49, socks 2/38 
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [startDriver TuyaMCU]
    Debug:CMD:Adding command tuyaMcu_testSendTime
    Debug:CMD:Adding command tuyaMcu_sendCurTime
    Debug:CMD:Adding command linkTuyaMCUOutputToChannel
    Debug:CMD:Adding command tuyaMcu_setDimmerRange
    Debug:CMD:Adding command tuyaMcu_sendHeartbeat
    Debug:CMD:Adding command tuyaMcu_sendQueryState
    Debug:CMD:Adding command tuyaMcu_sendProductInformation
    Debug:CMD:Adding command tuyaMcu_sendState
    Debug:CMD:Adding command tuyaMcu_sendMCUConf
    Debug:CMD:Adding command fakeTuyaPacket
    Debug:CMD:Adding command tuyaMcu_setBaudRate
    Debug:CMD:Adding command tuyaMcu_sendRSSI
    Debug:CMD:Adding command tuyaMcu_defWiFiState
    Debug:CMD:Adding command tuyaMcu_sendColor
    Debug:CMD:Adding command tuyaMcu_setupLED
    Info:MAIN:Started TuyaMCU.
    Info:CMD:[WebApp Cmd 'startDriver TuyaMCU' Result] OK
    Info:MAIN:Time 120, idle 176688/s, free 74728, MQTT 0(7), bWifi 1, secondsWithNoPing 50, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-63,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Consumed 50 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 80 00 FE 00 FE 00 00 00 00 00 00 00 FE 00 00 F8 00 00 F8 00 FE 00 00 00 E0 00 FE 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 121, idle 185271/s, free 74728, MQTT 0(7), bWifi 1, secondsWithNoPing 51, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 01 00 32 7B 22 70 22 3A 22 79 72 72 33 65 69 79 69 61 63 6D 33 31 73 6B 69 22 2C 22 76 22 3A 22 31 2E 30 2E 30 22 2C 22 6D 22 3A 30 2C 22 6C 6F 77 22 3A 31 7D 40 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 1 (QueryProductInformation) len 57
    Info:TuyaMCU:ParseQueryProductInformation: received {"p":"yrr3eiyiacm31ski","v":"1.0.0","m":0,"low":1}
    Info:MAIN:Time 122, idle 186379/s, free 74728, MQTT 0(7), bWifi 1, secondsWithNoPing 52, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 02 00 00 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 2 (MCUconf) len 7
    Info:TuyaMCU:ProcessIncoming: TUYA_CMD_MCU_CONF, TODO!
    Info:MAIN:Time 123, idle 186170/s, free 74728, MQTT 0(7), bWifi 1, secondsWithNoPing 53, socks 2/38 
    Info:TuyaMCU:TuyaMCU packet too large, 154 > 128
    Info:MAIN:Time 124, idle 199569/s, free 74728, MQTT 0(7), bWifi 1, secondsWithNoPing 54, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 05 9B B9 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1435
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1435) not mapped
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [tuyaMcu_sendQueryState]
    Info:CMD:[WebApp Cmd 'tuyaMcu_sendQueryState' Result] OK
    Info:TuyaMCU:TuyaMCU packet too large, 154 > 128
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 125, idle 185437/s, free 74728, MQTT 0(8), bWifi 1, secondsWithNoPing 55, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 03 00 00 05 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 3 (WiFiState) len 7
    Info:MAIN:Time 126, idle 188596/s, free 74728, MQTT 0(8), bWifi 1, secondsWithNoPing 56, socks 2/38 
    Info:MAIN:Time 127, idle 187760/s, free 74728, MQTT 0(8), bWifi 1, secondsWithNoPing 57, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 05 9A B8 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1434
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1434) not mapped
    Info:MAIN:Time 128, idle 195721/s, free 74496, MQTT 0(8), bWifi 1, secondsWithNoPing 58, socks 3/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 15 02 00 04 00 00 00 D9 05 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 21 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 217
    Debug:TuyaMCU:ApplyMapping: id 21 (val 217) not mapped
    Info:MAIN:Time 129, idle 191509/s, free 74728, MQTT 0(8), bWifi 1, secondsWithNoPing 59, socks 2/38 
    Info:MAIN:Time 130, idle 384178/s, free 74728, MQTT 0(8), bWifi 1, secondsWithNoPing 60, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-63,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 05 94 15 02 00 04 00 00 00 D7 AC 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1428
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1428) not mapped
    Info:TuyaMCU:ParseState: id 21 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 215
    Debug:TuyaMCU:ApplyMapping: id 21 (val 215) not mapped


    It then repeats the heartbeats, parseStates and wifi info over and over. On a reboot, the MCU driver is lost and has to be reactivated.

    And here's the extraction from the UART Flasher app, although it doesn't give us much info:
    Code: JSON
    Log in, to see the code


    Sorry, no meaningful pins data found. This device may be TuyaMCU or a custom one with no Tuya config data.
    Baud keyword found, this device may be TuyaMCU or BL0942. Baud value is 9600}e
    No module information found.
    And the Tuya section starts at UNCOMMON POSITION 0
  • #4 20967797
    p.kaczmarek2
    Moderator Smart Home
    Well, by the sound of it you don't know yet how to run commands at the device start. Consult autoexec.bat tutorial:



    Also please check out config samples:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    I can also see you're getting a packet too large error:
    
    Info:TuyaMCU:TuyaMCU packet too large, 154 > 128
    

    That's very strange! We haven't encountered that kind of problem yet. Let me increase the buffer and then please update your device. Next, retry the query and post results here.
    https://github.com/openshwprojects/OpenBK7231...mmit/7bc81116d8fae1113b4e6edbac081b24676ada7b
    Helpful post? Buy me a coffee.
  • #5 20969610
    markiespark
    Level 4  
    Ok, I've re-run the query and it looks like that 'package too large' error has gone. Still don't understand any of this, but I hope some of the values here are something to go on:

    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 101 (val 11) not mapped
    Info:MAIN:Time 370, idle 178384/s, free 74520, MQTT 0(23), bWifi 1, secondsWithNoPing 300, socks 3/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:MAIN:Time 371, idle 185198/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 301, socks 2/38 
    Info:MAIN:Time 372, idle 190958/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 302, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 56 73 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1110
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1110) not mapped
    Info:MAIN:Time 373, idle 192068/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 303, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 66 02 00 04 00 00 00 07 65 02 00 04 00 00 00 0C 03 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 7
    Debug:TuyaMCU:ApplyMapping: id 102 (val 7) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 12
    Debug:TuyaMCU:ApplyMapping: id 101 (val 12) not mapped
    Info:MAIN:Time 374, idle 180954/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 304, socks 2/38 
    Info:MAIN:Time 375, idle 188247/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 305, socks 2/38 
    Info:MAIN:Time 376, idle 189056/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 306, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 377, idle 189481/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 307, socks 2/38 
    Info:MAIN:Time 378, idle 182963/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 308, socks 2/38 
    Info:MAIN:Time 379, idle 187234/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 309, socks 2/38 
    Info:MAIN:Time 380, idle 193500/s, free 74736, MQTT 0(23), bWifi 1, secondsWithNoPing 310, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-68,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 14 02 00 04 00 00 00 0B 36 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 20 (val 11) not mapped
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 381, idle 179722/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 311, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 5C 79 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1116
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1116) not mapped
    Info:MAIN:Time 382, idle 183805/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 312, socks 2/38 
    Info:MAIN:Time 383, idle 186808/s, free 74520, MQTT 0(24), bWifi 1, secondsWithNoPing 313, socks 3/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 14 02 00 04 00 00 00 0A 66 02 00 04 00 00 00 06 AF 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 20 (val 10) not mapped
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 6
    Debug:TuyaMCU:ApplyMapping: id 102 (val 6) not mapped
    Info:MAIN:Time 384, idle 184323/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 314, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 385, idle 184829/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 315, socks 2/38 
    Info:MAIN:Time 386, idle 187710/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 316, socks 2/38 
    Info:MAIN:Time 387, idle 188962/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 317, socks 2/38 
    Info:MAIN:Time 388, idle 189102/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 318, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 64 81 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1124
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1124) not mapped
    Info:MAIN:Time 389, idle 184309/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 319, socks 2/38 
    Info:MAIN:Time 390, idle 187585/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 320, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-68,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:MAIN:Time 391, idle 181016/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 321, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 63 80 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1123
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1123) not mapped
    Info:MAIN:Time 392, idle 185155/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 322, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 393, idle 188008/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 323, socks 2/38 
    Info:MAIN:Time 394, idle 186829/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 324, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 61 7E 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1121
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1121) not mapped
    Info:MAIN:Time 395, idle 185357/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 325, socks 2/38 
    Info:MAIN:Time 396, idle 190310/s, free 74736, MQTT 0(24), bWifi 1, secondsWithNoPing 326, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 397, idle 189262/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 327, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 65 02 00 04 00 00 00 0B 87 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 101 (val 11) not mapped
    Info:MAIN:Time 398, idle 184657/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 328, socks 2/38 
    Info:MAIN:Time 399, idle 189938/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 329, socks 2/38 
    Info:MAIN:Time 400, idle 188154/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 330, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 401, idle 182482/s, free 74520, MQTT 0(25), bWifi 1, secondsWithNoPing 331, socks 3/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 60 7D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1120
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1120) not mapped
    Info:MAIN:Time 402, idle 188398/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 332, socks 2/38 
    Info:MAIN:Time 403, idle 190031/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 333, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 62 7F 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1122
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1122) not mapped
    Info:MAIN:Time 404, idle 188099/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 334, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 405, idle 205762/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 335, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 48 02 02 00 04 00 00 04 62 14 02 00 04 00 00 00 09 66 02 00 04 00 00 00 06 65 02 00 04 00 00 00 0B 16 02 00 04 00 00 00 01 15 02 00 04 00 00 00 01 12 02 00 04 00 00 00 17 13 02 00 04 00 00 00 41 67 02 00 04 00 00 00 41 3A 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 79
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1122
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1122) not mapped
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 9
    Debug:TuyaMCU:ApplyMapping: id 20 (val 9) not mapped
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 6
    Debug:TuyaMCU:ApplyMapping: id 102 (val 6) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 101 (val 11) not mapped
    Info:TuyaMCU:ParseState: id 22 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1
    Debug:TuyaMCU:ApplyMapping: id 22 (val 1) not mapped
    Info:TuyaMCU:ParseState: id 21 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1
    Debug:TuyaMCU:ApplyMapping: id 21 (val 1) not mapped
    Info:TuyaMCU:ParseState: id 18 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 23
    Debug:TuyaMCU:ApplyMapping: id 18 (val 23) not mapped
    Info:TuyaMCU:ParseState: id 19 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 65
    Debug:TuyaMCU:ApplyMapping: id 19 (val 65) not mapped
    Info:TuyaMCU:ParseState: id 103 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 65
    Debug:TuyaMCU:ApplyMapping: id 103 (val 65) not mapped
    Info:MAIN:Time 406, idle 158224/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 336, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 04 60 65 02 00 04 00 00 00 0A FA 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1120
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1120) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 101 (val 10) not mapped
    Info:MAIN:Time 407, idle 182610/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 337, socks 2/38 
    Info:MAIN:Time 408, idle 189966/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 338, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 409, idle 187316/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 339, socks 2/38 
    Info:MAIN:Time 410, idle 185608/s, free 74432, MQTT 0(25), bWifi 1, secondsWithNoPing 340, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:MAIN:Time 411, idle 187186/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 341, socks 2/38 
    Info:MAIN:Time 412, idle 183115/s, free 74736, MQTT 0(25), bWifi 1, secondsWithNoPing 342, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 413, idle 186929/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 343, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 4F 6C 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1103
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1103) not mapped
    Info:MAIN:Time 414, idle 182456/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 344, socks 2/38 
    Info:MAIN:Time 415, idle 188295/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 345, socks 2/38 
    Info:MAIN:Time 416, idle 187505/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 346, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 417, idle 188957/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 347, socks 2/38 
    Info:MAIN:Time 418, idle 187086/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 348, socks 2/38 
    Info:MAIN:Time 419, idle 189774/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 349, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 03 00 00 05 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 3 (WiFiState) len 7
    Info:MAIN:Time 420, idle 187624/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 350, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 421, idle 182009/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 351, socks 2/38 
    Info:MAIN:Time 422, idle 189712/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 352, socks 2/38 
    Info:MAIN:Time 423, idle 188388/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 353, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 51 6E 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1105
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1105) not mapped
    Info:MAIN:Time 424, idle 187138/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 354, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 425, idle 187398/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 355, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 50 6D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1104
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1104) not mapped
    Info:MAIN:Time 426, idle 186266/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 356, socks 2/38 
    Info:MAIN:Time 427, idle 188719/s, free 74736, MQTT 0(26), bWifi 1, secondsWithNoPing 357, socks 2/38 
    Info:MAIN:Time 428, idle 187529/s, free 74520, MQTT 0(26), bWifi 1, secondsWithNoPing 358, socks 3/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 53 70 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1107
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1107) not mapped
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 429, idle 184920/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 359, socks 2/38 
    Info:MAIN:Time 430, idle 186370/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 360, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:MAIN:Time 431, idle 184616/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 361, socks 2/38 
    Info:MAIN:Time 432, idle 188732/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 362, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 433, idle 188136/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 363, socks 2/38 
    Info:MAIN:Time 434, idle 188700/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 364, socks 2/38 
    Info:MAIN:Time 435, idle 194276/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 365, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 04 51 65 02 00 04 00 00 00 09 EA 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1105
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1105) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 9
    Debug:TuyaMCU:ApplyMapping: id 101 (val 9) not mapped
    Info:MAIN:Time 436, idle 182644/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 366, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 14 02 00 04 00 00 00 08 33 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 8
    Debug:TuyaMCU:ApplyMapping: id 20 (val 8) not mapped
    Info:MAIN:Time 437, idle 187731/s, free 66128, MQTT 0(27), bWifi 1, secondsWithNoPing 367, socks 3/38 
    Info:MAIN:Time 438, idle 185478/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 368, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 53 70 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1107
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1107) not mapped
    Info:MAIN:Time 439, idle 186857/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 369, socks 2/38 
    Info:MAIN:Time 440, idle 187598/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 370, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 441, idle 188288/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 371, socks 2/38 
    Info:MAIN:Time 442, idle 185692/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 372, socks 2/38 
    Info:MAIN:Time 443, idle 187972/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 373, socks 2/38 
    Info:MAIN:Time 444, idle 188163/s, free 74736, MQTT 0(27), bWifi 1, secondsWithNoPing 374, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 445, idle 374768/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 375, socks 2/38 
    Info:MAIN:Time 446, idle 188248/s, free 66128, MQTT 0(28), bWifi 1, secondsWithNoPing 376, socks 3/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 14 02 00 04 00 00 00 09 34 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 9
    Debug:TuyaMCU:ApplyMapping: id 20 (val 9) not mapped
    Info:MAIN:Time 447, idle 376874/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 377, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 04 4F 65 02 00 04 00 00 00 0A E9 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1103
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1103) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 101 (val 10) not mapped
    Info:MAIN:Time 448, idle 182941/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 378, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 449, idle 369119/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 379, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 0F 02 00 04 00 00 00 2E 54 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 15 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 46
    Debug:TuyaMCU:ApplyMapping: id 15 (val 46) not mapped
    Info:MAIN:Time 450, idle 184929/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 380, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:MAIN:Time 451, idle 185934/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 381, socks 2/38 
    Info:MAIN:Time 452, idle 187020/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 382, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 453, idle 187900/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 383, socks 2/38 
    Info:MAIN:Time 454, idle 187239/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 384, socks 2/38 
    Info:MAIN:Time 455, idle 191172/s, free 74520, MQTT 0(28), bWifi 1, secondsWithNoPing 385, socks 3/38 
    Info:MAIN:Time 456, idle 191097/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 386, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 457, idle 182505/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 387, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 04 4A 65 02 00 04 00 00 00 0B E5 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1098
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1098) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 101 (val 11) not mapped
    Info:MAIN:Time 458, idle 181076/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 388, socks 2/38 
    Info:MAIN:Time 459, idle 188936/s, free 74520, MQTT 0(28), bWifi 1, secondsWithNoPing 389, socks 3/38 
    Info:MAIN:Time 460, idle 188599/s, free 74736, MQTT 0(28), bWifi 1, secondsWithNoPing 390, socks 2/38 
    Info:GEN:dhcp=0 ip=10.0.0.158 gate=10.0.0.2 mask=255.255.255.0 mac=d8:d6:68:88:3b:16
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-67,ssid=MYWIFI,bssid=3c:7c:3f:84:4c:d8,channel=8,cipher_type:CCMP
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 10 02 02 00 04 00 00 04 49 14 02 00 04 00 00 00 0A 92 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 23
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1097
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1097) not mapped
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 20 (val 10) not mapped
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 461, idle 178810/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 391, socks 2/38 
    Info:MAIN:Time 462, idle 188846/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 392, socks 2/38 
    Info:MAIN:Time 463, idle 189255/s, free 66128, MQTT 0(29), bWifi 1, secondsWithNoPing 393, socks 3/38 
    Info:MAIN:Time 464, idle 201864/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 394, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 465, idle 191935/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 395, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 48 02 02 00 04 00 00 04 49 14 02 00 04 00 00 00 0A 66 02 00 04 00 00 00 06 65 02 00 04 00 00 00 0B 16 02 00 04 00 00 00 01 15 02 00 04 00 00 00 01 12 02 00 04 00 00 00 17 13 02 00 04 00 00 00 41 67 02 00 04 00 00 00 41 22 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 79
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1097
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1097) not mapped
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 20 (val 10) not mapped
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 6
    Debug:TuyaMCU:ApplyMapping: id 102 (val 6) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 11
    Debug:TuyaMCU:ApplyMapping: id 101 (val 11) not mapped
    Info:TuyaMCU:ParseState: id 22 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1
    Debug:TuyaMCU:ApplyMapping: id 22 (val 1) not mapped
    Info:TuyaMCU:ParseState: id 21 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1
    Debug:TuyaMCU:ApplyMapping: id 21 (val 1) not mapped
    Info:TuyaMCU:ParseState: id 18 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 23
    Debug:TuyaMCU:ApplyMapping: id 18 (val 23) not mapped
    Info:TuyaMCU:ParseState: id 19 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 65
    Debug:TuyaMCU:ApplyMapping: id 19 (val 65) not mapped
    Info:TuyaMCU:ParseState: id 103 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 65
    Debug:TuyaMCU:ApplyMapping: id 103 (val 65) not mapped
    Info:MAIN:Time 466, idle 160159/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 396, socks 2/38 
    Info:MAIN:Time 467, idle 188110/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 397, socks 2/38 
    Info:MAIN:Time 468, idle 190735/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 398, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:MAIN:Time 469, idle 182868/s, free 74736, MQTT 0(29), bWifi 1, secondsWithNoPing 399, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 02 02 00 04 00 00 04 4A 67 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1098
    Debug:TuyaMCU:ApplyMapping: id 2 (val 1098) not mapped
  • ADVERTISEMENT
  • Helpful post
    #6 20969759
    p.kaczmarek2
    Moderator Smart Home
    This looks much better now. You are correctly receiving dpIDs along with their types and values.

    Now, every variable in TuyaMCU is described by dpID (unique identifier), type (like an integer, or string, or enum) and current value.

    The main problem with that is that we don't know what each dpID means, you we need to figure out which dpID is, for example, a temperature (maybe divided by 10), which is humidity, etc, etc.

    There is a way to get this from Tuya, but that is done before flashing:
    https://www.elektroda.com/rtvforum/topic4021129.html

    Now, you have a device that is already flashed. So you can take different approach:
    1. look for other devices like that, maybe on Tasmota, maybe some dpIDs are matching?
    This is not a reliable approach, but it sometimes works.

    2. Look at the device screen, what kind of numbers do you see? Do they match some values on log? Let's consider few of them:
    
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 7
    Debug:TuyaMCU:ApplyMapping: id 102 (val 7) not mapped
    Info:TuyaMCU:ParseState: id 101 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 12
    Info:TuyaMCU:ParseState: id 20 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 10
    Debug:TuyaMCU:ApplyMapping: id 20 (val 10) not mapped
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 6
    

    What could have value 6? What could be 10? Do the capture and at the same time look at the device screen. Tell me what matches. Execute tuyaMcu_sendQueryState to get new values from the MCU.

    Once you figure out the variable meaning, you can map it to channel and add to autoexec.bat, see samples:https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Helpful post? Buy me a coffee.
  • #7 20971249
    markiespark
    Level 4  
    Great, and thanks again. This is progressing well. Matching the values to the screen readings was fairly easy. After this line:
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 79 - a summary list appears.
    I focused on one and verified the changes. Here's what I've found:

    (Note: zeros are not actual figures - just displaying the number format & measurement for info)

    All the air quality sensor ids are 'type 2-val len 4' and 'int32'

    id2 = CO2 (format is 0000 ppm)
    id20 = PM2.5 (0000 ug/m3)
    id102 = PM1.0 (0000 ug/m3)
    id101 = PM10 (0000 ug/m3)
    id22 = HCHO (0.000 mg/m3)
    id21 = TVOC (0.000 mg/m3)
    id18 = Temp (00 c)
    id19 = Humidity (00%)
    id103 = Humidity (00%)
    id15 = Battery (00%)
    id17 = Screen wake timeout (17 or less?)

    The HCHO & TVOC ids were both at 0.001 so until one changes I can't verify which way round they are.

    Humidity
    A mystery why this is reported on both id19 and id103, but it is.

    The battery
    id15 reports as a decreasing number until USB is plugged in, then increases. Once at 100% id15 isn't reported at all - even when unplugged it got to 96% before being reported again.

    Screen wake
    id17 is erratic. Gets reported as 11 - 17 when tapping the on button when asleep. When waving my hand over the sensor, sometimes the value starts at 4 or 5 - 9. When persistently activated sometimes the number increases. I'm not sure if this is a light level of some kind. The wait is too long to be in seconds, but it might be accumulative.

    I still need to work out the ids for, the 'unhealthy', 'poor', 'good' labels, as well as the alarm beeps, but this is a good start.
  • ADVERTISEMENT
  • #8 20971404
    p.kaczmarek2
    Moderator Smart Home
    Very good job! If you need to have any specific OBK channel types for those variables, let me know.

    However, the preferred solution for such custom devices is the scriptable OBK page:
    OpenBeken as a mini HTTP hosting - writing pages in Javascript, Tasmota REST
    Or you can just ignore interface altogether and forward it to Home Assistant.

    Here you can find a sample custom page for TuyaMCU device made by user:
    https://www.elektroda.com/rtvforum/topic4022907-60.html#20932186
    Helpful post? Buy me a coffee.
  • #9 20974088
    markiespark
    Level 4  
    I discovered the TuyaMCU Explorer app which helped filter out a lot of the logs, but I only found found two more entries which rarely appear - id1 and id14 which are both a '4-enum len 1' value of either 0 or 1 so far (byte).
    I thought Id1 might be the alarm, or maybe just the CO2 alarm. It appeared shortly after I breathed over it, but only once.
    id14 is another that and appears rarely and randomly.
    After messing around with this thing enough, I believe I've got all of the ids now or at least, the ones that matter.

    So far I've added the following to autoexec.bat:

    // Start TuyaMCu driver
    startDriver TuyaMCU
    
    // set baud (as key was 9600)
    tuyaMCU_setBaudRate 9600


    I've also \placeholder ID names for mappings.

    However, I'm finding the channel and channel types confusing. The web app warns about setting wrong values.
    Are there only 31 channels, and does it matter which channel is mapped to an ID? Is there a risk to the device?
    And if there are endless channels, should I map the ID number to the same channel no?

    Would this example work ok and show the result on the device OBK page? (assuming id2, type 2-value, and linking to channel 2).

    // Set dpID 2 (CO2)
    
    linkTuyaMCUOutputToChannel 2 2 2


    If so, this would be sufficient to pass through to Home Assistant with the rest of the sensors. The javascript stuff looked nice, but is a bit beyond me to be honest.
  • #10 20974509
    p.kaczmarek2
    Moderator Smart Home
    You can map any dpID to any channel, but we have limited number of channels, so I wouldn't suggest mapping the same dpID to the same channel.

    Where the web app warns?

    You can do:
    
    setChannelType 2 ReadOnly
    setChannelLabel 2 CO2
    // linkTuyaMCUOutputToChannel dpId varType tgChannel
    linkTuyaMCUOutputToChannel 2 2 2
    

    You may also enable "always publish tuyamcu channels" flag in flags.
    Helpful post? Buy me a coffee.
  • Helpful post
    #11 21004234
    markiespark
    Level 4  
    Ok, I've been busy with other things and only just got back to this. Here is my latest autoexec.bat with most things discovered.
    
    // Tuya PV28-CW 8-in-1 Air Quality Sensor config
    
    // Start TuyaMCu driver
    startDriver TuyaMCU
    
    // Set baud (as key was 9600)
    tuyaMCU_setBaudRate 9600
    
    //  Mappings [dpID] [varType] [tgChannel]
    
    // CO2 (ppm) - map dpID 2, type var(2) to Ch 1
    setChannelLabel 1 "CO2 (ppm)"
    setChannelType 1 ReadOnly
    linkTuyaMCUOutputToChannel 2 2 1
    
    // PM2.5 (ug/m3) - map dpID 20, type var(2) to Ch 2
    setChannelLabel 2 "PM2.5 (ug/m3)"
    setChannelType 2 ReadOnly
    linkTuyaMCUOutputToChannel 20 2 2
    
    // PM1.0 (ug/m3 - map dpID 102, type var(2) to Ch 3
    setChannelLabel 3 "PM1.0 (ug/m3)"
    setChannelType 3 ReadOnly
    linkTuyaMCUOutputToChannel 102 2 3
    
    // PM10 (ug/m3) - map dpID 101, type var(2) to Ch 4
    setChannelLabel 4 "PM10 (ug/m3)"
    setChannelType 4 ReadOnly
    linkTuyaMCUOutputToChannel 101 2 4
    
    // HCHO (ug/m3) - map dpID 22, type var(2) to Ch 5
    setChannelLabel 5 "HCHO (ug/m3)"
    setChannelType 5 ReadOnly
    linkTuyaMCUOutputToChannel 22 2 5
    
    // TVOC (ug/m3) - map dpID 21, type var(2) to Ch 6
    setChannelLabel 6 "TVOC (ug/m3)"
    setChannelType 6 ReadOnly
    linkTuyaMCUOutputToChannel 21 2 6
    
    // Temperature (C) - map dpID 18, type var(2) to Ch 7
    setChannelType 7 Temperature
    linkTuyaMCUOutputToChannel 18 2 7
    
    // Humidity ID19 (%) - map dpID 19, type var(2) to Ch 8
    setChannelType 8 Humidity
    linkTuyaMCUOutputToChannel 19 2 8
    
    // Humidity ID103 (%) - map dpID 103, type var(2) to Ch 9
    setChannelType 9 Humidity
    linkTuyaMCUOutputToChannel 103 2 9
    
    // Battery Charge (%) - map dpID 15, type var(2) to Ch 10
    setChannelType 10 BatteryLevelPercent
    linkTuyaMCUOutputToChannel 15 2 10
    
    // Display State - map dpID 17, type var(2) to Ch 11
    setChannelLabel 11 "Display (0 Off, 100-1 On)"
    setChannelType 11 ReadOnly
    linkTuyaMCUOutputToChannel 17 2 11
    
    // Unknown ID4 - map dpID 4, type enum(4) to Ch 12
    setChannelLabel 12 "Unknown ID14 (?)"
    setChannelType 12 ReadOnly
    linkTuyaMCUOutputToChannel 4 4 12
    
    // Charge State - map dpID 14, type enum(4) to Ch 13
    setChannelLabel 13 "Charge State (1 Charging, 0 Discharging)"
    setChannelType 13 ReadOnly
    linkTuyaMCUOutputToChannel 14 4 13
    
    // Alarm State - map dpID 106, type enum(4) to Ch 14
    setChannelLabel 14 "Alarm State (1 Reset, 0 Triggered)"
    setChannelType 14 ReadOnly
    linkTuyaMCUOutputToChannel 106 4 14
    
    // Unknown ID1 - map dpID 1, type enum(4) to Ch 15
    setChannelLabel 15 "Unknown ID1 (?)"
    setChannelType 15 ReadOnly
    linkTuyaMCUOutputToChannel 1 4 15


    There's still the unknown ID1 and ID14 placeholders left to discover, and proper decimalisation of the results. In time and experimentation, I'll have a go at the html to make the results look a little less basic, but this will do for now. Thanks again for all the help getting me going with this. It's a fun little project.
  • #12 21004365
    divadiow
    Level 34  
    1 and 14

    Code: JSON
    Log in, to see the code


    Code: JSON
    Log in, to see the code
  • #13 21004424
    markiespark
    Level 4  

    Cheers, I'll give this a try, but it doesn't look like autoexec format. Where do I put this?
  • #14 21004437
    divadiow
    Level 34  
    oh no, ignore the format but pull the values for the bits you need in each to make the autoexec entry
  • #15 21075407
    stoatwblr
    Level 4  

    I little thread necromancy: Were the original Tuya App dpIDs extracted?

    I have one of these devices which is still on original firmware and am happy to have a stab at if needed
  • #17 21075603
    p.kaczmarek2
    Moderator Smart Home
    Helpful post? Buy me a coffee.
  • #18 21078921
    stoatwblr
    Level 4  

    >>20965286

    It's surprisingly easy to get it open.

    The LCD bezel is held on by double-sided tape and can be (carefully) popped off with a fingernail
    Then there are simply 4 screws to remove

    Two air quality measurement devices and an LCD casing on a wooden desk
  • #19 21176273
    stoatwblr
    Level 4  
    >>21078921

    If a fingernail doesn't work, I've found a miniature "dent puller" suction cup works pretty well on these kinds of devices - they're only a couple of euros (less on Aliexpress) and very handy additions to the toolkit
  • #20 21177054
    p.kaczmarek2
    Moderator Smart Home
    I see, it indeed looks easy. Do you have some photos showing the inside board of this device?

    More and more devices are patched these days so it's crucial to know how to flash by wires. Check out our Elektroda IoT device flashing guides for more info:
    https://www.youtube.com/playlist?list=PLzbXEc2ebpH0CZDbczAXT94BuSGrd_GoM
    Helpful post? Buy me a coffee.
  • #21 21177255
    stoatwblr
    Level 4  
    >>21177054
    To flash this, the Tuya module must be removed, or the TX/RX tracks temporarily cut
    There are 100R resistors in series to the MCU, so these can be unsoldered

    Unfortunately all of these parts are under the display and the adhesive holding it down is _strong_. Be careful or you'll pulling the display backlight reflecting sheet off

    Comms to the MCU is at 9600bps

    DpIDs: (Edit - added 15 and noted 107)

    1: enum RO, CO2 alarm state (1=OK, 0=alarm level exceeded)
    2: int RO, CO2, ppm (0-5000) 400-5000 according to the maker website
    13: boolean RW: Alarm enable
    14: enum RO, charge state (0=battery, 1=charging)
    15: int RO, battery %
    17: int RO, Light level (0-99) 0=display sleeping, autodimming works below 30
    18: int RO, Temperature, C (0-50) -1C
    19 int RO, humidity, % (0-99) -5%
    20: int RO, PM2.5, ug/m^3 (0-1000)
    21: int RO, TVOC, ug/m^3 (0-9999)
    22: int RO, HCHO, ug/m^3 (0-1999)
    26: int RW, CO2 alarm threshold ppm (0-5000) (I set 800-5000, step 100)
    31: enum RW, Temp display unit (0=C, anything else = F)
    101: int RO, PM10, ug/m^3 (0-1000)
    102: int RO, PM1.0, ug/m^3 (0-1000)
    103: int RO, humidity, % (dpid 19 repeated)
    105: int RW, PM2.5 alarm level 0-1000 (I set 25-1000, step 25)
    106: enum RO, PM2.5 alarm (1=OK, 0=alarm level exceeded)
    107: switch, unknown - "PROBABLY" automatic periodic calibration. I'm assuming 1 is on
    108: switch, display sleep enable
    109: Int RW, display sleep timer (sec) no limit, I set 0-3600 step 10

    claimed PM2,2.5,10 accuracy is -10ug/m^3 up to 100ug/m^3, -10% above that

    No "AQI" or battery state DpID is provided, even though they are displayed

    Additionally. the MCU sometimes stops providing sensor updates - Does anyone know if there's a Tuya command to reset the MCU?

    The unit's maker appears to be ggele.com (http://www.ggele.com/productinfo/937823.html)

    MCU is a FMD (Fremont Micro devices) B1rWCGK - https://www.fremontmicro.com/en/ - and appears to be one of their LQFP48 package ARM M0 or M3 cpus (tech docs are on the chinese side of the site, the english side is sparse)

    The battery is only 350mAh and appears to be mainly for bridging use - it only lasts about an hour when not plugged in

    CO2 sensing uses NDIR and appears to be extremely accurate
    PM sensing is using a PMS7003 clone


    NOTE WELL: Check your unit for fan noise.

    If there isn't any, check the fan inside the PM sensor - in mine, the fan rotor assembly was completely dismounted from the frame. I assume the package was dropped.
    Repairing was easy - carefully pop open the unvented side of the sensor case and put the roter shaft back into the bearing. Magnetic forces will grab and centre it (no need to worry about a clip on the end of the rotor) The unit still works with the fan stalled, but lask of air ciculation inside the case makes it very slow to respond to environmental changes

    Added after 44 [minutes]:

    Image of an electronic circuit board with surface-mounted components, including a CBU module and a flexible ribbon cable.
    Open casing of an electronic device showing a battery module and circuit board.
    Close-up of an integrated circuit on a green circuit board with visible pins on the sides.
  • #23 21257126
    AleXSR700
    Level 2  
    Hi there,
    I just ordered one of these and usually use Tasmota (or pvvx firmware for Xiaomi) but am new to OpenBeken.

    Can this device be flashed and is fully functional afterwards, i.e. can be connected to an MQTT broker and publish the correct data for the 8 sensors?

    Thank you for your help
    Alex
  • ADVERTISEMENT
  • #24 21257135
    p.kaczmarek2
    Moderator Smart Home
    It seems that more or less complete autoexec.bat is already in this topic:
    https://www.elektroda.com/rtvforum/topic4036569.html#21004234
    so most of the work is done. Of course, Tuya may have changed something in a meantime, but I would still recommend you to give it a try. Just make sure to make 2MB flash backup so you can revert to Tuya just in case. We'll try to help if an issue arise.
    Helpful post? Buy me a coffee.
  • #25 21257235
    AleXSR700
    Level 2  
    Oh, okay, you refer to posts as topics. I usually think in threads & posts.

    So I guess I will need to figure out how to read the different formats posted here (1 & 14 seem to be a different syntax).

    The original device, as far as I know, needs calibrating. I think it is some kind of automatic process. Will OpenBeken let me perform that auto calibration somehow?
  • #26 21257832
    p.kaczmarek2
    Moderator Smart Home
    Are you refering to this?
    stoatwblr wrote:

    107: switch, unknown - "PROBABLY" automatic periodic calibration. I'm assuming 1 is on

    I don't have this device at hand so I can't say for sure, but if you know dpID, then you can send given datapoint value from OpenBeken to MCU.
    Helpful post? Buy me a coffee.
  • #27 21258473
    AleXSR700
    Level 2  
    Possible. I was referring to stock firmware. As far as I know it has an automatic recalibration which needs to be performed when first used (and presumably periodically thereafter).
  • #28 21344079
    alexmontes80
    Level 3  
    Dears,
    I'm a bit lost sorry, you have completed this data... for not so experimented colleagues, What can we do? is there an oficial template?
    Thank you


    // Tuya PV28-CW 8-in-1 Air Quality Sensor config
    
    // Start TuyaMCu driver
    startDriver TuyaMCU
    
    // Set baud (as key was 9600)
    tuyaMCU_setBaudRate 9600
    
    //  Mappings [dpID] [varType] [tgChannel]
    
    // CO2 (ppm) - map dpID 2, type var(2) to Ch 1
    setChannelLabel 1 "CO2 (ppm)"
    setChannelType 1 ReadOnly
    linkTuyaMCUOutputToChannel 2 2 1
    
    // PM2.5 (ug/m3) - map dpID 20, type var(2) to Ch 2
    setChannelLabel 2 "PM2.5 (ug/m3)"
    setChannelType 2 ReadOnly
    linkTuyaMCUOutputToChannel 20 2 2
    
    // PM1.0 (ug/m3 - map dpID 102, type var(2) to Ch 3
    setChannelLabel 3 "PM1.0 (ug/m3)"
    setChannelType 3 ReadOnly
    linkTuyaMCUOutputToChannel 102 2 3
    
    // PM10 (ug/m3) - map dpID 101, type var(2) to Ch 4
    setChannelLabel 4 "PM10 (ug/m3)"
    setChannelType 4 ReadOnly
    linkTuyaMCUOutputToChannel 101 2 4
    
    // HCHO (ug/m3) - map dpID 22, type var(2) to Ch 5
    setChannelLabel 5 "HCHO (ug/m3)"
    setChannelType 5 ReadOnly
    linkTuyaMCUOutputToChannel 22 2 5
    
    // TVOC (ug/m3) - map dpID 21, type var(2) to Ch 6
    setChannelLabel 6 "TVOC (ug/m3)"
    setChannelType 6 ReadOnly
    linkTuyaMCUOutputToChannel 21 2 6
    
    // Temperature (C) - map dpID 18, type var(2) to Ch 7
    setChannelType 7 Temperature
    linkTuyaMCUOutputToChannel 18 2 7
    
    // Humidity ID19 (%) - map dpID 19, type var(2) to Ch 8
    setChannelType 8 Humidity
    linkTuyaMCUOutputToChannel 19 2 8
    
    // Humidity ID103 (%) - map dpID 103, type var(2) to Ch 9
    setChannelType 9 Humidity
    linkTuyaMCUOutputToChannel 103 2 9
    
    // Battery Charge (%) - map dpID 15, type var(2) to Ch 10
    setChannelType 10 BatteryLevelPercent
    linkTuyaMCUOutputToChannel 15 2 10
    
    // Display State - map dpID 17, type var(2) to Ch 11
    setChannelLabel 11 "Display (0 Off, 100-1 On)"
    setChannelType 11 ReadOnly
    linkTuyaMCUOutputToChannel 17 2 11
    
    // Unknown ID4 - map dpID 4, type enum(4) to Ch 12
    setChannelLabel 12 "Unknown ID14 (?)"
    setChannelType 12 ReadOnly
    linkTuyaMCUOutputToChannel 4 4 12
    
    // Charge State - map dpID 14, type enum(4) to Ch 13
    setChannelLabel 13 "Charge State (1 Charging, 0 Discharging)"
    setChannelType 13 ReadOnly
    linkTuyaMCUOutputToChannel 14 4 13
    
    // Alarm State - map dpID 106, type enum(4) to Ch 14
    setChannelLabel 14 "Alarm State (1 Reset, 0 Triggered)"
    setChannelType 14 ReadOnly
    linkTuyaMCUOutputToChannel 106 4 14
    
    // Unknown ID1 - map dpID 1, type enum(4) to Ch 15
    setChannelLabel 15 "Unknown ID1 (?)"
    setChannelType 15 ReadOnly
    linkTuyaMCUOutputToChannel 1 4 15



    Code: JSON
    Log in, to see the code
  • #29 21358711
    markiespark
    Level 4  
    >>21344079
    My latest autoexec is below, updated with the help of stoatwblr's contribution.
    I also don't understand the JSON part, and where to use that, but no matter.
    Whilst not every function has been discovered, it works adequate enough that I'd settle for it at this point. However, these problems remain:
    1. Getting the values from the screen to display the same on the web. The '_div10' or 1000 etc. settings simp/y don't work. The same problem applies with MQTT in Home Assistant.
    2. When saving the autoexec it sometimes corrupts and parts go missing. In some cases I have to do the whole AP thing again. Frustrating.
    3. I'm not skilled in html. Fortuntately, ChatGPT has helped design a page similar to the actual interface - and it worked for a while. However, because of (2) it also got corrupted.

    I've also noticed a lot of messages in the logs about channel changes. Not sure if it's anything to worry about, but it would imply that the clearIO function might not be working. I don't know.

    I could try lfs_format (as I read it can help with the corruption issue when updating the firmware to the latest version) - but I don't know the size of the chip, nor what size I should allocate to the command. It looks like both the autoexec with labelling and html can end up using a fair bit of space. Any ideas guys?

    // Tuya PV28-CW 8-in-1 Air Quality Sensor autoexec.bat
    
    // Clear previous autoexec settings
    clearIO
    
    // clear flags
    // flags 0
    
    // set flag 46
    SetFlag 46 1
    
    // Start TuyaMCu driver at Baud 9600
    startDriver TuyaMCU
    tuyaMCU_setBaudRate 9600
    
    // If not using MQTT comment out waitFor MQTTState 1 or
    // If using MQTT comment out tuyaMcu_defWiFiState 4
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Force update from TuyaMCU every 10 sec
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    
    // Mappings [dpID] [varType] [tgChannel]
    
    // CO2 (ppm) - Dp 2 - Ch 1
    setChannelLabel 1 "CO2 (ppm)"
    setChannelType 1 ReadOnly
    setDisplayStyle 1 Box
    linkTuyaMCUOutputToChannel 2 var 1
    
    // PM2.5 (ug/m3) - Dp 20 -Ch 2
    setChannelLabel 2 "PM2.5 (ug/m3)"
    setChannelType 2 ReadOnly
    linkTuyaMCUOutputToChannel 20 var 2
    
    // PM1.0 (ug/m3 - Dp 102 - Ch 3
    setChannelLabel 3 "PM1.0 (ug/m3)"
    setChannelType 3 ReadOnly
    linkTuyaMCUOutputToChannel 102 var 3
    
    // PM10 (ug/m3) - Dp 101 - Ch 4
    setChannelLabel 4 "PM10 (ug/m3)"
    setChannelType 4 ReadOnly
    linkTuyaMCUOutputToChannel 101 var 4
    
    // HCHO (ug/m3) - Dp 22 - Ch 5
    setChannelLabel 5 "HCHO (ug/m3)"
    setChannelType 5 ReadOnly
    linkTuyaMCUOutputToChannel 22 var 5
    
    // TVOC (ug/m3) - Dp 21 - Ch 6
    setChannelLabel 6 "TVOC (ug/m3)"
    setChannelType 6 ReadOnly
    linkTuyaMCUOutputToChannel 21 var 6
    
    // Temperature (C) - Dp 18 - Ch 7
    setChannelType 7 Temperature
    linkTuyaMCUOutputToChannel  18 var 7
    
    // Humidity ID19 (%) - Dp 19 - Ch 8
    setChannelType 8 Humidity
    linkTuyaMCUOutputToChannel 19 var 8
    
    // Humidity ID103 (%) - Dp 103 - Ch 9
    setChannelType 9 Humidity
    linkTuyaMCUOutputToChannel 103 var 9
    
    // Battery Charge (%) - Dp 15 - Ch 10
    setChannelType 10 BatteryLevelPercent
    linkTuyaMCUOutputToChannel 15 var 10
    
    // Display Brightness Level - Dp 17 - Ch 11
    setChannelLabel 11 "Display Brightness Level (0-99)"
    setChannelType 11 ReadOnly
    linkTuyaMCUOutputToChannel 17 var 11
    
    // CO2 Alarm State - Dp 1 - Ch 12
    setChannelLabel 12 "CO2 Alarm State (1 OK, 0 Alarm)"
    setChannelType 12 ReadOnly
    linkTuyaMCUOutputToChannel 1 enum 12
    
    // Charge State - Dp 14 - Ch 13
    setChannelLabel 13 "Charge State (1 Charging, 0 Discharging)"
    setChannelType 13 ReadOnly
    linkTuyaMCUOutputToChannel 14 enum 13
    
    // PM2.5 Alarm State - Dp 106 - Ch 14
    setChannelLabel 14 "PM2.5 Alarm State (1 OK, 0 Alarm)"
    setChannelType 14 ReadOnly
    linkTuyaMCUOutputToChannel 106 enum 14
    
    // CO2 Alarm Threshold (RW) - Dp 26 - Ch 15
    //setChannelLabel 15 "CO2 Alarm Threshold (0-5000 ppm)"
    //setChannelType 15 ReadWrite
    //linkTuyaMCUOutputToChannel 26 var 15
    
    // Temperature Unit Display (RW) - Dp 31 - Ch 16
    setChannelLabel 16 "Temperature Unit (0=Celsius, 1=Fahrenheit)"
    setChannelType 16 Toggle
    linkTuyaMCUOutputToChannel 31 enum 16
    
    // Unknown ID107 (Possibly Auto Calibration) - Dp 107 - Ch 17
    //setChannelLabel 17 "Auto Calibration (Probable)"
    //setChannelType 17 ReadWrite
    //linkTuyaMCUOutputToChannel 107 bool 17
    
    // Display Sleep Timer (RW) - Dp 109 - Ch 18
    //setChannelLabel 18 "Display Sleep Timer (Seconds)"
    //setChannelType 18 ReadWrite
    //linkTuyaMCUOutputToChannel 109 var 18
  • Helpful post
    #30 21361285
    divadiow
    Level 34  
    so using the productkey in that 72kb Tuya config binary you sent, I was able to pair another Tuya firmware masquerading as the PV28-CW

    Tuya product name: PV28_空气检测仪(8合1) - PV28_Air Detector (8 in 1)

    Code: JSON
    Log in, to see the code


    Air detector app screen with CO2 and PM2.5 alarms and various readings and a chart.

Topic summary

The discussion centers on flashing the Tuya PV28-CW 8-in-1 Air Quality Monitor, which uses the BK7231N chip, with OpenBeken firmware after initial flashing via Tuya Cloudcutter. The device requires USB power due to a short battery life. Initial challenges included lack of a dedicated OpenBeken template and handling TuyaMCU communication, including baud rate settings and command queries. Users identified and mapped TuyaMCU datapoint IDs (dpIDs) corresponding to sensor readings such as CO2, PM2.5, PM1.0, PM10, HCHO, TVOC, temperature, humidity, battery level, and screen wake timeout. The dpIDs were linked to OpenBeken channels with appropriate labels and read-only types. Issues with data scaling (e.g., _div10) and autoexec.bat file corruption were noted. The community shared JSON configurations extracted from Tuya firmware, aiding in understanding dpID functions and enabling more complete autoexec.bat scripts. Calibration and alarm dpIDs were discussed, with some remaining unknown or unconfirmed. Guidance on flashing hardware, including removing the Tuya module or cutting TX/RX lines, was provided. The device supports MQTT integration, and custom web interfaces can be created using OpenBeken’s scripting capabilities. Overall, a near-complete OpenBeken configuration for the PV28-CW was developed, enabling sensor data acquisition and MQTT publishing, with ongoing refinement of calibration and alarm features.
Summary generated by the language model.
ADVERTISEMENT