logo elektroda
logo elektroda
X
logo elektroda

Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components

TurkeyMan 19113 134
ADVERTISEMENT
  • #61 20846955
    p.kaczmarek2
    Moderator Smart Home
    There is a command to clear config in OBK, you can check there:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    but clearing config from the TuyaMCU viewport is the same as running in safe mode, because in safe mode GPIOs are not initialized and autoexec.bat is not run, so I am not sure if it can help.

    Can you investigate the PCB of your device, is the MCU connected to CEN? Is there a way for MCU to reset the WiFi module?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #62 20846973
    thalesmaia
    Level 6  

    CEN is soldered.

    Close-up of a hand holding a circuit board with an attached chip.

    After pin, I noticed that it goes to the MCU.

    Close-up of a circuit board with a probe touching one of its components.

    Microcontroller being soldered onto a green circuit board with visible traces and components.
  • #63 20847102
    p.kaczmarek2
    Moderator Smart Home
    So MCU may reset WiFi module if something is wrong.

    Now, the question is, what could wrong?

    Was TuyaMCU communication working for you?|

    Maybe it never worked in the first place and you need to remove baud setting:
    
    
    tuyaMcu_setBaudRate 115200
    
    

    maybe remove the line above and retry? Did you get any TuyaMCU packets in the Web App log when testing?
    Helpful post? Buy me a coffee.
  • #64 20847436
    thalesmaia
    Level 6  

    That is what I was thinking. Not sure why, but it keeps resetting the module.
    It started after I added autoexec.bat. After that, I have around 30s to try to see something.
    Once, I could see some communication in the logs, but it wasn't enough to be sure they were right.

    You have a good point regarding baud rate. I got the same problem using 9600 baud rate with Esphome.

    My problem now is: how can I edit the module? I was thinking to desolder CEN. However, I'm not sure if it should jumper to Vcc or make a pull-up to Vcc. Make sense? Better yet, leave it open?
  • #65 20847502
    p.kaczmarek2
    Moderator Smart Home
    The thing that still confuses me is the fact that it does not work (according to you) even in safe mode. Safe mode in OBK is the same as OBK without any GPIO and autoexec.bat configs, so I don't know what's the difference.

    Maybe the MCU itself somehow remembers the fact that it got supposedly paired (wifi state 0x04) and now that's why it reboots.

    You can just cut the CEN trace and leave CEN in the air. It's pulled correctly on the BK module itself.
    Helpful post? Buy me a coffee.
  • #66 20848010
    thalesmaia
    Level 6  
    This is what I get right before disconnection:

    
     data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:MAIN:Time 154, idle 0/s, free 25816, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 6/38 
    Info:TuyaMCU:Consumed 256 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 80 00 00 00 00 80 00 FE 00 00 F8 00 FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00
    Info:TuyaMCU:Consumed 103 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 80 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 F8 00 FE 00 00 00 E0 00 FE 00 FE 00 FE 00 FE 00 FE 00 FE 00 00 F8 00 FE 00 FE 00 FE 00 FE 00 00 00 00 00 00 00 FE 00 FE 00 00 00 00 00 00 00 00 00 00 00 00
    Info:TuyaMCU:Consumed 68 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) FE 00 FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 E0 00 00 F8 
    Info:TuyaMCU:Consumed 53 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 00 FE 00 FE 00 FE 00 FE 00 00 00 00 80 00 FE 00 FE 00 FE 00 FE 00 FE 00 00 F8 00 FE 00 FE 00 FE 00 FE 00 00 00 00 00 00 00 FE 00 FE 00 00 00 00 00 00 00 00 00 
    Info:TuyaMCU:Consumed 24 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 00 00 00 00 00 00 00 80 00 00 00 00 80 00 00 00 00 80 00 FE 00 00 F8 00 
    Info:TuyaMCU:Consumed 86 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) FE 00 00 F8 00 00 00 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 80 00 00 00 E0 00 00 00 00 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 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 80 00 00 F8 00 FE 00 00 00
    Info:MAIN:Time 155, idle 9572/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 156, idle 198228/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 157, idle 182133/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 158, idle 192761/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:CMD:[WebApp Cmd 'loglevel 3' Result] OK
    Info:MAIN:Time 159, idle 191399/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 160, idle 189234/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.200.166 gate=192.168.200.1 mask=255.255.255.0 mac=18:de:50:f7:03:ea
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-63,ssid=AM-House 2.4,bssid=cc:32:e5:68:45:f7,channel=13,cipher_type:CCMP
    Info:MAIN:Time 161, idle 188089/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 162, idle 207434/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 163, idle 194821/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 164, idle 193547/s, free 74760, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    
  • ADVERTISEMENT
  • #67 20848051
    p.kaczmarek2
    Moderator Smart Home
    Try other baudrate. This is random noise.
    Helpful post? Buy me a coffee.
  • #68 20848333
    thalesmaia
    Level 6  

    Ok, after 4 hours of trial and error, I got some results, which I can't understand.

    Here is the ping result for a fresh new install:

    
    [1701809332.100566] no response yet for icmp_seq=3796
    [1701809333.124591] no response yet for icmp_seq=3797
    [1701809334.152601] no response yet for icmp_seq=3798
    [1701809335.172597] no response yet for icmp_seq=3799
    [1701809336.196595] no response yet for icmp_seq=3800
    [1701809337.220602] no response yet for icmp_seq=3801
    [1701809338.244595] no response yet for icmp_seq=3802
    [1701809338.252520] 64 bytes from 192.168.200.166: icmp_seq=3803 ttl=255 time=7.81 ms
    [1701809339.250501] 64 bytes from 192.168.200.166: icmp_seq=3804 ttl=255 time=3.85 ms
    [1701809340.252217] 64 bytes from 192.168.200.166: icmp_seq=3805 ttl=255 time=3.62 ms
    [1701809341.257656] 64 bytes from 192.168.200.166: icmp_seq=3806 ttl=255 time=7.31 ms
    [1701809342.255754] 64 bytes from 192.168.200.166: icmp_seq=3807 ttl=255 time=3.92 ms
    [1701809343.256373] 64 bytes from 192.168.200.166: icmp_seq=3808 ttl=255 time=3.72 ms
    [1701809344.257051] 64 bytes from 192.168.200.166: icmp_seq=3809 ttl=255 time=2.51 ms
    [1701809346.276608] no response yet for icmp_seq=3810
    [1701809347.300583] no response yet for icmp_seq=3811
    [1701809348.324566] no response yet for icmp_seq=3812
    [1701809349.348540] no response yet for icmp_seq=3813
    [1701809350.372606] no response yet for icmp_seq=3814
    


    It is completely unstable. However, it does connect from time to time. The problem gets worse when I touch littleFS.
    More time offline than online.
    Please, help me!
    I bought this on Aliexpress. It seems like it is suffering from an overhead.
  • #69 20848715
    p.kaczmarek2
    Moderator Smart Home
    So you've already cut off the CEN and problem still persists?

    If it's overheating, you can try PowerSave 1 in short startup line.

    You can also try "restore RF partition" in flasher, assuming that you have 2MB backup of original firmware The same option is available in the Web App, if it's stable enough for you.
    Helpful post? Buy me a coffee.
  • #70 20849242
    thalesmaia
    Level 6  

    I've made a lot of tests and want to share.
    I've erased everything and started from ground zero. Clean firmware with no RF partition.

    Just soldered GND 3.3V and CE. The system starts. After 10-20s, the MCU resets CB2S. Probably it is waiting for serial communication.
    If I solder Rx and Tx, it drops more frequently. I will open CE again and try different baud rates.

    Added after 2 [minutes]:

    Update, without CE and UART, it doesn't reset.
    Sorry, there is also D24 and D23 soldered.
  • #71 20849246
    p.kaczmarek2
    Moderator Smart Home
    Excuse me, are you saying now that both OBK fails itself and TuyaMCU resets it?

    I recommended the RF partition clear under the assumption that CEN is already detached. If you cleared RF with CEN still attached, then it won't help.

    Are you saying that you are facing two separate issues, namely:
    - OBK itself resetting (RF clear recommended)
    - CEN resetting WiFi module
    Or is it in fact only CEN bussiness?

    Still, I will ask again, have you checked the other baud rate?

    Or maybe can you attach here 2MB backup of original firmware so I can check which baudrate is used by that device?
    Helpful post? Buy me a coffee.
  • #72 20849247
    thalesmaia
    Level 6  
    Last update!
    Without CE.
    With
    3.3 GND Rx D24 D23 I have stable connection and some readings, but no correct value:

    
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 115, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 115 with value 0 is not mapped
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    uyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 101, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 101 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 6E 02 00 04 00 00 00 64 E9 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 110, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 100
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 110 with value 100 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 6F 02 00 04 00 00 FF FF 84 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 111, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 65535
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 111 with value 65535 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 73 02 00 04 00 00 00 00 8A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 115, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 115 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 70 02 00 04 00 00 00 00 87 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 112, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 112 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 72 02 00 04 00 00 00 00 89 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 114, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 114 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 69 02 00 04 00 00 00 00 80 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 105, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 105 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 79 02 00 04 00 00 00 64 F4 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 121, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 100
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 121 with value 100 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 6F 02 00 04 00 00 FF FF 84 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 111, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 65535
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 111 with value 65535 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 73 02 00 04 00 00 00 00 8A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 115, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 115 with value 0 is not mapped
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    


    Now I need some guidance. Do I need tx to get correct values or I may be missing something:

    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    tuyaMcu_defWiFiState 4
    setChannelType 2 Voltage_div10
    setChannelType 3 Power_div10
    // linkTuyaMCUOutputToChannel dpId variableType tgChannel
    //ch 2(dpid 20) voltage
    linkTuyaMCUOutputToChannel  20 1 2
    //ch 3(dpid 19) power watts
    linkTuyaMCUOutputToChannel 19 1 3
    


    Also, why the MCU is reseting?
  • ADVERTISEMENT
  • #73 20849273
    p.kaczmarek2
    Moderator Smart Home
    The following fragment:
    
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 111, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 65535
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 111 with value 65535 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 73 02 00 04 00 00 00 00 8A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 115, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    

    indicates that TuyaMCU communication is now working. Everything seems to be ok.

    Are you saying that in spite of all that, the MCU is still resetting?

    Or.... do you have connected both TX and RX or only one?
    Helpful post? Buy me a coffee.
  • #74 20849283
    thalesmaia
    Level 6  

    p.kaczmarek2 wrote:
    Are you saying that you are facing two separate issues, namely:
    - OBK itself resetting (RF clear recommended)
    - CEN resetting WiFi module
    Or is it in fact only CEN business?

    Still, I will ask again, have you checked the other baud rate?

    Or maybe can you attach here 2MB backup of original firmware so I can check which baud rate is used by that device?


    Thank you for your reply. At some point, I've connected CEN. Now it is disconnected.
    I tried different baud rates, but only 9600 performed non-header problem, but no value.

    Appreciate your help. Here is the backup.
  • #75 20849294
    thalesmaia
    Level 6  

    Right now, I have RX and TX connected.
    If I disconnect TX, the LED doesn't blink.
    If I connect TX, the LED blinks.

    The blinks were associated with reset pulls. It is fine now. I have communication.

    My problem is that I get no reading. Everything is zero. Not sure if I must do something.
  • #76 20849415
    p.kaczmarek2
    Moderator Smart Home
    It's a bit hard to follow for me. So you just disconnected CEN and it works?

    Try requesting TuyaMCU state with tuyaMcu_sendQueryState and check what appears in the Web App Log.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #77 20851047
    thalesmaia
    Level 6  
    Sorry, my bad. Let me make a follow up.

    1) My device only works deleting RF partition.
    2) I must disconnect CEN.
    3) I must set baudrate to 9600.

    That is pretty much.

    Now I'm trying to identify the dpId. Here is my full script:

    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    tuyaMcu_defWiFiState 4
    setChannelType 2 Voltage_div10
    setChannelType 3 Current_div1000
    setChannelType 4 Frequency_div100
    // linkTuyaMCUOutputToChannel dpId variableType tgChannel
    //ch 2(dpid 20) voltage
    linkTuyaMCUOutputToChannel  112 1 2
    //ch 3(dpid 19) power watts
    linkTuyaMCUOutputToChannel 114 1 3
    //ch 4(dpid 20) frequency
    linkTuyaMCUOutputToChannel  111 1 4
    


    I just need to find the power now. Here are my readings:

    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 65 02 00 04 00 00 00 00 7C 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 101, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 68 04 00 01 01 7C 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 104, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 1
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 69 02 00 04 00 00 15 D1 66 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 105, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 5585
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 6E 02 00 04 00 00 00 64 E9 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 110, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 100
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 6F 02 00 04 00 00 17 6D 0A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 111, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 5997
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 70 02 00 04 00 00 04 E4 6F 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 112, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 1252
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 71 02 00 04 00 00 00 00 88 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 113, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 72 02 00 04 00 00 11 4D E7 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 114, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 4429
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 73 02 00 04 FF FF EA 2F A1 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 115, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: -5585
    
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 79 02 00 04 00 00 00 63 F3 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 121, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 99
    


    Any suggestion?
    It seems to be 105, but there is another value in 115. Equal but opposite value.
    Is there a way yo calibrate the values?

    Added after 30 [minutes]:

    Got It! Found your post with the values:

    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    tuyaMcu_defWiFiState 4
    setChannelType 2 Voltage_div10
    setChannelType 3 Current_div1000
    setChannelType 4 Current_div1000
    setChannelType 5 Frequency_div100
    setChannelType 6 Power_div10
    setChannelType 7 Power_div10
    setChannelType 8 PowerFactor_div100
    setChannelType 9 PowerFactor_div100
    // linkTuyaMCUOutputToChannel dpId variableType tgChannel
    //ch 2(dpid 20) voltage
    linkTuyaMCUOutputToChannel  112 1 2
    //ch 3(dpid 19) power watts
    linkTuyaMCUOutputToChannel 113 1 3
    linkTuyaMCUOutputToChannel 114 1 4
    //ch 4(dpid 20) frequency
    linkTuyaMCUOutputToChannel  111 1 5
    linkTuyaMCUOutputToChannel  101 1 6
    linkTuyaMCUOutputToChannel  105 1 7
    linkTuyaMCUOutputToChannel  110 1 8
    linkTuyaMCUOutputToChannel  121 1 9
    


    Can you please add powerfactor_div100?
  • #78 20851112
    p.kaczmarek2
    Moderator Smart Home
    The usual approach to this problem is to first connect a load with a known power usage, let's say, a 60W bulb, and then check each value to see which seems close to 60, or 600, or 6000...

    Added after 40 [seconds]:

    Edit: Ok I will add powerfactor_div100, but in general, we will soon support adjustable divider

    Added after 4 [minutes]:

    added PowerFactor_div100
    Helpful post? Buy me a coffee.
  • #79 20851167
    thalesmaia
    Level 6  

    I have a known load. I tried to set the current using Tools, but I received an error:

    ERROR: Unknown command (undefined)
  • #80 20851280
    p.kaczmarek2
    Moderator Smart Home
    I was referring to the method of guessing dpID meanings. There is no calibration for TuyaMCU devices. Calibration is only for BL0942, BL0937, etc, because their calibration resides in WiFI module, so if you flash OBK, you lose calibration.

    On the other hand, TuyaMCU devices have their calibration on MCU, so it's not lost when flashing OBK, so there should be no need to calibrate.

    Why do you want to recalibrate this device? Is it giving incorrect readings?
    Helpful post? Buy me a coffee.
  • #81 20851389
    thalesmaia
    Level 6  

    Yes. I did calibrate voltage and frequency before flashing. However, the current is a bit off.
  • #82 20851486
    p.kaczmarek2
    Moderator Smart Home
    So this device must have some kind of dpIDs for calibration? Do you know which dpIDs are used for that?
    Helpful post? Buy me a coffee.
  • #83 20851541
    thalesmaia
    Level 6  

    I have no idea. I will just post-process it.

    Another question. Why does it go randomly to zero? I can't see any apparent reason. Is that normal or maybe the MCU is resetting?

    Graph showing power fluctuations over time with sudden drops to zero.
  • #84 20851651
    p.kaczmarek2
    Moderator Smart Home
    thalesmaia wrote:

    I have no idea. I will just post-process it.

    Well. if you have unflashed device, you could do this:
    https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html
    or just use tuyaMcu_sendQueryState in OBK, see which dpIDs are not mapped yet, write down their values, and try setting them with tuyaMcu_sendState. Just remember to restore the old value in case that something unexpected happens.

    thalesmaia wrote:

    Another question. Why does it go randomly to zero? I can't see any apparent reason. Is that normal or maybe the MCU is resetting?

    Maybe you can try to check the Web App log, maybe keep the tab open or something or set an alarm in HA when it goes to 0 and check where this value comes from.
    Helpful post? Buy me a coffee.
  • #85 20882269
    tony059560
    Level 4  
    Hello,
    I am writing on this forum to get help operating the wifi energy monitored module that I recently purchased on AliExpress.
    I warn in advance, I am a beginner in using Openbeken (even if I have already flashed, configured and installed several connected smart socket type devices).
    I'm in the same situation as @mfmoro, except that I can't solve my problem.
    I just flashed the original Tuya firmware (OFW: 2.1.6 + MCU: 1.0.1) with that of Openbeken with the tuya-cloudcutter method (CCtr Flash).
    As stipulated in post (#16), I set up the configuration in the autoexec file, the content of which is as follows :
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    

    My problem is that I receive messages from TuyaMCU with dpID 18, 19 and 20 but only dpID 20 sends me a value... dpID 18 and 19 have the value "0"
    I am sure of my electrical connection because I made this same connection on another device not flashed with Openbeken and the data on the tuya application comes back well.
    Here are the corresponding logs:
    Info:MAIN:Time 161, idle 179379/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 78, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MAIN:Time 162, idle 190036/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 79, socks 2/38 
    Info:MAIN:Time 163, idle 209363/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 80, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 03 00 00 05 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 3 (WiFiState) with 7 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 18 14 02 00 04 00 00 09 63 12 02 00 04 00 00 00 00 13 02 00 04 00 00 00 00 D8 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 31 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 20, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 2403
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 2403 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 0 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 19, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 19 with value 0 is not mapped
    Info:MAIN:Time 164, idle 177571/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 81, socks 2/38 
    Info:MAIN:Time 165, idle 187503/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 82, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MAIN:Time 166, idle 190304/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 83, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 18 14 02 00 04 00 00 09 62 12 02 00 04 00 00 00 00 13 02 00 04 00 00 00 00 D7 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 31 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 20, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 2402
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 2402 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 0 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 19, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 19 with value 0 is not mapped
    Info:MAIN:Time 167, idle 185814/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 84, socks 2/38 
    Info:MAIN:Time 168, idle 186546/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 85, socks 2/38 
    Info:MAIN:Time 169, idle 186502/s, free 74656, MQTT 0(9), bWifi 1, secondsWithNoPing 86, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 18 14 02 00 04 00 00 09 66 12 02 00 04 00 00 00 00 13 02 00 04 00 00 00 00 DB 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 31 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 20, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 2406
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 2406 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 0 is not mapped
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 19, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 19 with value 0 is not mapped
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 170, idle 170699/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 87, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.1.71 gate=192.168.1.254 mask=255.255.254.0 mac=c4:82:e1:2c:da:95
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-60,ssid=HASDEB-IOT,bssid=90:9a:4a:94:85:24,channel=3,cipher_type:MIXED
    Info:MAIN:Time 171, idle 184506/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 88, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 43 (NetworkStatus) with 7 bytes
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:TuyaMCU_SendNetworkStatus: sending status 0x3 to MCU 
    Info:MAIN:Time 172, idle 181105/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 89, socks 2/38 
    Info:MAIN:Time 173, idle 187349/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 90, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MAIN:Time 174, idle 191570/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 91, socks 2/38 
    Info:MAIN:Time 175, idle 201398/s, free 66048, MQTT 0(10), bWifi 1, secondsWithNoPing 92, socks 3/38 
    Info:MAIN:Time 176, idle 191855/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 93, socks 2/38 
    Info:MAIN:Time 177, idle 190693/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 94, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MAIN:Time 178, idle 184554/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 95, socks 2/38 
    Info:MAIN:Time 179, idle 190324/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 96, socks 2/38 
    Info:MAIN:Time 180, idle 185175/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 97, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.1.71 gate=192.168.1.254 mask=255.255.254.0 mac=c4:82:e1:2c:da:95
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-61,ssid=HASDEB-IOT,bssid=90:9a:4a:94:85:24,channel=3,cipher_type:MIXED
    Info:MAIN:Time 181, idle 179923/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 98, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MAIN:Time 182, idle 185370/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 99, socks 2/38 
    Info:MAIN:Time 183, idle 186139/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 100, socks 2/38 
    Info:MAIN:Time 184, idle 190212/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 101, socks 2/38 
    Info:MAIN:Time 185, idle 184451/s, free 74656, MQTT 0(10), bWifi 1, secondsWithNoPing 102, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 186, idle 187953/s, free 74656, MQTT 0(11), bWifi 1, secondsWithNoPing 103, socks 2/38 
    Info:MAIN:Time 187, idle 184717/s, free 74656, MQTT 0(11), bWifi 1, secondsWithNoPing 104, socks 2/38 
    Info:MAIN:Time 188, idle 187262/s, free 74656, MQTT 0(11), bWifi 1, secondsWithNoPing 105, socks 2/38 
    Info:MAIN:Time 189, idle 186220/s, free 74656, MQTT 0(11), bWifi 1, secondsWithNoPing 106, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    


    Here are the photos of the model of my device and my electrical assembly:
    Close-up of an energy monitoring module with wire connections. Electrical circuit with an energy monitoring module connected to a power strip on the floor.

    Another question (for beginners), can we go back and install the official firmware of the device (that of the manufacturer)? If so, where to get it and how to install it?
    Thank you in advance for your invaluable help.
  • #86 20882289
    thalesmaia
    Level 6  

    dpId in your log is the variable that refers to something, like current, voltage, power, and so on.
    You can copy my configuration above and change your dpId.
  • #87 20882488
    tony059560
    Level 4  

    Thank you very much for your remark about the low consumption of my bulb... Indeed, as it only consumes 16 watts, the clamp did not detect anything... So I used a 60 Watt bulb and there I obtained many values for dpID 18 and 19!
    Do you know if we can adjust the consumption measurement frequency? Currently, I only get values when I turn my bulb on or when I turn it off.
    Thank you again for your help.
  • #88 20882643
    p.kaczmarek2
    Moderator Smart Home
    Can you check is the device providing more info when you request it with:
    
    tuyaMcu_sendQueryState
    

    command?

    If it works, then this command can be scripted to be called every 10 or 5 seconds to get measurements often.

    PS: Most of the device behaviour resides in TuyaMCU (the MCU), and we only changed firmware of WiFi module, so our options are limited.
    Helpful post? Buy me a coffee.
  • #89 20882796
    tony059560
    Level 4  

    Hello,
    thank you for your answer. In fact, the "tuyaMcu_sendQueryState" command returns the values to me. How to script it?
    Thanks in advance.
  • #90 20882899
    p.kaczmarek2
    Moderator Smart Home
    We have samples here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    In one of the samples, you can find:
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    


    Added after 19 [seconds]:

    Once you have it set, can you share your full autoexec.bat?
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around the PJ-MGW1103 CT-Clamp Energy Meter, focusing on its teardown, functionality, and integration with Tuya and BL0942 components. Users share insights on the device's internal workings, including the communication protocols and data points (dpIDs) for voltage, current, and power measurements. Various configurations for the autoexec.bat file are provided to optimize the device's performance, including baud rate settings and channel mappings. Users also address issues related to data accuracy, calibration, and the need for firmware updates. The conversation highlights the importance of understanding dpIDs for effective monitoring and control of energy consumption.
Summary generated by the language model.
ADVERTISEMENT