logo elektroda
logo elektroda
X
logo elektroda

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

TurkeyMan 19110 134
ADVERTISEMENT
  • #1 20364819
    TurkeyMan
    Level 3  
    Teardown of this energy meter from AliExpress.

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

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

    The device comes with CT clamp:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components

    The back of the plastic case is secured with some small plastic tabs; it was removed easily with a small blade:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components

    The main board with Tuya and BL0942 visible:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components

    Reverse side with CB2S and power electronics visible. There is also a push button and a light:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components

    The push button and LED are both connected to the Tuya.
    The only signals from the CB2S to the mainboard are TX/RX, and also P24 + P26. I can't find the function of P24/26, I suspect they're only soldered to secure the chip in place.

    Here is a recording of the Tuya comms:
    
    BAUD: 115200
    
    Energy readings approx:
    248-250V 0.1A ~60.8W
    
    RX:
    
    000000000000000000000000000000000000000000FF0000FC000055AA03000001000355AA030100
    2A7B2270223A22646A66657039733673336232716B3839222C2276223A22312E302E30222C226D22
    3A327D6355AA030200000455AA030300000555AA03000001010455AA03070008120200040000007A
    A355AA0307000813020004000000002A55AA0307000814020004000000002B55AA030300000555AA
    030300000555AA03000001010455AA0307000814020004000009BAEE55AA03070008140200040000
    09B0E455AA0307000814020004000009A5D855AA03000001010455AA03000001010455AA03070008
    14020004000009AFE355AA0307000814020004000009BFF355AA0307000813020004000002608C55
    AA03000001010455AA0307000814020004000009B9ED55AA0307000814020004000009C7FB55AA03
    000001010455AA0307000814020004000009B5E955AA03070008130200040000025A8655AA030000
    01010455AA0307000814020004000009C1F555AA0307000813020004000002608C55AA0307000814
    020004000009C7FB55AA03000001010455AA03000001010455AA038001010455AA03000001010455
    AA0307000812020004000000F72055AA0307000814020004000009C5F955AA030700081302000400
    0002649055AA03000001010455AA03000001010455AA03070008120200040000007BA455AA030700
    0812020004000000F41D55AA0307000814020004000007E61855AA03070008130200040000020733
    55AA0307000813020004000002376355AA03000001010455AA0307000814020004000009A9DD55AA
    0307000813020004000002497555AA03070008140200040000099BCF55AA03070008130200040000
    024E7A55AA030000010104   
    
    incremental reports (few seconds apart):
    55AA030000010104
    55AA0307000812020004000000F72055AA0307000814020004000009C5F955AA03070008130200040000026591
    55AA030000010104
    55AA030000010104
    55AA030000010104
    55AA0307000814020004000009BAEE55AA03070008130200040000025F8B
    55AA030000010104
    55AA0307000814020004000009C2F6
    55AA030000010104
    55AA0307000814020004000009A3D755AA03070008130200040000025581
    55AA030700081402000400000999CD
    55AA0307000814020004000009ACE0
    55AA030000010104
    55AA0307000814020004000009BBEF55AA03070008130200040000025D89
    55AA0307000814020004000009C1F5
    
    
    TX:
    
    00000000000000000000000000000000000000000000000000000000000000000000000004000000
    000055AA00000000FF55AA000100000055AA000200000155AA00030001020555AA00000000FF55AA
    000800000755AA00030001030655AA00030001040755AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    ...
    
    SET "Maximum power = 1600":
    55AA00000000FF55AA000600083402000400003E8005
    SET "Maximum power = 2400":
    55AA00000000FF55AA000600083402000400005DC064
    SET "Maximum power = 5000":
    55AA00060008340200040000C3505A
    55AA00000000FF
    SET "Maximum power = 2400":
    55AA000600083402000400005DC064     
    55AA00000000FF...
    55AA00000000FF...
    ...
    


    The stock software allows one configuration detail, it has "Set maximum power" and you choose a value in watts, and the software will then show the current power draw as a percentage of that value.
    Surprisingly, this isn't just a UI detail in the app; when changing the maximum power value, data is transmit to the Tuya for reasons I can't guess... perhaps it performs the calculation internally and returns the percentage to the wifi module to transmit?
  • ADVERTISEMENT
  • Helpful post
    #2 20365221
    p.kaczmarek2
    Moderator Smart Home
    Thanks, that's like a late Christmas, your teardowns are great and very useful, I love analyzing those packets.
    Let's see what we've got here:
    
    BAUD: 115200
    
    Energy readings approx:
    248-250V 0.1A ~60.8W
    
    RX:
    
    000000000000000000000000000000000000000000FF0000FC000055AA03000001000355AA030100
    2A7B2270223A22646A66657039733673336232716B3839222C2276223A22312E302E30222C226D22
    3A327D6355AA030200000455AA030300000555AA03000001010455AA03070008120200040000007A
    A355AA0307000813020004000000002A55AA0307000814020004000000002B55AA030300000555AA
    030300000555AA03000001010455AA0307000814020004000009BAEE55AA03070008140200040000
    09B0E455AA0307000814020004000009A5D855AA03000001010455AA03000001010455AA03070008
    14020004000009AFE355AA0307000814020004000009BFF355AA0307000813020004000002608C55
    AA03000001010455AA0307000814020004000009B9ED55AA0307000814020004000009C7FB55AA03
    000001010455AA0307000814020004000009B5E955AA03070008130200040000025A8655AA030000
    01010455AA0307000814020004000009C1F555AA0307000813020004000002608C55AA0307000814
    020004000009C7FB55AA03000001010455AA03000001010455AA038001010455AA03000001010455
    AA0307000812020004000000F72055AA0307000814020004000009C5F955AA030700081302000400
    0002649055AA03000001010455AA03000001010455AA03070008120200040000007BA455AA030700
    0812020004000000F41D55AA0307000814020004000007E61855AA03070008130200040000020733
    55AA0307000813020004000002376355AA03000001010455AA0307000814020004000009A9DD55AA
    0307000813020004000002497555AA03070008140200040000099BCF55AA03070008130200040000
    024E7A55AA030000010104   
    

    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components
    ID 18 has values 122, 247, 123, 244 - idk what's that
    ID 19 is from 0 to 612, isn't it power divided by 10? The bad thing is that you turned off power and I am not sure... but most likely it's power
    ID 20 from 0 to 2503... voltage? Again, not sure why is there a 0?
    Here is a decoded dump:
    Spoiler:

    55 AA 03 00 00 01 00 03
    HEADER VER=03 Heartbeat LEN 00 CHK

    55 AA 03 01 00 2A 7B2270223A22646A66657039733673336232716B3839222C2276223A22312E302E30222C226D223A327D 63
    HEADER VER=03 Product LEN {"p":"djfep9s6s3b2qk89","v":"1.0.0","m":2} CHK

    55 AA 03 02 00 00 04
    HEADER VER=03 McuConf LEN CHK

    55 AA 03 03 00 00 05
    HEADER VER=03 WifiState LEN CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 12 02 00 04 0000007A A3
    HEADER VER=03 State LEN fnId=18 Val V=122 CHK

    55 AA 03 07 00 08 13 02 00 04 00000000 2A
    HEADER VER=03 State LEN fnId=19 Val V=0 CHK

    55 AA 03 07 00 08 14 02 00 04 00000000 2B
    HEADER VER=03 State LEN fnId=20 Val V=0 CHK

    55 AA 03 03 00 00 05
    HEADER VER=03 WifiState LEN CHK

    55 AA 03 03 00 00 05
    HEADER VER=03 WifiState LEN CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009BA EE
    HEADER VER=03 State LEN fnId=20 Val V=2490 CHK

    55 AA 03 07 00 08 14 02 00 04 000009B0 E4
    HEADER VER=03 State LEN fnId=20 Val V=2480 CHK

    55 AA 03 07 00 08 14 02 00 04 000009A5 D8
    HEADER VER=03 State LEN fnId=20 Val V=2469 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009AF E3
    HEADER VER=03 State LEN fnId=20 Val V=2479 CHK

    55 AA 03 07 00 08 14 02 00 04 000009BF F3
    HEADER VER=03 State LEN fnId=20 Val V=2495 CHK

    55 AA 03 07 00 08 13 02 00 04 00000260 8C
    HEADER VER=03 State LEN fnId=19 Val V=608 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009B9 ED
    HEADER VER=03 State LEN fnId=20 Val V=2489 CHK

    55 AA 03 07 00 08 14 02 00 04 000009C7 FB
    HEADER VER=03 State LEN fnId=20 Val V=2503 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009B5 E9
    HEADER VER=03 State LEN fnId=20 Val V=2485 CHK

    55 AA 03 07 00 08 13 02 00 04 0000025A 86
    HEADER VER=03 State LEN fnId=19 Val V=602 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009C1 F5
    HEADER VER=03 State LEN fnId=20 Val V=2497 CHK

    55 AA 03 07 00 08 13 02 00 04 00000260 8C
    HEADER VER=03 State LEN fnId=19 Val V=608 CHK

    55 AA 03 07 00 08 14 02 00 04 000009C7 FB
    HEADER VER=03 State LEN fnId=20 Val V=2503 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 80 01 01 04 55
    HEADER VER=03 Unk LEN 04 CHK

    55 AA 03 07 00 08 12 02 00 04 000000F7 20
    HEADER VER=03 State LEN fnId=18 Val V=247 CHK

    55 AA 03 07 00 08 14 02 00 04 000009C5 F9
    HEADER VER=03 State LEN fnId=20 Val V=2501 CHK

    55 AA 03 07 00 08 13 02 00 04 00000264 90
    HEADER VER=03 State LEN fnId=19 Val V=612 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 12 02 00 04 0000007B A4
    HEADER VER=03 State LEN fnId=18 Val V=123 CHK

    55 AA 03 07 00 08 12 02 00 04 000000F4 1D
    HEADER VER=03 State LEN fnId=18 Val V=244 CHK

    55 AA 03 07 00 08 14 02 00 04 000007E6 18
    HEADER VER=03 State LEN fnId=20 Val V=2022 CHK

    55 AA 03 07 00 08 13 02 00 04 00000207 33
    HEADER VER=03 State LEN fnId=19 Val V=519 CHK

    55 AA 03 07 00 08 13 02 00 04 00000237 63
    HEADER VER=03 State LEN fnId=19 Val V=567 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK

    55 AA 03 07 00 08 14 02 00 04 000009A9 DD
    HEADER VER=03 State LEN fnId=20 Val V=2473 CHK

    55 AA 03 07 00 08 13 02 00 04 00000249 75
    HEADER VER=03 State LEN fnId=19 Val V=585 CHK

    55 AA 03 07 00 08 14 02 00 04 0000099B CF
    HEADER VER=03 State LEN fnId=20 Val V=2459 CHK

    55 AA 03 07 00 08 13 02 00 04 0000024E 7A
    HEADER VER=03 State LEN fnId=19 Val V=590 CHK

    55 AA 03 00 00 01 01 04
    HEADER VER=03 Heartbeat LEN 01 CHK


    
    
    incremental reports (few seconds apart):
    55AA030000010104
    55AA0307000812020004000000F72055AA0307000814020004000009C5F955AA03070008130200040000026591
    55AA030000010104
    55AA030000010104
    55AA030000010104
    55AA0307000814020004000009BAEE55AA03070008130200040000025F8B
    55AA030000010104
    55AA0307000814020004000009C2F6
    55AA030000010104
    55AA0307000814020004000009A3D755AA03070008130200040000025581
    55AA030700081402000400000999CD
    55AA0307000814020004000009ACE0
    55AA030000010104
    55AA0307000814020004000009BBEF55AA03070008130200040000025D89
    55AA0307000814020004000009C1F5
    

    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components
    Well, ID 19 oscillates around 600, ID 20 between 2457 and 2501. It might confirm it's voltage and power.
    ID 18 is 247, what may that be?
    Maybe I am wrong and one of them is a current?
    Yup...
    Let's assume resistive load.
    60/250= 0.24smth
    So it's voltage, current and power. Just which one is which.

    
    
    TX:
    
    00000000000000000000000000000000000000000000000000000000000000000000000004000000
    000055AA00000000FF55AA000100000055AA000200000155AA00030001020555AA00000000FF55AA
    000800000755AA00030001030655AA00030001040755AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    55AA00000000FF...
    ...
    

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

    
    
    SET "Maximum power = 1600":
    55AA00000000FF55AA000600083402000400003E8005
    SET "Maximum power = 2400":
    55AA00000000FF55AA000600083402000400005DC064
    SET "Maximum power = 5000":
    55AA00060008340200040000C3505A
    55AA00000000FF
    SET "Maximum power = 2400":
    55AA000600083402000400005DC064     
    55AA00000000FF...
    55AA00000000FF...
    ...
    

    Ok, now what is that?
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components
    It sets fnID 52 to 16000, then 24000, then 50000, then 24000 again.. I can't see anything else happening here.

    Do we need a relay control as well?
    So far, we have found a current, a voltage and power channels.

    I also need a test with a 120W load or 30W load because... I am not sure which one is current and which one is voltage.
    Or maybe we can guess by precision?
    Helpful post? Buy me a coffee.
  • #3 20365414
    TurkeyMan
    Level 3  
    Yes, I bought a 60W incandescent light bulb for testing these with a resistive load :)
    I think the voltage was high today, ~250V, high sun, lots of solar. I guess the small number was current?
    I don't know why the SmartLife app reported current as 0.1A, because it's a resistive load, and as you show, 60/250 = 0.24.
    So, 18 is mA, 19 is W*10, 20 is V*10? Seems plausible, except those early readings of ~120mA aren't right...

    What's odd here is that it doesn't seem to report cumulative Wh... which means you can't measure energy... slow poll rates will miss high frequency fluctuation, and the total energy will accumulate error.
    Maybe it's reporting energy since the last poll? Maybe that's why 18 is jumping 122, 247, 123, 244? Maybe the report rate is not perfectly regular?
    Hmmm, okay, so 60Wh/hr == ~0.016Wh/second. Those messages are reported a few seconds apart... maybe there's a scaling factor that makes that make sense...? Maybe you sum them for total energy consumption?

    There's no relay in this device. It's just a meter... and as a dedicated meter, I'm really surprised it doesn't accumulate kWh internally for accurate energy reporting!

    On the TX line; "mostly nothing" except that `08` packet... any idea? Doesn't look important, but you don't seem to have a record of that packet type in your software...
    I have no idea what fnId 52 is supposed to be for! How will we configure items of configuration, to expose values that will be transmit to the mcu?
    For instance, I feel like a quality configuration for this device will create an integer value called "Maximum power", given some bounds like 0-80000, and then transmit the value to Tuya if the user changes it. Can we do that now?
  • #4 20369324
    p.kaczmarek2
    Moderator Smart Home
    We need a bit more samples to figure out everything.

    TurkeyMan wrote:

    On the TX line; "mostly nothing" except that `08` packet... any idea? Doesn't look important, but you don't seem to have a record of that packet type in your software...

    It's something for initialization, but we have logs saved so I don't worry about it now:
    Command Word Description
    0x00 Heartbeat detection.
    0x01 Query product information.
    0x02 Query the working mode of the Wi-Fi module.
    0x03 Report the network connection status of the device.
    0x04 Reset the Wi-Fi module and switch the network configuration mode.
    0x05 Reset the Wi-Fi module and select a network configuration mode.
    0x06 Deliver DP commands.
    0x07 Report DP status.
    0x08 Query the device initialization status.
    0x0a (Optional) Start OTA upgrade.
    0x0b (Optional) Transmit the OTA upgrade package.
    0x1c (Optional) Obtain the local time.
    0x0e Test the Wi-Fi function (product testing command)


    TurkeyMan wrote:

    I have no idea what fnId 52 is supposed to be for! How will we configure items of configuration, to expose values that will be transmit to the mcu?
    For instance, I feel like a quality configuration for this device will create an integer value called "Maximum power", given some bounds like 0-80000, and then transmit the value to Tuya if the user changes it. Can we do that now?

    You can map any OpenBeken to any TuyaMCU dpID. You can then set this channel with "setChannel 15 80000" command and driver will automatically forward the value to TuyaMCU.

    OpenBeken doesn't need to know the exact channel meaning, it's flexible, it just forwards data. It's designed to be scriptable.



    TurkeyMan wrote:
    Yes, I bought a 60W incandescent light bulb for testing these with a resistive load :)
    I think the voltage was high today, ~250V, high sun, lots of solar. I guess the small number was current?
    I don't know why the SmartLife app reported current as 0.1A, because it's a resistive load, and as you show, 60/250 = 0.24.
    So, 18 is mA, 19 is W*10, 20 is V*10? Seems plausible, except those early readings of ~120mA aren't right...

    More samples and we will figure it out.

    No idea about cumulative Wh yet. But... we could just calculate it on Obk?
    Helpful post? Buy me a coffee.
  • #5 20369651
    TurkeyMan
    Level 3  
    If we can only poll immediate state, then accumulating wH is not accurate. High frequency fluctuation between polls will hide cumulative error.
    It's probably okay for some applications, but it would be good to advertise clearly that it's an estimate somehow...
    By contrast, I think the chips that report wH accumulate internally with a very good precision and report "wH since last poll" or something?
  • ADVERTISEMENT
  • #6 20369719
    p.kaczmarek2
    Moderator Smart Home
    Then maybe we can bet on:
    TurkeyMan wrote:

    Maybe it's reporting energy since the last poll? Maybe that's why 18 is jumping 122, 247, 123, 244?

    More data samples would tell us if that's what we think it may be.
    Helpful post? Buy me a coffee.
  • #7 20371206
    romulus73
    Level 28  
    The meter is really poor measurement 0d 0.2A, no standard of accuracy Up to 80A, Meters only on shunts, don't you feel sorry for the money?
    For this money, it's better after Modbus without a combination with any Atroch shunt
    Fasten the clamps and check the accuracy at 5A, this is the standard meter calibration load
  • #9 20457979
    p.kaczmarek2
    Moderator Smart Home
    Hello, is it 1:1 the same device as in the first topic? Can you give more details?
    Helpful post? Buy me a coffee.
  • #11 20458425
    p.kaczmarek2
    Moderator Smart Home
    Okay, thanks.

    Can I somehow help you to get it running?
    Helpful post? Buy me a coffee.
  • #12 20521788
    mfmoro
    Level 5  
    Hi, I was able to flash the firmware.
    Could you please tell me which configuration I have to apply?

    Kind regards
  • ADVERTISEMENT
  • #13 20527865
    mfmoro
    Level 5  
    I tried to run both tuyamcu driver and the BL0942 driver but I get no reads. I also tried to use get channel 18, 19, 20 but I get only 0.
  • #14 20527903
    p.kaczmarek2
    Moderator Smart Home
    You should not use BL0942 driver at all. The procedure is to run TuyaMCU driver, and then check Web App log for packets with their dpIDs, and then map dpIDs to channels in the config.

    Do you get any TuyaMCU logs in Web App log when you run only TuyaMCU driver, but not the BL0942?
    Helpful post? Buy me a coffee.
  • #15 20528743
    mfmoro
    Level 5  
    Hi get only these messages, no real data:
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60779, idle 191549/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60780, idle 191114/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60781, idle 195006/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60782, idle 188895/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60783, idle 187909/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60784, idle 204084/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60787, idle 190679/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60788, idle 191390/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60789, idle 191843/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60790, idle 192135/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60791, idle 190380/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60792, idle 195935/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60793, idle 197156/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60794, idle 193168/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60795, idle 191643/s, free 64992, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60796, idle 192590/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60797, idle 382912/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60800, idle 189195/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60802, idle 188288/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60803, idle 189981/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 60804, idle 190982/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    
  • #16 20528771
    p.kaczmarek2
    Moderator Smart Home
    Okay, it seems you're an OBK beginner. So, you should start with the following autoexec:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    

    The baud rate setting was taken from one of the posts above. If you read the topic carefully, you will see a report about baud rate 115200 used there.

    The default WiFi state makes device think (TuyaMCU device) it is always paired.

    Okay, please try this autoexec and give log again, so we can check if you are receiving something
    Helpful post? Buy me a coffee.
  • #17 20528878
    mfmoro
    Level 5  
    Thanks a lot. Now I have some data:

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=17
    Info:MAIN:Time 66930, idle 182887/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=18
    Info:MAIN:Time 66931, idle 188856/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=19
    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 66933, idle 188223/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=20
    Info:MAIN:Time 66934, idle 187348/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=21
    Info:MAIN:Time 66935, idle 190860/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=22
    Info:MAIN:Time 66936, idle 193233/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=22
    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 66937, idle 191730/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=23
    Info:MAIN:Time 66938, idle 193206/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=24
    Info:MAIN:Time 66939, idle 190947/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=25
    Info:MAIN:Time 66940, idle 193256/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=25
    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 08 12 02 00 04 00 00 01 C5 EF 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 453
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 453 is not mapped
    Info:MAIN:Time 66941, idle 190215/s, free 64992, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=26
    Info:MAIN:Time 66942, idle 176617/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=28
    Info:MAIN:Time 66944, idle 187178/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=28
    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 66945, idle 189958/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=29
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 02 C2 ED 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 706
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 706 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 14 02 00 04 00 00 09 1D 51 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 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: 2333
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 2333 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 13 02 00 04 00 00 02 C5 F1 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 19, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 709
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 19 with value 709 is not mapped
    Info:MAIN:Time 66946, idle 188921/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=30
    Info:MAIN:Time 66947, idle 169489/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=31
    Info:MAIN:Time 66948, idle 189796/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=31
    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 66949, idle 387191/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=32
    Info:MAIN:Time 66950, idle 189826/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=33
    Info:MAIN:Time 66951, idle 191348/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=34
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 03 45 71 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 837
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 837 is not mapped
    Info:MAIN:Time 66952, idle 190017/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=34
    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 66953, idle 185499/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=35
    Info:MAIN:Time 66954, idle 185420/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=36
    Info:MAIN:Time 66955, idle 191634/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=37
    Info:MAIN:Time 66956, idle 189461/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=37
    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 66957, idle 201323/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=38
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 03 87 B3 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 903
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 903 is not mapped
    Info:MAIN:Time 66958, idle 185635/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=39
    Info:MAIN:Time 66959, idle 191514/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=40
    Info:MAIN:Time 66960, idle 189994/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=40
    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 66961, idle 194972/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=41
    Info:MAIN:Time 66962, idle 185393/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=42
    Info:MAIN:Time 66963, idle 191148/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=43
    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 66965, idle 182555/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=44
    Info:MAIN:Time 66966, idle 187854/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=45
    Info:MAIN:Time 66967, idle 203439/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=46
    Info:MAIN:Time 66968, idle 187996/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=46
    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 66969, idle 190964/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=48
    Info:MAIN:Time 66971, idle 188336/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=49
    Info:MAIN:Time 66972, idle 196783/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=49
    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 66973, idle 192326/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=51
    Info:MAIN:Time 66975, idle 385272/s, free 64992, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=52
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 03 46 72 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 838
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 838 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 13 02 00 04 00 00 02 CB F7 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 19, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 715
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 19 with value 715 is not mapped
    Info:MAIN:Time 66976, idle 187884/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=55
    Info:MAIN:Time 66980, idle 201343/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=55
    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 66981, idle 188379/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=56
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 01 A3 CD 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 419
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 419 is not mapped
    Info:MAIN:Time 66982, idle 188602/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=57
    Info:MAIN:Time 66983, idle 185004/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=58
    Info:MAIN:Time 66984, idle 189896/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=58
    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 66985, idle 191817/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=0
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 02 B6 E1 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 694
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 694 is not mapped
    ExtraDebug:TuyaMCU:Will send SetWiFiState 4.
    Info:MAIN:Time 66987, idle 196026/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=2
    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:MAIN:Time 66988, idle 181511/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=2
    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 66989, idle 187798/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=3
    Info:MAIN:Time 66990, idle 186322/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=4
    Info:MAIN:Time 66991, idle 191106/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=5
    Info:MAIN:Time 66992, idle 192507/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=5
    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 08 12 02 00 04 00 00 03 3E 6A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 830
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 830 is not mapped
    Info:MAIN:Time 66993, idle 191262/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=6
    Info:MAIN:Time 66994, idle 193148/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=7
    Info:MAIN:Time 66995, idle 191348/s, free 64992, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=8
    Info:MAIN:Time 66996, idle 197227/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=8
    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 66997, idle 190285/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=9
    Info:MAIN:Time 66998, idle 189237/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=10
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 03 83 AF 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 899
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 899 is not mapped
    Info:MAIN:Time 66999, idle 187901/s, free 73296, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=11
    Info:MAIN:Time 67000, idle 369020/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=11
    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 67001, idle 198086/s, free 64992, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=12
    Info:MAIN:Time 67002, idle 182356/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=13
    Info:MAIN:Time 67003, idle 190103/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=15
    Info:MAIN:Time 67006, idle 183358/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=16
    Info:MAIN:Time 67007, idle 373674/s, free 73384, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=17
    Info:MAIN:Time 67008, idle 195751/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=17
    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 67009, idle 190718/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=18
    Info:MAIN:Time 67010, idle 380701/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=19
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 12 02 00 04 00 00 01 C1 EB 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 449
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 449 is not mapped
    Info:MAIN:Time 67011, idle 191863/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=20
    Info:MAIN:Time 67012, idle 184340/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=20
    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 67013, idle 194145/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=21
    Info:MAIN:Time 67014, idle 187831/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=22
    Info:MAIN:Time 67015, idle 380462/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=23
    Info:MAIN:Time 67016, idle 193701/s, free 61904, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 3/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=23
    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 08 12 02 00 04 00 00 00 E0 09 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 18, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 224
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 18 with value 224 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 14 02 00 04 00 00 00 00 2B 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 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: 0
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 13 02 00 04 00 00 00 00 2A 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    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 67017, idle 187099/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=25
    Info:MAIN:Time 67019, idle 187765/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=26
    Info:MAIN:Time 67020, idle 380541/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=26
    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 67021, idle 190755/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=27
    Info:MAIN:Time 67022, idle 188621/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=28
    Info:MAIN:Time 67023, idle 191098/s, free 73600, MQTT 1(2), bWifi 1, secondsWithNoPing -1, socks 2/38 
    
    
  • #18 20528897
    p.kaczmarek2
    Moderator Smart Home
    As you can see, you are receiving the data now. Now you need to figure out the correct interpretation for dpIDs.

    I have already done some research on that above, as I said:
    Quote:

    ID 20 from 0 to 2503... voltage? Again, not sure why is there a 0?

    So now you should see our docs:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/README.md
    and see channel types.

    And update your autoexec:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    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
    
    

    Now save this, and reboot, and you should get voltage and power reading, assuming that the dpIDs are correct. Can you check?

    There is much more to read, but we need to guess dpIDs.
    Helpful post? Buy me a coffee.
  • #19 20529269
    mfmoro
    Level 5  
    Hi ,
    thanks, I added also dpId 18 to ch 4:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    
    setChannelType 2 Voltage_div10
    setChannelType 3 Power_div10
    setChannelType 4 Current_div1000
    
    // linkTuyaMCUOutputToChannel dpId variableType tgChannel
    //ch 2(dpid 20) voltage
    linkTuyaMCUOutputToChannel  20 1 2
    //ch 3(dpid 19) power watts
    linkTuyaMCUOutputToChannel 19 1 3
    //ch 4(dpid 18) current in mA
    linkTuyaMCUOutputToChannel 18 1 4
    
    
  • #20 20529379
    p.kaczmarek2
    Moderator Smart Home
    Now we need to decode futher dpIDs. There should be also a total consumption somewhere. Maybe frequency as well?
    Helpful post? Buy me a coffee.
  • #21 20529387
    mfmoro
    Level 5  
    Yup. Is there a way to send the full serial output to MQTT so I can dump it easily for a long time?
  • #22 20590184
    elektradi
    Level 6  
    I got myself one of these too.

    1. Need to cut any PCB tracks to flash it?
    2. Does it help look at tasmota's code for BL0942?

    Thank you.
  • #23 20590482
    p.kaczmarek2
    Moderator Smart Home
    mfmoro wrote:
    Yup. Is there a way to send the full serial output to mqtt so I can dump it easily for long time?

    Nope, but we can try to add something like that. Currently Web App log is a way to go.


    elektradi wrote:

    1. Need to cut any PCB tracks to flash it?

    Most likely yes.

    elektradi wrote:

    2. Does it help look at tasmota's code for BL0942?

    We have very good BL0942 driver, but it is not used here. BL0942 is not connected to WiFi module. It connects to TuyaMCU. This is TuyaMCU device, and we have TuyaMCU support, so everything comes down to decoding dpIDs so we can receive data and display it on GUI and forward to MQTT.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #24 20591051
    elektradi
    Level 6  
    I'm confused. There are:

    1. MCU
    2. BL0942
    3. Wifi module? What is this? Isn't the wifi module part of MCU?

    @mfmoro can share how you flashed? Desolder?
  • #25 20591065
    mfmoro
    Level 5  
    Yes I desoldered the pad between the main board and the vertical pass-through board and soldered the rx, tx, gnd and 3V3 to a serial board to program it.
    You don't need to detach the board only desolder it.
  • #26 20591130
    p.kaczmarek2
    Moderator Smart Home
    Helpful post? Buy me a coffee.
  • #27 20591161
    elektradi
    Level 6  
    p.kaczmarek2 wrote:
    @elektradi TuyaMCU devices have two separate "brain", one is WiFi module, second is an extra MCU:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components
    https://developer.tuya.com/en/docs/iot/tuya-c...-serial-port-access-protocol?id=K9hhi0xxtn9cb


    I see. Thank you for the clarification!

    I just to make this work first, are the TuyaMCU and wifi module both on that tiny detachable CB3S module?
    If I replace CB3S with an ESP8266, does it the ESP8266 talk directly to the BL0942?
  • #28 20591181
    p.kaczmarek2
    Moderator Smart Home
    TuyaMCU is the STC chip here:
    Exploring the Inner Workings of PJ-MGW1103 CT-Clamp Energy Meter: Tuya, BL0942, CB2S Components
    There is no need to remove anything, but if you really don't want to use TuyaMCU protocol, you can remove the MCU and wire BL0942 directly to CB3S and use OpenBeken.

    OpenBeken can emulate Tasmota features very well, most of the commands and JSON format are compatible, Tasmota device groups are also compatible, so you get ioBroker, etc compatibility out of the box.


    Helpful post? Buy me a coffee.
  • #29 20591193
    elektradi
    Level 6  
    Hmm, tough call haha. Thank you for the work on openbk!

    Which pins do I have to wire to CB3S to BL0942? And what would be the configuration?

    To be honest, I decided to buy this device right after reading about openbk. I thought it was fully supported already. Haha.

    So, I have never flashed openbk before, first timer. If you can guide me through the hardware wiring, I'm more than happy to help with decoding the protocol.
  • #30 20591261
    p.kaczmarek2
    Moderator Smart Home
    Wait, wait a moment, @elektradi .
    I may be missing something here, but why don't you want to try just using this device directly with OpenBeken TuyaMCU driver? I don't know if I should ask, but I am not sure what's the motivation behind using BL0942 directly. There is no need to do that?
    From what I can tell, we already have most of DPids for this device working:
    mfmoro wrote:
    Hi ,
    thanks, I added also dpId 18 to ch 4:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    
    setChannelType 2 Voltage_div10
    setChannelType 3 Power_div10
    setChannelType 4 Current_div1000
    
    // linkTuyaMCUOutputToChannel dpId variableType tgChannel
    //ch 2(dpid 20) voltage
    linkTuyaMCUOutputToChannel  20 1 2
    //ch 3(dpid 19) power watts
    linkTuyaMCUOutputToChannel 19 1 3
    //ch 4(dpid 18) current in mA
    linkTuyaMCUOutputToChannel 18 1 4
    
    

    There are still some dpIDs not figured out, but current, watts, and voltage are already here.... so most of the work is done.
    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