logo elektroda
logo elektroda
X
logo elektroda

EARU EAEMP3C-100-TY-W - Show the cat what you've got inside

halinka1125 2457 23
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Hello
    A short report on the disassembly of the EARU EAEMP3C-100-TY-W.
    View of an electronic device without the front casing, with an LCD display featuring colorful backlighting. .
    Fig. 1. Device without front casing commissioned without CB3S module
    The individual modules of the device can be separated without the use of a soldering iron, they are seated on golpins.
    The measuring system of the device is the RENERGY RN8302B, to which the measuring coils are connected, the whole is managed by the CMS32L051 chip, which contains an ARM® Cortex®-M0+ 32bit core, and for the display of the parameters there is an LCD display with colour backlighting/film under part of the screen - it looks quite nice.
    There are 2 measurement screens to choose from in the device settings. The nominal unit works with TUYA and you configure it through their app. The whole thing is quite easy to configure and works 'out of the box', BUT A LOT OF SETTINGS ARE ONLY AVAILABLE FROM THE APP.
    A measuring coil can be connected to the device to measure leakage. The dimensions of the coil are quite large about 76mm outer diameter, resistance about 90 Ohm, inductance about 76H (measurement of inductance uncertain because with some old meter with a weak battery), described as AC2000:1 on aliex.... .
    The unit, when powered (it is powered ONLY from phase L1 and N), draws 1W, when WiFi is configured approx 1.3-1.5W with relays on.
    The CB3S WiFi module is easily removable, the photo shows the pinout, except that if you want to flash the device you need to connect directly to the module with 3.3V power supply - the power supply from the goldpin is controlled by a transistor.
    The device is quite interesting due to the possibility of protection against too high, too low voltage, lack of one of the phases, it also has the possibility of setting the minimum and maximum current and time operation, the time of triggering the protection can be set, also the time of return to work is configurable. The device is described as 3P+N 1-100A - which is probably correct 100/4=25A or 100/3=33A is rather the max what the relays can withstand;) . The unit is capable of bi-directional energy counting, basically it displays the sum of energy consumed and produced, by clicking the arrow buttons we can see the individual components of the sum.
    This much could be ascertained before the device was 'broken', when using the BK7231GUIFlashTool-v5 software there was a problem connecting to rip the software, and during one attempt before the soft landed on the disk I managed to press the Write key instead of Read, and this of course went like this the first time. A strange program by the way, when trying to read it pops up several windows making a simple read difficult. It is not possible to read the memory into the buffer first and then write the file, while write simply fires without any question.
    As the OpenBK7231N_QIO_1.18.23 software has been installed I don't have much left.... By trial and error I managed to find a few dpid, unfortunately only a part. Currently most of the dpID is captured and described. the recommended firmware is at least OpenBK723131N_1.18.30.

    Below is the autoexec that I managed to put together, however it is definitely up for improvement (it would be nice if someone corrected it), the readout of phase parameters measuring power consumption, power factor, and leakage current, temperatures and a few configuration parameters works.
    The code provided, however, manages to crash and not give any other measurement except the last/start measurement. The dpid capture with the "tuyaMcu_sendQueryState" command does not work, at least on this version of OpenBK (or I don't know how to handle it).
    The wifi settings reset key does not work properly - although the logs show it is supported - the WiFi reset command appears, it would be nice if it reset the wifi to factory settings as it did in the original softy.
    After selecting more than 32 dpid the next one can be saved, but to delete it you have to format the whole device.
    Currently thanks to the invaluable help of p.kaczmarek2 autoexec is practically finished.
    Some of the settings appear in the debug log only after saving the settings on the meter - I wonder if any command can trigger such a report - TAK write dpID18 ? Below is such a message:
    
    00 18 12 00 00 14  01 01  *03 2A*  03 01 *01 04*  04 01 *00 B2*  0200 00 14 05 00 00 00 51 
    00 18 12 00 00 14  01 01  *03 2A*  03 01 *01 06*  04 01 *00 B3*  0200 00 14 05 00 00 00 54 
    			01=ON*MAX_C*	 03=ON*VH VH*	04=ON*VL VL*	02=OFF-3PhaseCurrent inbalance 05=OFF- Lack of 1 Phase disabled
    
    
    .
    I can't see the grid frequency anywhere - the meter gives it after the decimal point, e.g. 49.9Hz... dpID113-115 contained this information.
    Dump of the software will not be done for now, there was an attempt to do a Frankenstein with the soft from EAEMP3-100-TY-W (transferred settings and rf region), but the CB3S module did not start then. If anyone has such a meter let's drop a dump please - it will be easier to refine the boot script.
    Greetings!

    This works: reading voltage,current,power,powerfactor and frequency for all 3 phases. Here note - the frequency measurement is cheated the frequency of the power phase is copied in the MCU to the other phases.
    Leakage current reading, energy produced and consumed, device temperature reading, WiFi reset are all operational. The dpID of the alarm settings are known, but they are complex and can only be configured on the command line for now - there are examples in autoexec, error codes are known - they are listed in this topic.
    Only the operating schedule is missing - dpID117 is 90% responsible for it.
    Below is the view from the interface.
    Screenshot of the EAMP3C-100-TY-W device settings interface. .
    
    // EAMP3C-100-TY-W ver.109 autoexec, min.ver. OpenBK7231N_1.18.30 needed!
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    ntp_timeZoneOfs 1 //optional
    
    // This one is better than tuyaMcu_defWiFiState 4;  MQTTState 1 = WiFiState 4
    // issuing of tuyaMcu_defWiFiState 4 continues the script,
    // but doesnt report to MQTT since there is still no connection.
    // if you didn't setup MQTT connection then issue tuyaMcu_defWiFiState 4
    // and comment waitFor MQTTState 1
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Main Relay - Dpid 16 "switch" -> Channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Main power switch"
    
    // Total energy Used - Dpid 1 "Energy Used" -> channel 2
    linkTuyaMCUOutputToChannel 1 val 2
    setChannelType 2 EnergyTotal_kWh_div100
    setChannelLabel 2 "Total Energy used"
    
    // Dpid 110 "Dpid 110" Energy Produced-> channel 3
    linkTuyaMCUOutputToChannel 110 val 3
    setChannelType 3 EnergyTotal_kWh_div100
    setChannelLabel 3 "Produced Energy kWh"
    
    // Total Power Dpid 111 -> channel 4
    linkTuyaMCUOutputToChannel 111 val 4
    setChannelType 4 ReadOnly
    setChannelLabel 4 "Total Connected Power W"
    
    // Fault - Dpid 9 "fault" -> channel 5
    linkTuyaMCUOutputToChannel 9 BITMAP 5
    setChannelType 5 ReadOnly
    setChannelLabel 5 "Fault (mapa bitów)"
    
    //------------------------------------------------------------
    // dpID short Voltage Current Power IDs can be used alternative full VCPPfF IDs 113,114,115
    // linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP 7
    // setChannelType 7 Voltage_div10
    // setChannelLabel 7 "Voltage A"
    // setChannelType 8 Current_div1000
    // setChannelLabel 8 "Current A"
    // setChannelType 9 Power
    // setChannelLabel 9 "Power A"
    //
    // linkTuyaMCUOutputToChannel 7 RAW_TAC2121C_VCP 10
    // setChannelType 10 Voltage_div10
    // setChannelLabel 10 "Voltage B"
    // setChannelType 11 Current_div1000
    // setChannelLabel 11 "Current B"
    // setChannelType 12 Power
    // setChannelLabel 12 "Power B"
    //
    // linkTuyaMCUOutputToChannel 8 RAW_TAC2121C_VCP 13
    // setChannelType 13 Voltage_div10
    // setChannelLabel 13 "Voltage C"
    // setChannelType 14 Current_div1000
    // setChannelLabel 14 "Current C"
    // setChannelType 15 Power
    // setChannelLabel 15 "Power C"
    // -------------------------------------------------------------
    linkTuyaMCUOutputToChannel 113 RAW_VCPPfF 7
    setChannelType 7 Voltage_div10
    setChannelLabel 7 "Voltage L1"
    setChannelType 8 Current_div1000
    setChannelLabel 8 "Current L1"
    setChannelType 9 Power_div10
    setChannelLabel 9 "Power L1"
    setChannelType 10 PowerFactor_div1000
    setChannelLabel 10 "PowerFactor L1"
    setChannelType 11 Frequency_div1000
    setChannelLabel 11 "Frequency L1"
    
    linkTuyaMCUOutputToChannel 114 RAW_VCPPfF 12
    setChannelType 12 Voltage_div10
    setChannelLabel 12 "Voltage L2"
    setChannelType 13 Current_div1000
    setChannelLabel 13 "Current L2"
    setChannelType 14 Power_div10
    setChannelLabel 14 "Power L2"
    setChannelType 15 PowerFactor_div1000
    setChannelLabel 15 "PowerFactor L2"
    setChannelType 16 Frequency_div1000
    setChannelLabel 16 "Frequency L2"
    
    linkTuyaMCUOutputToChannel 115 RAW_VCPPfF 17
    setChannelType 17 Voltage_div10
    setChannelLabel 17 "Voltage L3"
    setChannelType 18 Current_div1000
    setChannelLabel 18 "Current L3"
    setChannelType 19 Power_div10
    setChannelLabel 19 "Power L3"
    setChannelType 20 PowerFactor_div1000
    setChannelLabel 20 "PowerFactor L3"
    setChannelType 21 Frequency_div1000
    setChannelLabel 21 "Frequency L3"
    
    // Device temperature - Dpid 103 "Device temperature" -> channel 23
    linkTuyaMCUOutputToChannel 103 val 23
    setChannelType 23 Temperature
    setChannelLabel 23 "Device temperature [C]"
    
    // Leakage tripping - Dpid 15 "leakage_tripping" -> channel 24
    linkTuyaMCUOutputToChannel 15 val 24
    setChannelType 24 ReadOnly
    setChannelLabel 24 "Earth Leakage value [mA]"
    
    // Dpid 17 "Dpid 17" -> channel 25
    linkTuyaMCUOutputToChannel 17 RAW 25
    // setChannelType 25 ReadOnly
    // setChannelLabel 25 "SETUP TempAlarm/Leakage Current dpID17"
    // tuyaMcu_sendCmd 0x06 11000008050000550400001D - TempDevAL=DISABLED=85C, LeakageEarth alarm=DISABLED=29mA
    // tuyaMcu_sendCmd 0x06 11000008050100410401001D - EANBLE TempDev=65C, EnableLE=29mA
    
    // Alarm temperature - Dpid 118 "Power Factor L1 - or maby overall PF?" -> channel 26
    // linkTuyaMCUOutputToChannel 118 val 26
    // setChannelType 26 PowerFactor_div1000
    // setChannelLabel 26 "Power Factor L1"
    
    // Dpid 18 "Dpid 18" -> channel 27
    linkTuyaMCUOutputToChannel 18 RAW 27
    // setChannelType 27 ReadOnly
    // setChannelLabel 27 "SETUP Dpid 18 SETUP_MaxP_MaxV_Min_V/UnbalanceC/Lack_of_Phase"
    //
    // uartSendHex 55AA00060018120000140101026203010109040100A0020000140500000077 - no 3Phase alarms
    // uartSendHex 55AA00060018120000140101026203010109040100A0020100140501000078 - 
    // MaxCurrEN=63A,MaxVolEN=265V,MinVolEn=160V,inbalanced 3Phase current EN=20%,lack of Phase EN
    
    //Delay to switch off by Under/Over Voltage - Dpid 123 "Delay to switch off by Under/Over Voltage" -> channel 31
    linkTuyaMCUOutputToChannel 123 val 31
    setChannelType 31 TextField
    setChannelLabel 31 "SETUP Delay to switch off by Under/Over Voltage"
    
    // Bad Voltage recovery time - Dpid 120 "Bad Voltage Recovery Time" -> channel 32
    linkTuyaMCUOutputToChannel 120 val 32
    setChannelType 32 TextField
    setChannelLabel 32 "SETUP recovery time from bad Voltage [s]"
    
    // Delay to switch off by Under/Over Current- Dpid 124 "Delay to switch off by Under/Over Current" -> channel 33
    linkTuyaMCUOutputToChannel 124 val 33
    setChannelType 33 TextField
    setChannelLabel 33 "SETUP to switch off by Under/Over Current"
    
    // Recovery time from Under/Over current - Dpid 121 "Recovery time from under/over current" -> channel 34
    linkTuyaMCUOutputToChannel 121 val 34
    setChannelType 34 TextField
    setChannelLabel 34 "SETUP recovery time from under/over current"
    
    // Dpid 131 "Dpid 131 - 0" -> channel 35
    linkTuyaMCUOutputToChannel 131 val 35
    setChannelType 35 ReadOnly
    setChannelLabel 35 "How many times OverCurrent has triggered since startup"
    
    // Dpid 127 "Dpid 127 - 0" -> channel 36
    // linkTuyaMCUOutputToChannel 127 val 36
    // setChannelType 36 ReadOnly
    // setChannelLabel 36 "Is Load on L1/A (1=yes/0=no)"
    
    // Dpid 128 "Dpid 128 - 0" -> channel 37
    // linkTuyaMCUOutputToChannel 128 val 37
    // setChannelType 37 ReadOnly
    // setChannelLabel 37 "Is Load on L2/B (1=yes/0=no)"
    
    // Dpid 129 "Dpid 129 - 0" -> channel 38
    // linkTuyaMCUOutputToChannel 129 val 38
    // setChannelType 38 ReadOnly
    // setChannelLabel 38 "Is Load on L3/C (1=yes/0=no)"
    
    // Dpid 136 "Dpid 136 - 1" -> channel 39 - for tests only
    // linkTuyaMCUOutputToChannel 136 val 39
    // setChannelType 39 TextField
    // setChannelLabel 39 "SETUP Voltage multiplier RW Dpid 136=1"
    
    // Dpid 137 "Dpid 137 - 1" -> channel 40 - for tests only
    // linkTuyaMCUOutputToChannel 137 val 40
    // setChannelType 40 TextField
    // setChannelLabel 40 "SETUP Current multiplier RW Dpid 137=1"
    
    // ______________________________________________ACCEPTED_________TILL_____THIS___LINE
    //  Dpid 12 "Dpid 12 - 1" -> channel 43 Not quite if no load, 0 clear something
    // linkTuyaMCUOutputToChannel 12 val 43
    // setChannelType 43 ReadOnly
    // setChannelLabel 43 "RO Dpid 12=1"
    
    // Dpid 13 "Dpid 13 - 1" -> channel 44
    // linkTuyaMCUOutputToChannel 13 val 44
    // setChannelType 44 ReadOnly
    // setChannelLabel 44 "RO Dpid 13=1"
    
    // Dpid 102 "Dpid 102 - 30" -> channel 45
    // linkTuyaMCUOutputToChannel 102 val 45
    // setChannelType 45 TextField
    // setChannelLabel 45 "RW Dpid 102=30"
    
    // Dpid 104 "Dpid 104 - 1" -> channel 46
    // linkTuyaMCUOutputToChannel 104 val 46
    // setChannelType 46 ReadOnly
    // setChannelLabel 46 "RO Dpid 104=1"
    
    // Dpid 112 "Dpid 112 - 0" -> channel 47
    // linkTuyaMCUOutputToChannel 112 val 47
    // setChannelType 47 ReadOnly
    // setChannelLabel 47 "RO Dpid 112=0"
    
    // Dpid 122 "Dpid 122 - 20" -> channel 48
    // Probably Lost Current Recovery Delay Time:1-9999s (Adjustable) (Default:20s) what it is???
    // linkTuyaMCUOutputToChannel 122 val 48
    // setChannelType 48 TextField
    // setChannelLabel 48 "RW Dpid 122=20"
    
    // "Dpid 125-10" -> channel 49
    // Probably Time Threshold of Lost Flow Event:1-999s (Adjustable)(Default:10s) what it is???
    // linkTuyaMCUOutputToChannel 125 val 49
    // setChannelType 49 TextField
    // setChannelLabel 49 "RW Dpid 125=10"
    
    // Dpid 132 "Dpid 132 - 0" -> channel 50
    // linkTuyaMCUOutputToChannel 132 val 50
    // setChannelType 50 ReadOnly
    // setChannelLabel 50 "RO Dpid 132=0"
    
    // Dpid 133 "Dpid 133 - 0" -> channel 51
    // linkTuyaMCUOutputToChannel 133 val 51
    // setChannelType 51 ReadOnly
    // setChannelLabel 51 "RO Dpid 133=0"
    
    // Dpid 134 "Dpid 134 - 2" -> channel 52
    // linkTuyaMCUOutputToChannel 134 val 52
    // setChannelType 52 ReadOnly
    // setChannelLabel 52 "RO Dpid 134=2"
    
    // Dpid 135 "Dpid 135 - 0" -> channel 53
    // linkTuyaMCUOutputToChannel 135 val 53
    // setChannelType 53 TextField
    // setChannelLabel 53 "RW Dpid 135=0"
    
    // Dpid 105 "Dpid 105" -> channel 54
    // linkTuyaMCUOutputToChannel 105 val 54
    // setChannelType 54 ReadOnly
    // setChannelLabel 54 "Dpid 105"
    
    // Dpid 106 "Dpid 106" -> channel 55
    // linkTuyaMCUOutputToChannel 106 val 55
    // setChannelType 55 ReadOnly
    // setChannelLabel 55 "Dpid 106 - j....EwAAAAAAAAAAAA=="
    
    // Dpid 109 "Dpid 109" -> channel 56
    // linkTuyaMCUOutputToChannel 109 val 56
    // setChannelType 56 ReadOnly
    // setChannelLabel 56 "Dpid 109 - AAA8"
    
    // Dpid 109 "Dpid 117" -> channel 57
    linkTuyaMCUOutputToChannel 117 RAW 57
    // setChannelType 57 ReadOnly
    // setChannelLabel 57 "Dpid 117-Probably scheduler"
    
    waitFor NTPState 1 // wait for NTPState 1 second
    tuyaMcu_sendCurTime //Send time to tuyaMCU
    
    // every 30 seconds, request update from TuyaMCU
    addRepeatingEvent 30 -1 tuyaMcu_sendQueryState
    //tuyaMcu_sendQueryState
    .

    RN8302B chip on a circuit board with visible monitoring components. .
    Fig. 2. Relay board, with measurement circuitry visible ReEnergy RN8302B .
    Relay board with visible measurement coils. .
    Fig. 3. Top view of the relays themselves, measuring coils on individual phases visible, neutral track not interrupted.
    Power supply board with various electronic components. .
    Fig. 4. The other side of the relay board showing the power supply based on the circuit with the description "8231H Q24A1006"
    Main PCB with CMS32L051, TM1622B, and EEPROM 24C64 chips .
    Fig. 5. Board with MCU CMS32L051 , display controller TM1622B , and 24C64 eeprom.
    Close-up of a circuit board with various electronic components, including integrated circuits. .
    Fig 6. The same board from a different angle visible circuit markings.
    LCD display board with control buttons. .
    Fig 7. The board with the display also visible buttons for operation.
    WiFi module CB3S with BK7231N chip showing pin labels. .
    Fig. 8. CB3S WiFi communication module based on BK7231N chip (screen not removed).
    Device EARU EAEMP3C-100-TY-W without front cover and measurement coil. .
    Figure 9: Relay including current leakage measurement coil.
    User manual for the EARU EAEMP3C-100-TY-W device showing the display and setting tables. .
    Scan of the device installation and usage instructions .
    Figure 10-11: Scan of instructions
    A long screenshot showing various views and specifications of the measurement device EARU EAEMP3C-100-TY-W. .
    Fig 12. A snapshot of the auction view.

    The goodies have arrived thanks!

    Pen next to a Goodram 128GB microSD card. .

    Cool? Ranking DIY
    About Author
    halinka1125
    Level 22  
    Offline 
    halinka1125 wrote 530 posts with rating 27, helped 49 times. Live in city Lublin. Been with us since 2002 year.
  • ADVERTISEMENT
  • #2 21411365
    p.kaczmarek2
    Moderator Smart Home
    Thanks for the presentation. As for improving the setup, I would start with whether this meter uses the UART (TuyaMCU) to report the connection to the cloud, or perhaps another pin?
    How do I get the TuyaMCU device to send more data? Why are dpIDs not being sent? .
    I, in the case of this device was not getting full dpIDs for anything until I set the right state on the respective pin....


    halinka1125 wrote:
    .
    However, the given code manages to crash and not give any other measurement except the last/starting one. It doesn't work, at least on this version of OpenBK, to capture the dpid with the "tuyaMcu_sendQueryState" command (or I don't know how to handle it).
    .
    Maybe call it up every so often?
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    



    halinka1125 wrote:

    The wifi settings reset key doesn't work properly - although in the logs you can see that it is supported - the WiFi reset command appears, it would be nice if it reset the wifi to factory settings as it did in the original firmware.
    .
    What does this look like in the logs? What message was that from TuyaMCU?



    halinka1125 wrote:
    .
    When you select more than 32 dpid the next one can be saved, but to delete it you have to format the whole device.
    .
    At this point I'm not sure I know what this is about, maybe the channel types are remembered? These can be changed in the Web App

    halinka1125 wrote:
    .
    Some of the settings only appear in the debug log when the settings are saved on the meter - I wonder if any command can trigger such a report? Below is such a message:
    .
    And which dpID is this?


    You can also enable the TuyaMCU queue flag in flags.
    Helpful post? Buy me a coffee.
  • #3 21411416
    halinka1125
    Level 22  
    >>21411365 .
    Thanks for your support!
    I have added a mechanism to force the download as follows
    and the dpID part actually downloads ... I need to test more thoroughly ...
    Only the UART is derived from the CB3S module, an additional connected pin controls the power supply of the chip. The led is controlled from the MCU not from the CB3S.
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    .

    Regarding the WiFi reset, it is implemented by the buttons connected to the MCU, when the option is selected from the menu (net-rs) a command is sent to the CB3S module,this appears in the debug log:
    
    Info:MAIN:Time 1552, idle 195122/s, free 55336, MQTT 0(97), bWifi 1, secondsWithNoPing 1482, socks 2/38 
    Info:TuyaMCU:Received: 55 AA 03 04 00 00 06 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 4 (WiFiReset) len 7
    Info:TuyaMCU:ProcessIncoming: 0x04 replying
    Info:TuyaMCU:Received: 55 AA 03 05 00 01 00 08 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 5 (WiFiSelect) len 8
    Info:MAIN:Time 1553, idle 187514/s, free 55336, MQTT 0(97), bWifi 1, secondsWithNoPing 1483, socks 2/38 
    Info:MAIN:Time 1554, idle 190035/s, free 55336, MQTT 0(97), bWifi 1, secondsWithNoPing 1484, socks 2/38 
    
    .
    Fixed in OpenBK7231N_QIO_1.18.26
    It is the Web App that I am concerned with, there are 32 "checkboxes" available, if we add more than 32 then the next ones cannot be deleted once we use them, they always remain visible on the page with the value 0. (even though we stop using them).
    Quote:
    .
    When more than 32 dpid are selected, the next one can be saved, but to delete it you have to format the whole device.


    Well precisely there is no dpID the device sends the message 00181200.... when saving the settings. - it is only visible in the log. There is for sure current max, voltage min and max, the rest I have not deciphered.
    
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    ... info o wifi
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    00 18 12 00 00 14 01 01  03 2A  03 01 01 04  04  01 00 B2  02  00 00 14 05 00 00 00 51 
    
    .
    Quote:
    .
    Some of the settings only appear in the debug log when the settings are saved to the meter - I wonder if any command can trigger such a report? Below is such a message:
    And which dpID is this?
    .

    And I have another question about WiFi activity is it normal that the module performs so many wifi related operations?
    also a message often appears
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    .
    It seems to be the WiFi status that is called up?

    Updated autoexec below, seems to be more stable.
    Still no reading of PF_L2,PF_L3, individual frequencies, total energy. Updated dpID list with those that appeared after setting the Query flag (3pc in total 105,106,109), Decrypted a few more dpIDs, 14 of unknown significance remain.
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    ntp_timeZoneOfs 1 //optional
    tuyaMcu_sendCurTime //wysyła czas z TuyaMCU do MCU, bez tego jak zgubił czas to nie uaktualniał
    
    // This one is better than tuyaMcu_defWiFiState 4;  MQTTState 1 = WiFiState 4
    // issuing of tuyaMcu_defWiFiState 4 continues the script,
    // but doesnt report to MQTT since there is still no connection.
    // if you didn't setup MQTT connection then issue tuyaMcu_defWiFiState 4
    // and comment waitFor MQTTState 1
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Main Relay - Dpid 16 "switch" -> Channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Main power switch"
    
    // Total energy Used - Dpid 1 "Power Used" -> channel 4
    linkTuyaMCUOutputToChannel 1 val 4
    setChannelType 4 EnergyTotal_kWh_div100
    setChannelLabel 4 "Total Energy used"
    
    // Total Power Dpid 111 -> channel 3
    linkTuyaMCUOutputToChannel 111 val 3
    setChannelType 3 ReadOnly
    setChannelLabel 3 "Total Power W"
    
    // Fault - Dpid 9 "fault" -> channel 2
    linkTuyaMCUOutputToChannel 9 raw 2
    setChannelType 2 ReadOnly
    setChannelLabel 2 "Fault (mapa bitów)"
    
    linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP 5
    setChannelType 5 Voltage_div10
    setChannelLabel 5 "Voltage A"
    setChannelType 6 Current_div1000
    setChannelLabel 6 "Current A"
    setChannelType 7 Power
    setChannelLabel 7 "Power A"
    
    linkTuyaMCUOutputToChannel 7 RAW_TAC2121C_VCP 8
    //corruption detected
    //corruption detected
    setChannelType 8 Voltage_div10
    setChannelLabel 8 "Voltage B"
    setChannelType 9 Current_div1000
    setChannelLabel 9 "Current B"
    setChannelType 10 Power
    setChannelLabel 10 "Power B"
    
    linkTuyaMCUOutputToChannel 8 RAW_TAC2121C_VCP 11
    setChannelType 11 Voltage_div10
    setChannelLabel 11 "Voltage C"
    setChannelType 12 Current_div1000
    setChannelLabel 12 "Current C"
    setChannelType 13 Power
    setChannelLabel 13 "Power C"
    
    // Leakage tripping - Dpid 15 "leakage_tripping" -> channel 14
    linkTuyaMCUOutputToChannel 15 val 14
    setChannelType 14 ReadOnly
    setChannelLabel 14"Earth Leakage value [mA]"
    
    // Device temperature - Dpid 15 "Device temperature" -> channel 15
    linkTuyaMCUOutputToChannel 103 val 15
    setChannelType 15 Temperature
    setChannelLabel 15 "Device temperature [C]"
    
    // Alarm temperature - Dpid 118 "Power Factor L1" -> channel 16
    linkTuyaMCUOutputToChannel 118 val 16
    setChannelType 16 PowerFactor_div1000
    setChannelLabel 16 "Power Factor L1"
    
    // Bad Voltage recovery time - Dpid 120 "Bad Voltage Recovery Time" -> channel 17
    linkTuyaMCUOutputToChannel 120 val 17
    setChannelType 17 TextField
    setChannelLabel 17 "Set recovery time from bad Voltage [s]"
    
    // Recovery time from Under/Over current - Dpid 121 "Recovery time from under/over current" -> channel 18
    linkTuyaMCUOutputToChannel 121 val 18
    setChannelType 18 TextField
    setChannelLabel 18 "Set recovery time from under/over current"
    
    //Delay to switch off by Under/Over Voltage - Dpid 123 "Delay to switch off by Under/Over Voltage" -> channel 19
    linkTuyaMCUOutputToChannel 123 val 19
    setChannelType 19 TextField
    setChannelLabel 19 "Delay to switch off by Under/Over Voltage"
    
    // Delay to switch off by Under/Over Current- Dpid 124 "Delay to switch off by Under/Over Current" -> channel 20
    linkTuyaMCUOutputToChannel 124 val 20
    setChannelType 20 TextField
    setChannelLabel 20 "Delay to switch off by Under/Over Current"
    
    // Dpid 127 "Dpid 127 - 0" -> channel 21
    linkTuyaMCUOutputToChannel 127 val 21
    setChannelType 21 ReadOnly
    setChannelLabel 21 "Is Load on L1/A (1=yes/0=no)"
    
    // Dpid 128 "Dpid 128 - 0" -> channel 22
    linkTuyaMCUOutputToChannel 128 val 22
    setChannelType 22 ReadOnly
    setChannelLabel 22 "Is Load on L2/B (1=yes/0=no)"
    
    // Dpid 129 "Dpid 129 - 0" -> channel 23
    linkTuyaMCUOutputToChannel 129 val 23
    setChannelType 23 ReadOnly
    setChannelLabel 23 "Is Load on L3/C (1=yes/0=no)"
    
    // Dpid 131 "Dpid 131 - 0" -> channel 31
    linkTuyaMCUOutputToChannel 131 val 31
    setChannelType 31 ReadOnly
    setChannelLabel 31 "How many times OverCurrent has triggered RO Dpid 131=0"
    
    // Dpid 136 "Dpid 136 - 1" -> channel 36
    linkTuyaMCUOutputToChannel 136 val 36
    setChannelType 36 TextField
    setChannelLabel 36 "Readed Voltage multiplier RW Dpid 136=1"
    
    // Dpid 137 "Dpid 137 - 1" -> channel 37
    linkTuyaMCUOutputToChannel 137 val 37
    setChannelType 37 TextField
    setChannelLabel 37 "Readed Current multiplier RW Dpid 137=1"
    
    // ______________________________________________ACCEPTED_________TILL_____THIS___LINE
    //  Dpid 12 "Dpid 12 - 1" -> channel 24
    linkTuyaMCUOutputToChannel 12 val 24
    setChannelType 24 ReadOnly
    setChannelLabel 24 "RO Dpid 12=1"
    
    // Dpid 13 "Dpid 13 - 1" -> channel 25
    linkTuyaMCUOutputToChannel 13 val 25
    setChannelType 25 ReadOnly
    setChannelLabel 25 "RO Dpid 13=1"
    
    // Dpid 102 "Dpid 102 - 30" -> channel 26
    linkTuyaMCUOutputToChannel 102 val 26
    setChannelType 26 TextField
    setChannelLabel 26 "RW Dpid 102=30"
    
    // Dpid 104 "Dpid 104 - 1" -> channel 27
    linkTuyaMCUOutputToChannel 104 val 27
    setChannelType 27 ReadOnly
    setChannelLabel 27 "RO Dpid 104=1"
    
    // Dpid 112 "Dpid 112 - 0" -> channel 28
    linkTuyaMCUOutputToChannel 112 val 28
    setChannelType 28 ReadOnly
    setChannelLabel 28 "RO Dpid 112=0"
    
    // Dpid 122 "Dpid 122 - 20" -> channel 29
    linkTuyaMCUOutputToChannel 122 val 29
    setChannelType 29 TextField
    setChannelLabel 29 "RW Dpid 122=20"
    
    // "Dpid 125-20" -> channel 30
    linkTuyaMCUOutputToChannel 125 val 30
    setChannelType 30 TextField
    setChannelLabel 30 "RW Dpid 125=20"
    
    // Dpid 132 "Dpid 132 - 0" -> channel 32
    linkTuyaMCUOutputToChannel 132 val 32
    setChannelType 32 ReadOnly
    setChannelLabel 32 "RO Dpid 132=0"
    
    // Dpid 133 "Dpid 133 - 0" -> channel 33
    linkTuyaMCUOutputToChannel 133 val 33
    setChannelType 33 ReadOnly
    setChannelLabel 33 "RO Dpid 133=0"
    
    // Dpid 134 "Dpid 134 - 2" -> channel 34
    linkTuyaMCUOutputToChannel 134 val 34
    setChannelType 34 ReadOnly
    setChannelLabel 34 "RO Dpid 134=2"
    
    // Dpid 135 "Dpid 135 - 0" -> channel 35
    linkTuyaMCUOutputToChannel 135 val 35
    setChannelType 35 TextField
    setChannelLabel 35 "RW Dpid 135=0"
    
    // Dpid 105 "Dpid 105" -> channel 38
    linkTuyaMCUOutputToChannel 105 val 38
    setChannelType 38 ReadOnly
    setChannelLabel 38 "Dpid 105"
    
    // Dpid 106 "Dpid 106" -> channel 39
    linkTuyaMCUOutputToChannel 106 val 39
    setChannelType 39 ReadOnly
    setChannelLabel 39 "Dpid 106 - j....EwAAAAAAAAAAAA=="
    
    // Dpid 109 "Dpid 109" -> channel 40
    linkTuyaMCUOutputToChannel 109 val 40
    setChannelType 40 ReadOnly
    setChannelLabel 40 "Dpid 106 - AAA8"
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    //tuyaMcu_sendQueryState
    
    .
  • #4 21412434
    halinka1125
    Level 22  
    Hello again after some tests

    Is it possible to change the RAW_TAC2121C_VCP parameter so that it shows the power factor and frequency in addition?
    After looking at the topic https://www.elektroda.pl/rtvforum/topic4059060.html
    I see
    
    Info:TuyaMCU:ParseState: id 8 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 71 00 00 0F 09 29 00 01 B7 00 03 FC 00 00 00 03 E8 C3 32 65 
    

    that 03E8 - is 99% the Power Factor for that phase
    and C332 - is its frequency
    And I wanted to ask if after backing your configuration and RF config to the BK7231N dump, do you need to count any checksums or should it work?
    Greetings
  • #5 21412448
    p.kaczmarek2
    Moderator Smart Home
    The number of channel types I have corrected, the Access Point opening I will upload soon, check?

    I will add the package soon.

    Added after 43 [seconds]: .

    https://github.com/openshwprojects/OpenBK7231...mmit/e5e6a962ea2e4e3678b2fca3ab32f77d82eb4f57

    Added after 5 [minutes]:

    This is the kind of parsing you would want? Must be a separate package type because I can't change the old one without messing up existing configurations.
    Screenshot of Visual Studio editor with an open C source code file. .
    Helpful post? Buy me a coffee.
  • #6 21412534
    halinka1125
    Level 22  
    >>21412448 .
    WiFi reset now works correctly:) .
    Hmm parsing does not work on .27 - dpID looks like this:
    
    Info:TuyaMCU:ParseState: id 8 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 72 00 00 0F 09 29 00 00 00 00 00 00 00 00 00 03 E8 C3 32 AF 
    
    .
    As parsing I have to enter "RAW_VCPPfF" ?
    This is the autoexec I have now
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    ntp_timeZoneOfs 1 //optional
    tuyaMcu_sendCurTime //wysyła czas z TuyaMCU do MCU, bez tego jak zgubił czas to nie uaktualniał
    
    // This one is better than tuyaMcu_defWiFiState 4;  MQTTState 1 = WiFiState 4
    // issuing of tuyaMcu_defWiFiState 4 continues the script,
    // but doesnt report to MQTT since there is still no connection.
    // if you didn't setup MQTT connection then issue tuyaMcu_defWiFiState 4
    // and comment waitFor MQTTState 1
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Main Relay - Dpid 16 "switch" -> Channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Main power switch"
    
    // Total energy Used - Dpid 1 "Power Used" -> channel 4
    linkTuyaMCUOutputToChannel 1 val 4
    setChannelType 4 EnergyTotal_kWh_div100
    setChannelLabel 4 "Total Energy used"
    
    // Total Power Dpid 111 -> channel 3
    linkTuyaMCUOutputToChannel 111 val 3
    setChannelType 3 ReadOnly
    setChannelLabel 3 "Total Power W"
    
    // Fault - Dpid 9 "fault" -> channel 2
    linkTuyaMCUOutputToChannel 9 val 2
    setChannelType 2 Error
    setChannelLabel 2 "Fault (mapa bitów)"
    
    linkTuyaMCUOutputToChannel 8 RAW_VCPPfF 11
    setChannelType 11 Voltage_div10
    setChannelLabel 11 "Voltage C"
    setChannelType 12 Current_div1000
    setChannelLabel 12 "Current C"
    setChannelType 13 Power
    setChannelLabel 13 "Power C"
    setChannelType 14 PowerFactor_div1000
    setChannelLabel 14 "PowerFactor"
    setChannelType 15 Frequency_div100
    setChannelLabel 15 "Freq"
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    //tuyaMcu_sendQueryState
    
    .
    Or is this not yet present in v.27?
  • ADVERTISEMENT
  • #7 21412638
    p.kaczmarek2
    Moderator Smart Home
    The one in the screenshot I didn't put on release, I'm still testing. I only uploaded it now:
    https://github.com/openshwprojects/OpenBK7231...mmit/0b39365b54586f628e311f9cddf03b5f4643f9b9
    Screenshot of source code in Visual Studio editor.

    I also see that you want a confirmation for the Write operation from the flasher?
    Helpful post? Buy me a coffee.
  • #8 21412724
    halinka1125
    Level 22  
    >>21412638 .
    Yes in flasher it would be nice if it asked by default, and for example it would be possible to disable the question like for the restore flash option. It would save my dump, I'm not saying it wasn't my fault because I put the cursor there:P .
    From the facilities it would be in the reading window after typing the file name/(or not) it could work enter as confirmation.

    Regarding dpIDs, I think I'm missing something because they're not always the same length. dpIDs 6,7,8 are VCP, but they're not always the same length - once 19- once 12, out of oddities I've had dpID 114 appear which I hadn't seen before. The last two bytes on the bank are frequency, but the power factor has moved from dpID 8 to dpID 114 for me.... However, they have no values in Web - everything is at 0 when I use the old dpID 6,7,8.
    Something strange I must have done...
    Now the dpIDs of the phases are 113,114,115 and they are correct, only for the div1000 frequency would it be useful as it gives it 10x inflated.

    
    Info:TuyaMCU:ParseState: id 127 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 09 0D 00 00 00 00 00 00 39 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 6 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 71 00 00 0F 09 0D 00 00 00 00 00 00 00 00 00 03 E8 C3 32 92 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 113 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 80 04 00 01 00 93 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 128 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 81 04 00 01 01 95 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 129 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 07 00 00 08 09 0E 00 00 00 00 00 00 3B 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 7 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 08 00 00 08 09 0F 00 00 BF 00 00 0C 08 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 8 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 72 00 00 0F 09 0E 00 00 00 00 00 00 00 00 00 03 E8 C3 32 94 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 114 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 73 00 00 0F 09 0F 00 00 BF 00 00 78 00 00 25 01 10 C3 32 18 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 115 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 6F 02 00 04 00 00 00 0C 92 
    ...
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 09 0E 00 00 00 00 00 00 3A 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 6 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 71 00 00 0F 09 0E 00 00 00 00 00 00 00 00 00 03 E8 C3 5A BB 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 113 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 80 04 00 01 00 93 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 128 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 81 04 00 01 01 95 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 129 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 07 00 00 08 09 0F 00 00 00 00 00 00 3C 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 7 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 08 00 00 08 09 0F 00 00 BE 00 00 0C 07 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 19
    Info:TuyaMCU:ParseState: id 8 type 0-raw len 8
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 72 00 00 0F 09 0F 00 00 00 00 00 00 00 00 00 03 E8 C3 5A BD 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 114 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 73 00 00 0F 09 0F 00 00 BE 00 00 78 00 00 25 01 10 C3 5A 3F 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 115 type 0-raw len 15
    
    .
  • ADVERTISEMENT
  • #9 21412762
    p.kaczmarek2
    Moderator Smart Home
    After all, in the log you gave I can see:
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 72 00 00 0F 09 0E 00 00 00 00 00 00 00 00 00 03 E8 C3 32 94 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 114 type 0-raw len 15
    Info:TuyaMCU:Received: 55 AA 03 07 00 13 73 00 00 0F 09 0F 00 00 BF 00 00 78 00 00 25 01 10 C3 32 18 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 26
    Info:TuyaMCU:ParseState: id 115 type 0-raw len 15
    
    .
    dpID 114 and 115 are 15 in length, I don't see that they have any other length.
    113 is the same.

    As I paste into myself for automatic testing:
    Code: C / C++
    Log in, to see the code
    .
    and I put a breakpoint, I can see that they are parsed:
    Screenshot of source code for TuyaMCU. .
    Screenshot of code analyzing TuyaMCU data, showing how to calculate voltage, current, power, power factor, and frequency. .
    Looks ok to me. You have three dpID of the raw type:
    - 113
    - 114
    - 115
    Each is of type RAW_VCPPfF and contains in turn Voltage, Current, Power, PowerFactor, Frequency.

    And why do you have dpID 8 in your autoexec.bat?
    Screenshot showing code related to TuyaMCU and channel configuration. .
    At this point I think you should be catching dpID 113, 114 and 115, as this is probably the information for each phase.


    Generally they don't have one standard, if RAW_VCPPfF will work with 113, 114 and 115 then ignore 6, 7, 8 and that's it.

    Div1000 I can add, although I admit it came out a bit awkwardly with this, admittedly adding this divider is one place in the board, but still, at the planning stage of this we didn't know TuyaMCU that much.... supposedly there is an alternative way, because you can when mapping a single variable give your own divisor, but still....

    Added after 7 [minutes]: .

    I read the posts again and I know what happened :D .
    Nothing has moved. You accidentally copied incorrectly from the log so that you merged two message fragments from different dpIDs into one and thought it was dpID 8.... Take a look at the screenshot:
    Screenshot of TuyaMCU Explorer with data in hex format. .
    Line one is from the previous package and line two is from the next package.... hence the impression that dpID 8 was longer.
    Helpful post? Buy me a coffee.
  • #10 21412816
    halinka1125
    Level 22  
    Well ok I agree that currently dpID 113,114,115 are the sought after values, just why didn't they appear before?
    After substituting as VCPPfF these dpIDs everything starts working as intended.
    The old dpID 6,7,8 as a "shortened" version also works:D .
    I just need to think more about how to extract the energy values because for now it only shows the consumed energy.
    At the moment 90%function and 100% usability works. When I'm inspired I'll try to look for the rest.
    Thank you for the amazing developer support:) .
    If you add a divider let us know.
    Below the current autoexec for the version with Frequency_div1000
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    ntp_timeZoneOfs 1 //optional
    tuyaMcu_sendCurTime //wysyła czas z TuyaMCU do MCU, bez tego jak zgubił czas to nie uaktualniał
    
    // This one is better than tuyaMcu_defWiFiState 4;  MQTTState 1 = WiFiState 4
    // issuing of tuyaMcu_defWiFiState 4 continues the script,
    // but doesnt report to MQTT since there is still no connection.
    // if you didn't setup MQTT connection then issue tuyaMcu_defWiFiState 4
    // and comment waitFor MQTTState 1
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Main Relay - Dpid 16 "switch" -> Channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Main power switch"
    
    // Total energy Used - Dpid 1 "Power Used" -> channel 4
    linkTuyaMCUOutputToChannel 1 val 4
    setChannelType 4 EnergyTotal_kWh_div100
    setChannelLabel 4 "Total Energy used"
    
    // Total Power Dpid 111 -> channel 3
    linkTuyaMCUOutputToChannel 111 val 3
    setChannelType 3 ReadOnly
    setChannelLabel 3 "Total Power W"
    
    // Fault - Dpid 9 "fault" -> channel 2
    linkTuyaMCUOutputToChannel 9 val 2
    setChannelType 2 Error
    setChannelLabel 2 "Fault (mapa bitów)"
    
    //------------------------------------------------------------
    // dpID short Voltage Current Power IDs can be used alternative full VCPPfF IDs 113,114,115
    // linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP 5
    // setChannelType 5 Voltage_div10
    // setChannelLabel 5 "Voltage A"
    // setChannelType 6 Current_div1000
    // setChannelLabel 6 "Current A"
    // setChannelType 7 Power
    // setChannelLabel 7 "Power A"
    //
    // linkTuyaMCUOutputToChannel 7 RAW_TAC2121C_VCP 8
    // setChannelType 8 Voltage_div10
    // setChannelLabel 8 "Voltage B"
    // setChannelType 9 Current_div1000
    // setChannelLabel 9 "Current B"
    // setChannelType 10 Power
    // setChannelLabel 10 "Power B"
    //
    // linkTuyaMCUOutputToChannel 8 RAW_TAC2121C_VCP 11
    // setChannelType 11 Voltage_div10
    // setChannelLabel 11 "Voltage C"
    // setChannelType 12 Current_div1000
    // setChannelLabel 12 "Current C"
    // setChannelType 13 Power
    // setChannelLabel 13 "Power C"
    // -------------------------------------------------------------
    linkTuyaMCUOutputToChannel 113 RAW_VCPPfF 5
    setChannelType 5 Voltage_div10
    setChannelLabel 5 "Voltage A"
    setChannelType 6 Current_div1000
    setChannelLabel 6 "Current A"
    setChannelType 7 Power_div10
    setChannelLabel 7 "Power A"
    setChannelType 8 PowerFactor_div1000
    setChannelLabel 8 "PowerFactor A"
    setChannelType 9 Frequency_div1000
    setChannelLabel 9 "Frequency A"
    
    linkTuyaMCUOutputToChannel 114 RAW_VCPPfF 10
    setChannelType 10 Voltage_div10
    setChannelLabel 10 "Voltage B"
    setChannelType 11 Current_div1000
    setChannelLabel 11 "Current B"
    setChannelType 12 Power_div10
    setChannelLabel 12 "Power B"
    setChannelType 13 PowerFactor_div1000
    setChannelLabel 13 "PowerFactor B"
    setChannelType 14 Frequency_div1000
    setChannelLabel 14 "Frequency B"
    
    linkTuyaMCUOutputToChannel 115 RAW_VCPPfF 15
    setChannelType 15 Voltage_div10
    setChannelLabel 15 "Voltage C"
    setChannelType 16 Current_div1000
    setChannelLabel 16 "Current C"
    setChannelType 17 Power_div10
    setChannelLabel 17 "Power C"
    setChannelType 18 PowerFactor_div1000
    setChannelLabel 18 "PowerFactor C"
    setChannelType 19 Frequency_div1000
    setChannelLabel 19 "Frequency C"
    
    // Leakage tripping - Dpid 15 "leakage_tripping" -> channel 20
    linkTuyaMCUOutputToChannel 15 val 20
    setChannelType 20 ReadOnly
    setChannelLabel 20 "Earth Leakage value [mA]"
    
    // Device temperature - Dpid 103 "Device temperature" -> channel 21
    linkTuyaMCUOutputToChannel 103 val 21
    setChannelType 21 Temperature
    setChannelLabel 21 "Device temperature [C]"
    
    // Alarm temperature - Dpid 118 "Power Factor L1" -> channel 22
    linkTuyaMCUOutputToChannel 118 val 22
    setChannelType 22 PowerFactor_div1000
    setChannelLabel 22 "Power Factor L1"
    
    //Delay to switch off by Under/Over Voltage - Dpid 123 "Delay to switch off by Under/Over Voltage" -> channel 23
    linkTuyaMCUOutputToChannel 123 val 23
    setChannelType 23 TextField
    setChannelLabel 23 "Delay to switch off by Under/Over Voltage"
    
    // Bad Voltage recovery time - Dpid 120 "Bad Voltage Recovery Time" -> channel 24
    linkTuyaMCUOutputToChannel 120 val 24
    setChannelType 24 TextField
    setChannelLabel 24 "Set recovery time from bad Voltage [s]"
    
    // Delay to switch off by Under/Over Current- Dpid 124 "Delay to switch off by Under/Over Current" -> channel 25
    linkTuyaMCUOutputToChannel 124 val 25
    setChannelType 25 TextField
    setChannelLabel 25 "Delay to switch off by Under/Over Current"
    
    // Recovery time from Under/Over current - Dpid 121 "Recovery time from under/over current" -> channel 26
    linkTuyaMCUOutputToChannel 121 val 26
    setChannelType 26 TextField
    setChannelLabel 26 "Set recovery time from under/over current"
    
    // Dpid 127 "Dpid 127 - 0" -> channel 27
    linkTuyaMCUOutputToChannel 127 val 27
    setChannelType 27 ReadOnly
    setChannelLabel 27 "Is Load on L1/A (1=yes/0=no)"
    
    // Dpid 128 "Dpid 128 - 0" -> channel 28
    linkTuyaMCUOutputToChannel 128 val 28
    setChannelType 28 ReadOnly
    setChannelLabel 28 "Is Load on L2/B (1=yes/0=no)"
    
    // Dpid 129 "Dpid 129 - 0" -> channel 29
    linkTuyaMCUOutputToChannel 129 val 29
    setChannelType 29 ReadOnly
    setChannelLabel 29 "Is Load on L3/C (1=yes/0=no)"
    
    // Dpid 131 "Dpid 131 - 0" -> channel 30
    linkTuyaMCUOutputToChannel 131 val 30
    setChannelType 30 ReadOnly
    setChannelLabel 30 "How many times OverCurrent has triggered RO Dpid 131=0"
    
    // Dpid 136 "Dpid 136 - 1" -> channel 31
    linkTuyaMCUOutputToChannel 136 val 31
    setChannelType 31 TextField
    setChannelLabel 31 "Readed Voltage multiplier RW Dpid 136=1"
    
    // Dpid 137 "Dpid 137 - 1" -> channel 32
    linkTuyaMCUOutputToChannel 137 val 32
    setChannelType 32 TextField
    setChannelLabel 32 "Readed Current multiplier RW Dpid 137=1"
    
    // ______________________________________________ACCEPTED_________TILL_____THIS___LINE
    //  Dpid 12 "Dpid 12 - 1" -> channel 33
    linkTuyaMCUOutputToChannel 12 val 33
    setChannelType 33 ReadOnly
    setChannelLabel 33 "RO Dpid 12=1"
    
    // Dpid 13 "Dpid 13 - 1" -> channel 34
    linkTuyaMCUOutputToChannel 13 val 34
    setChannelType 34 ReadOnly
    setChannelLabel 34 "RO Dpid 13=1"
    
    // Dpid 102 "Dpid 102 - 30" -> channel 35
    linkTuyaMCUOutputToChannel 102 val 35
    setChannelType 35 TextField
    setChannelLabel 35 "RW Dpid 102=30"
    
    // Dpid 104 "Dpid 104 - 1" -> channel 36
    linkTuyaMCUOutputToChannel 104 val 36
    setChannelType 36 ReadOnly
    setChannelLabel 36 "RO Dpid 104=1"
    
    // Dpid 112 "Dpid 112 - 0" -> channel 37
    linkTuyaMCUOutputToChannel 112 val 37
    setChannelType 37 ReadOnly
    setChannelLabel 37 "RO Dpid 112=0"
    
    // Dpid 122 "Dpid 122 - 20" -> channel 38
    linkTuyaMCUOutputToChannel 122 val 38
    setChannelType 38 TextField
    setChannelLabel 38 "RW Dpid 122=20"
    
    // "Dpid 125-20" -> channel 39
    linkTuyaMCUOutputToChannel 125 val 39
    setChannelType 39 TextField
    setChannelLabel 39 "RW Dpid 125=20"
    
    // Dpid 132 "Dpid 132 - 0" -> channel 40
    linkTuyaMCUOutputToChannel 132 val 40
    setChannelType 40 ReadOnly
    setChannelLabel 40 "RO Dpid 132=0"
    
    // Dpid 133 "Dpid 133 - 0" -> channel 41
    linkTuyaMCUOutputToChannel 133 val 41
    setChannelType 41 ReadOnly
    setChannelLabel 41 "RO Dpid 133=0"
    
    // Dpid 134 "Dpid 134 - 2" -> channel 42
    linkTuyaMCUOutputToChannel 134 val 42
    setChannelType 42 ReadOnly
    setChannelLabel 42 "RO Dpid 134=2"
    
    // Dpid 135 "Dpid 135 - 0" -> channel 43
    linkTuyaMCUOutputToChannel 135 val 43
    setChannelType 43 TextField
    setChannelLabel 43 "RW Dpid 135=0"
    
    // Dpid 105 "Dpid 105" -> channel 44
    linkTuyaMCUOutputToChannel 105 val 44
    setChannelType 44 ReadOnly
    setChannelLabel 44 "Dpid 105"
    
    // Dpid 106 "Dpid 106" -> channel 45
    linkTuyaMCUOutputToChannel 106 val 45
    setChannelType 45 ReadOnly
    setChannelLabel 45 "Dpid 106 - j....EwAAAAAAAAAAAA=="
    
    // Dpid 109 "Dpid 109" -> channel 46
    linkTuyaMCUOutputToChannel 109 val 46
    setChannelType 46 ReadOnly
    setChannelLabel 46 "Dpid 106 - AAA8"
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    //tuyaMcu_sendQueryState
    
    .
    Have a nice evening!
  • #11 21413424
    p.kaczmarek2
    Moderator Smart Home
    These tuyaMcu_sendCurTime you should move to the end of the script and add maybe some delay or waitFor before it, e.g:
    
    waitFor NTPState 1
    tuyaMcu_sendCurTime 
    
    .
    because otherwise the time will send before it downloads from NTP.

    I added a type for the frequency:
    User interface with diagnostic information for the WinTest_3145CAFF device. .
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #12 21413470
    halinka1125
    Level 22  
    Thank you
    I have changed as advised, there are correct frequency and power factor readings.
    Control panel with the main power switch on, displaying energy consumption and electrical parameters.
    Have a nice day!
    PS. How to correctly declare the error/status dpID shows that the data is normally 5 bytes:
    09 05 00 01 00 - but are read as 0 with me.
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 00 1D - normal state
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 9 type 5-bitmap len 1
    Info:TuyaMCU:ParseState: byte 0
    Info:GEN:No change in channel 2 (still set to 0) - ignoring
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 04 00 23 - overvoltage
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 13
    Info:TuyaMCU:ParseState: id 9 type 5-bitmap len 2
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 08 00 27 - undervoltage
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 13
    Info:TuyaMCU:ParseState: id 9 type 5-bitmap len 2
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 01 00 20 - overcurrent
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 13
    Info:TuyaMCU:ParseState: id 9 type 5-bitmap len 2
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 01 00 20 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 13
    Info:TuyaMCU:ParseState: id 9 type 5-bitmap len 2
    


    I have decoded the following dpIDs
    110 - energy produced
    17 - contains set leakage current
    18 - contains set maximum current, maximum voltage, minimum voltage.
    Screenshot showing TuyaMCU process data. .
    
    id 17 type 0-raw len 8
    Info:TuyaMCU:Received:  55 AA 03 07 00 0C 11 00 00 08 05 01 00 55 04 00 00 1B A8													
    id 18 type 0-raw len 20
    Info:TuyaMCU:Received: 55 AA 03 07 00 18 12 00 00 14 01 01 02 58 03 01 01 13 04 01 00 3F 02 00 00 14 05 00 00 00 1A 
    
    .
    Just how to handle it...
    I have a question if it is possible to increase the size of the log buffer, or to set it to write to a file, because with a lot of pids the window is missing and doesn't display most of them....
    Specifically, after defining a dpID in the log, some dpIDs no longer appear even though they are read to html.

    Current setup, unknown dpIDs excluded, duplicated, 'logically' ordered.
    There are readings of voltage, current, power, frequency, power factor,
    There is voltage, current, power, frequency, power factor, for all 3 phases, visible leakage current, unit temperature, energy consumed, energy produced, Some parameters can be set remotely. The dpIDs for the others are found but I cannot enter them to display them in the panel. The dpID117 is probably responsible for the schedule /I have no way of checking this/. This version works quite stably...
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    ntp_timeZoneOfs 1 //optional
    tuyaMcu_sendCurTime //wysyła czas z TuyaMCU do MCU, bez tego jak zgubił czas to nie uaktualniał
    
    // This one is better than tuyaMcu_defWiFiState 4;  MQTTState 1 = WiFiState 4
    // issuing of tuyaMcu_defWiFiState 4 continues the script,
    // but doesnt report to MQTT since there is still no connection.
    // if you didn't setup MQTT connection then issue tuyaMcu_defWiFiState 4
    // and comment waitFor MQTTState 1
    
    // waitFor MQTTState 1
    tuyaMcu_defWiFiState 4
    
    // Main Relay - Dpid 16 "switch" -> Channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Main power switch"
    
    // Total energy Used - Dpid 1 "Energy Used" -> channel 2
    linkTuyaMCUOutputToChannel 1 val 2
    setChannelType 2 EnergyTotal_kWh_div100
    setChannelLabel 2 "Total Energy used"
    
    // Dpid 110 "Dpid 110" Energy Produced-> channel 3
    linkTuyaMCUOutputToChannel 110 val 3
    setChannelType 3 EnergyTotal_kWh_div100
    setChannelLabel 3 "Produced Energy kWh"
    
    // Total Power Dpid 111 -> channel 4
    linkTuyaMCUOutputToChannel 111 val 4
    setChannelType 4 ReadOnly
    setChannelLabel 4 "Total Connected Power W"
    
    // Fault - Dpid 9 "fault" -> channel 5
    linkTuyaMCUOutputToChannel 9 BITMAP 5
    setChannelType 5 ReadOnly
    setChannelLabel 5 "Fault (mapa bitów)"
    
    //------------------------------------------------------------
    // dpID short Voltage Current Power IDs can be used alternative full VCPPfF IDs 113,114,115
    // linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP 7
    // setChannelType 7 Voltage_div10
    // setChannelLabel 7 "Voltage A"
    // setChannelType 8 Current_div1000
    // setChannelLabel 8 "Current A"
    // setChannelType 9 Power
    // setChannelLabel 9 "Power A"
    //
    // linkTuyaMCUOutputToChannel 7 RAW_TAC2121C_VCP 10
    // setChannelType 10 Voltage_div10
    // setChannelLabel 10 "Voltage B"
    // setChannelType 11 Current_div1000
    // setChannelLabel 11 "Current B"
    // setChannelType 12 Power
    // setChannelLabel 12 "Power B"
    //
    // linkTuyaMCUOutputToChannel 8 RAW_TAC2121C_VCP 13
    // setChannelType 13 Voltage_div10
    // setChannelLabel 13 "Voltage C"
    // setChannelType 14 Current_div1000
    // setChannelLabel 14 "Current C"
    // setChannelType 15 Power
    // setChannelLabel 15 "Power C"
    // -------------------------------------------------------------
    linkTuyaMCUOutputToChannel 113 RAW_VCPPfF 7
    setChannelType 7 Voltage_div10
    setChannelLabel 7 "Voltage L1"
    setChannelType 8 Current_div1000
    setChannelLabel 8 "Current L1"
    setChannelType 9 Power_div10
    setChannelLabel 9 "Power L1"
    setChannelType 10 PowerFactor_div1000
    setChannelLabel 10 "PowerFactor L1"
    setChannelType 11 Frequency_div1000
    setChannelLabel 11 "Frequency L1"
    
    linkTuyaMCUOutputToChannel 114 RAW_VCPPfF 12
    setChannelType 12 Voltage_div10
    setChannelLabel 12 "Voltage L2"
    setChannelType 13 Current_div1000
    setChannelLabel 13 "Current L2"
    setChannelType 14 Power_div10
    setChannelLabel 14 "Power L2"
    setChannelType 15 PowerFactor_div1000
    setChannelLabel 15 "PowerFactor L2"
    setChannelType 16 Frequency_div1000
    setChannelLabel 16 "Frequency L2"
    
    linkTuyaMCUOutputToChannel 115 RAW_VCPPfF 17
    setChannelType 17 Voltage_div10
    setChannelLabel 17 "Voltage L3"
    setChannelType 18 Current_div1000
    setChannelLabel 18 "Current L3"
    setChannelType 19 Power_div10
    setChannelLabel 19 "Power L3"
    setChannelType 20 PowerFactor_div1000
    setChannelLabel 20 "PowerFactor L3"
    setChannelType 21 Frequency_div1000
    setChannelLabel 21 "Frequency L3"
    
    // Leakage tripping - Dpid 15 "leakage_tripping" -> channel 23
    linkTuyaMCUOutputToChannel 15 val 23
    setChannelType 23 ReadOnly
    setChannelLabel 23 "Earth Leakage value [mA]"
    
    // Dpid 17 "Dpid 17" -> channel 24
    linkTuyaMCUOutputToChannel 17 RAW 24
    setChannelType 24 ReadOnly
    setChannelLabel 24 "SETUP Alarm Temp / Leakage Current dpID17"
    
    // Device temperature - Dpid 103 "Device temperature" -> channel 25
    linkTuyaMCUOutputToChannel 103 val 25
    setChannelType 25 Temperature
    setChannelLabel 25 "Device temperature [C]"
    
    // Alarm temperature - Dpid 118 "Power Factor L1" -> channel 26
    // linkTuyaMCUOutputToChannel 118 val 26
    // setChannelType 26 PowerFactor_div1000
    // setChannelLabel 26 "Power Factor L1"
    
    // Dpid 18 "Dpid 18" -> channel 27
    linkTuyaMCUOutputToChannel 18 RAW 27
    setChannelType 27 ReadOnly
    setChannelLabel 27 "SETUP Dpid 18 SETUP_MaxP_MaxU_Min_U"
    
    //Delay to switch off by Under/Over Voltage - Dpid 123 "Delay to switch off by Under/Over Voltage" -> channel 31
    linkTuyaMCUOutputToChannel 123 val 31
    setChannelType 31 TextField
    setChannelLabel 31 "SETUP Delay to switch off by Under/Over Voltage"
    
    // Bad Voltage recovery time - Dpid 120 "Bad Voltage Recovery Time" -> channel 32
    linkTuyaMCUOutputToChannel 120 val 32
    setChannelType 32 TextField
    setChannelLabel 32 "SETUP recovery time from bad Voltage [s]"
    
    // Delay to switch off by Under/Over Current- Dpid 124 "Delay to switch off by Under/Over Current" -> channel 33
    linkTuyaMCUOutputToChannel 124 val 33
    setChannelType 33 TextField
    setChannelLabel 33 "SETUP to switch off by Under/Over Current"
    
    // Recovery time from Under/Over current - Dpid 121 "Recovery time from under/over current" -> channel 34
    linkTuyaMCUOutputToChannel 121 val 34
    setChannelType 34 TextField
    setChannelLabel 34 "SETUP recovery time from under/over current"
    
    // Dpid 131 "Dpid 131 - 0" -> channel 35
    linkTuyaMCUOutputToChannel 131 val 35
    setChannelType 35 ReadOnly
    setChannelLabel 35 "How many times OverCurrent has triggered since startup"
    
    // Dpid 127 "Dpid 127 - 0" -> channel 36
    // linkTuyaMCUOutputToChannel 127 val 36
    // setChannelType 36 ReadOnly
    // setChannelLabel 36 "Is Load on L1/A (1=yes/0=no)"
    
    // Dpid 128 "Dpid 128 - 0" -> channel 37
    // linkTuyaMCUOutputToChannel 128 val 37
    // setChannelType 37 ReadOnly
    // setChannelLabel 37 "Is Load on L2/B (1=yes/0=no)"
    
    // Dpid 129 "Dpid 129 - 0" -> channel 38
    // linkTuyaMCUOutputToChannel 129 val 38
    // setChannelType 38 ReadOnly
    // setChannelLabel 38 "Is Load on L3/C (1=yes/0=no)"
    
    // Dpid 136 "Dpid 136 - 1" -> channel 39 - for tests only
    // linkTuyaMCUOutputToChannel 136 val 39
    // setChannelType 39 TextField
    // setChannelLabel 39 "SETUP Voltage multiplier RW Dpid 136=1"
    
    // Dpid 137 "Dpid 137 - 1" -> channel 40 - for tests only
    // linkTuyaMCUOutputToChannel 137 val 40
    // setChannelType 40 TextField
    // setChannelLabel 40 "SETUP Current multiplier RW Dpid 137=1"
    
    // ______________________________________________ACCEPTED_________TILL_____THIS___LINE
    //  Dpid 12 "Dpid 12 - 1" -> channel 43
    // linkTuyaMCUOutputToChannel 12 val 43
    // setChannelType 43 ReadOnly
    // setChannelLabel 43 "RO Dpid 12=1"
    
    // Dpid 13 "Dpid 13 - 1" -> channel 44
    // linkTuyaMCUOutputToChannel 13 val 44
    // setChannelType 44 ReadOnly
    // setChannelLabel 44 "RO Dpid 13=1"
    
    // Dpid 102 "Dpid 102 - 30" -> channel 45 -  recovery time from Imbalance 3Phase V/C?
    // linkTuyaMCUOutputToChannel 102 val 45
    // setChannelType 45 TextField
    // setChannelLabel 45 "RW Dpid 102=30"
    
    // Dpid 104 "Dpid 104 - 1" -> channel 46
    // linkTuyaMCUOutputToChannel 104 val 46
    // setChannelType 46 ReadOnly
    //  setChannelLabel 46 "RO Dpid 104=1"
    
    // Dpid 112 "Dpid 112 - 0" -> channel 47
    // linkTuyaMCUOutputToChannel 112 val 47
    // setChannelType 47 ReadOnly
    // setChannelLabel 47 "RO Dpid 112=0"
    
    // Dpid 122 "Dpid 122 - 20" -> channel 48  - Imbalance 3Phase V/C in %?
    // linkTuyaMCUOutputToChannel 122 val 48
    // setChannelType 48 TextField
    // setChannelLabel 48 "RW Dpid 122=20"
    
    // "Dpid 125-20" -> channel 49 - Imbalance 3Phase V/C in %?
    // linkTuyaMCUOutputToChannel 125 val 49
    // setChannelType 49 TextField
    // setChannelLabel 49 "RW Dpid 125=20"
    
    // Dpid 132 "Dpid 132 - 0" -> channel 50
    // linkTuyaMCUOutputToChannel 132 val 50
    // setChannelType 50 ReadOnly
    // setChannelLabel 50 "RO Dpid 132=0"
    
    // Dpid 133 "Dpid 133 - 0" -> channel 51
    // linkTuyaMCUOutputToChannel 133 val 51
    // setChannelType 51 ReadOnly
    // setChannelLabel 51 "RO Dpid 133=0"
    
    // Dpid 134 "Dpid 134 - 2" -> channel 52
    // linkTuyaMCUOutputToChannel 134 val 52
    // setChannelType 52 ReadOnly
    // setChannelLabel 52 "RO Dpid 134=2"
    
    // Dpid 135 "Dpid 135 - 0" -> channel 53
    // linkTuyaMCUOutputToChannel 135 val 53
    // setChannelType 53 TextField
    // setChannelLabel 53 "RW Dpid 135=0"
    
    // Dpid 105 "Dpid 105" -> channel 54
    // linkTuyaMCUOutputToChannel 105 val 54
    // setChannelType 54 ReadOnly
    // setChannelLabel 54 "Dpid 105"
    
    // Dpid 106 "Dpid 106" -> channel 55
    // linkTuyaMCUOutputToChannel 106 val 55
    // setChannelType 55 ReadOnly
    // setChannelLabel 55 "Dpid 106 - j....EwAAAAAAAAAAAA=="
    
    // Dpid 109 "Dpid 109" -> channel 56
    // linkTuyaMCUOutputToChannel 109 val 56
    // setChannelType 56 ReadOnly
    // setChannelLabel 56 "Dpid 106 - AAA8"
    
    // Dpid 109 "Dpid 117" -> channel 57
    linkTuyaMCUOutputToChannel 117 RAW 57
    setChannelType 57 ReadOnly
    setChannelLabel 57 "Dpid 117"
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    //tuyaMcu_sendQueryState
    
    .
  • #13 21414494
    p.kaczmarek2
    Moderator Smart Home
    You don't have to write to a file, you have a flag for that:
    Screenshot showing flag settings in the control interface for TOMPD-63-WIFI. .
    Once you attach it, the data received from now on is remembered and you can view it like this:
    
    http://192.168.0.170/cm?cmnd=dps
    


    Flags and raw values can either only be programmed in C at the moment, or via the REST API, as here:
    Alternative HTML control page for TOMPD-63-WIFI .

    but if you want I can think of another solution, and this bitmap faults to be read-only?
    Helpful post? Buy me a coffee.
  • #14 21414555
    halinka1125
    Level 22  
    Thanks for the information
    I've decoded the alarm control, dpID17 and dpID18 are used for this
    there is one byte of alarm No., one byte of -whether active and a two-byte value of a given variable - you can see what it is about in the picture
    Display of TuyaMCU error codes with information on alarms and states. .
    However, the error values that came to my mind are as follows
    3F imbalance is missing for current and voltage - if I figure out how to do it, I'll add it (the meter somehow checks during startup whether it has 1 phase or 3 on the inputs). As far as I can see there are 2 more inactive alarms (apart from the 3F phase ones) but I have no idea what they do. I've tried with the frequency and the only thing I've detected is that the programmer has excluded frequencies above 65Hz in the Tuya protocol and is counting the Hz from scratch (it's showing fine on the meter LCD).
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 04 00 23 - overvoltage
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 08 00 27 - undervoltage
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 01 00 20 - overcurrent
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 08 25 - electrity leak
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 10 2D - over heat
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 00 1D - Normal state
    
    .
    As far as I can see I can't write anything else to the map so it's read-only (forcing the state isn't possible either).
    I will have to create alarm settings in html somehow - but I am not a programmer:P .
    Thanks for the tip about saving the data. I will test it.
  • #15 21414678
    p.kaczmarek2
    Moderator Smart Home
    While these alarms are fairly standard I can prepare an additional command for this. Are they compatible with this theme?
    https://www.elektroda.pl/rtvforum/topic4101799.html
    Search there for "dpID 17"....
    There it was:
    
    55 AA	00	06		00 14	120000100101003F03000118040000A00801000A	4F	
    HEADER	VER=00	SetDP		LEN	dpId=18 Raw V=01 01 00 3F 03 00 01 18 04 00 00 A0 08 01 00 0A		CHK	
    
    .
    So you are saying that it is:
    - alarm id (byte)
    - alarm status (byte) 1 or 0
    - threshold value (2 bytes)
    and so N times?
    i.e. here:
    01 01 00 3F - id 01, state 01, value 003F
    03 00 01 18 - id 03, status 00, value 0118
    04 00 00 A0 - id 04, status 00, value 00A0
    08 01 00 0A - id 08, status 01, value 000A

    If this format is repeated, I would be able to add some command that automatically creates a gui for these alarms....
    Helpful post? Buy me a coffee.
  • #16 21415062
    halinka1125
    Level 22  
    >>21414678 .
    Yes the alarm SETTING format is repeated, except that in it dpID18 is shorter by one alarm and dpID17 is longer by one alarm.
    In its case dpID18 coincides inclusive with the alarm setting ID 01 - maximum current, 02 - maximum voltage,
    04 - minimum voltage, 08 - I don't know what it means.
    In dpID 17 the position is changed but the alarm id's also roughly coincide, 05- temperature alarm, 04- LE alarm,
    Also the alarm setting format is the same, the length is different. Perhaps the difference is because of the prepaid option - which they don't boast about on my device.
    It also looks very similar on the eampdw63

    As for the errors on the other hand, I don't see much of that with him, normal operation as in mine, one additional error caught
    
    55 AA 03 07 00 06 09 05 00 >02< 80 00 9F- prepaid off balance
    
    Z tego co widzę dpID9 błąd podaje nr. zestawu ustawień alarmu z którego błąd pochodzi.
    
    Chociaż trochę ich brakuje->
    fault	Bitmap	{
      "label": [
        "short_circuit_alarm",
        "surge_alarm",
        "overload_alarm",
        "leakagecurr_alarm",
        "temp_dif_fault",
        "fire_alarm",
        "high_power_alarm",
        "self_test_alarm",
        "ov_cr",
        "unbalance_alarm",
        "ov_vol",
        "undervoltage_alarm",
        "miss_phase_alarm",
        "outage_alarm",
        "magnetism_alarm",
        "credit_alarm",
        "no_balance_alarm"
      ]
    

    PS. Although my counter/transmitter does not have an RS485 port out, it has settings in the menu itself for their configuration.
    PS2. there is some error in the tuyaMcu_sendCmd command send (probably CHK):
    
    tuyaMcu_sendCmd 0x06 140101026203010109040100A00201001405000000 - nie wysyła poprawnie (nie zapisuje) mimo pojawienia się ok. że komenda poszła
    Po przeliczeniu działa i zapisuje ustawienia (jest zwrotka z MCU)														uartSendHex 55AA00060018120000140101026203010109040100A0020100140500000078
    
    .
    PS3.
    Frequency given on L2 and L3 phases - this is a copy from L1:/.
    Additional 2 alarms.
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 02 00 21 - |-UbL - natężenie prądu 3F niezbalansowane
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 10 00 2F - brak 1 fazy
    
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 04 00 23 - overvoltage
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 08 00 27 - undervoltage
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 02 01 00 20 - overcurrent
    Info:TuyaMCU:Received: 55 AA 03 07 00 06 09 05 00 >02< 80 00 9F- prepaid off balance
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 08 25 - electrity leak
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 10 2D - over heat
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 09 05 00 01 00 1D - Normal state
    		55 AA 03 07 00 08 09 05 00 04 00 02 00 00 25 - Sequence 3Phase (Rotation)
    		55 AA 03 07 00 08 09 05 00 04 00 08 00 00 2B - UnderCurrent 00080000
    		55 AA 03 07 00 08 09 05 00 04 00 04 00 00 27 - Imblalance 3Phase Voltage
    
    .
    with dpID18 alarm 02 is responsible for current imbalance ( and the value is in % given by default 20 0-100), alarm 05 - is responsible for phase imbalance it has no value only activity can be set, entered values are ignored).
  • #17 21458506
    halinka1125
    Level 22  
    Hello
    A working dump of the firmware, and an html file to configure settings, display errors and preview, for operation requires the "SetFlag 46 1" flag in autoexec , and entering the IP of your own device in the file.
    The file should be optimised by someone who knows how to program, it is certainly possible to reduce its size (I started with the TOMPD-63 WIFI file, but then changed the construction strategy to a more "lazy" one, in the original single id is hidden which is very labour intensive and easy to make an error. I found it easier to hide whole tables. Water features such as checking the status of checkboxes and forcing prepaid options to show when needed are also added. I've also added checks for problematic dpIDs - the original script I used didn't have them - I pay attention to this because without the checks the file doesn't communicate that something doesn't work - you can see it in the Firefox F12 browser console, if errors appear there the file won't work properly!
    The file is of course suitable for 3-phase meters,EAEMP3C-10...rev109C.7z Download (9.82 kB) OpenBK7231...IO_Earu.7z Download (990.64 kB)Points: 0.77 for user .
  • #18 21541915
    michal23dark
    Level 2  
    Hello,
    I am new here. After reading the thread, I purchased an EARU EAEMP3C-100-TY-W unit, which after disassembly looks exactly the same as halinka1125. As I'm not a fan of the TUYA project, after getting into CB3S I did a flash on openbeken 1.18.99. While there were no problems with the firmware change after executing the commands:
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 9600
    startDriver NTP
    tuyaMcu_defWiFiState 4
    .
    gets over and over again:
    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
    .
    It is as if there is no connectivity with the TuyaMCU. The device with and without the network module works fine - the display shows the correct values, the buttons work.
    Uploading the halinka1125 firmware dump results in no AP mode and I don't really know how to access the device. On the other hand, I tried to upload the original firmware from the backup and unfortunately I have a problem with that:
    Writing sector 0x1D1000... ok! failed with serial.BytesToRead 0 (expected 15)
    The beginning of buffer in UART contains  data.
    Writing sector 0x1D2000... Writing sector 1908736 failed!
    Writing file data to chip failed.
    
    .
    I tried soldering in the chip itself - same thing. The only thing I've noticed is that the size of the backup is larger than the openbk firmware by about 800-900kB - maybe I'm doing something wrong too.
    Please help with this Michael.
  • #19 21541922
    p.kaczmarek2
    Moderator Smart Home
    Maybe a bad baud setting? A popular one is 115200, in which case heartbeats may appear. Also try downloading the configuration:
    https://www.youtube.com/watch?v=WunlqIMAdgw&ab_channel=Elektrodacom

    Maybe this device needs to communicate WiFi status with a pin? Well, but then something would have already been sent by TuyaMCU before:
    How to make the TuyaMCU device send more data? Why are the dpIDs not being sent? .

    Have you read the entire TuyaMCU guide?
    TuyaMCU flashing, installation and configuration guide - configure dpID for Home Assistant

    What are you uploading with? Maybe the upload baud is too high? Did you know that firmware ripping/uploading has to be done with TuyaMCU disconnected? If Easy Flasher doesn't work, you can also use hid_download_py like in this video: https://www.youtube.com/watch?v=PKkiqDNFIx8

    Added after 1 [minutes]:

    PS: The backup will always be the full 2MB, because it contains all the flash, and the new firmware only uploads as much as the firmware takes. Uploading new firmware from Github does not overwrite those sections of memory that are further away.
    Helpful post? Buy me a coffee.
  • #20 21541939
    halinka1125
    Level 22  
    Compare your backup with my dump, The one I pasted is truncated to the firmware so that you can go back to the original without opening the device. It is from version v.1.09 (displayed when the device starts up). Send me your dump I can upload to my device and see if it runs on it. And have a look at an older version of Openbeken - I tested the ones from 30 onwards at the end, maybe there is something to it here....
  • #21 21541976
    michal23dark
    Level 2  
    >>21541922 .
    Thanks for responding so quickly :) Hits sunk in with that transmission speed! I wasn't expecting it, as from what I've read it's rather suggested to lower the speed.

    In terms of flashing I'm using the BK7231 EU Flasher and the TuyaMCU was 100% disconnected. Will try hid_download_py if actually needed.
  • #22 21542027
    p.kaczmarek2
    Moderator Smart Home
    It is now up to you to check that heartbeats are being received at baud setting 115200 for TuyaMCU. To be sure, do a full reboot and even a power off/on after changing the configuration.
    Helpful post? Buy me a coffee.
  • #23 21542135
    michal23dark
    Level 2  
    >>21542027 .
    Heartbeats are received both after reboot and on and off. I copied the autoexec.bat from halinka1125 and everything started as described.

    Added after 9 [minutes]: .

    >>21541939 .
    After changing the baud rate as suggested by p.kaczmarek2, everything started. I used your autoexec and it seems to be OK.
    As far as I can see my dump is from version 1.12, check with you.
  • #24 21543533
    halinka1125
    Level 22  
    Hi
    Version 1.12 is the software version in the MCU not in the BK7231N - apparently they changed the baud rate there, although as long as you uploaded the original dump, the firmware in the BK doesn't seem to have changed, the visible differences are only in the configuration.
    Nice that someone found the autoexec configuration useful.
    Greetings
📢 Listen (AI):

Topic summary

The discussion centers on the disassembly and firmware customization of the EARU EAEMP3C-100-TY-W energy meter, which uses the RENERGY RN8302B measuring system and a CMS32L051 ARM Cortex-M0+ MCU. The device features modular components connected via golpins and an LCD with color backlighting. Configuration is primarily through the TUYA app, with many settings accessible only via the app. Users explored communication with the TuyaMCU module over UART, addressing issues with dpID data transmission and parsing, including power factor, frequency, and alarm/status dpIDs. Firmware modifications involved using OpenBK7231T firmware, adjusting baud rates (notably 9600 and 115200), and implementing scripts to query TuyaMCU states and handle WiFi resets. The community shared autoexec scripts to improve data parsing and device control, including handling of alarms via dpID 17 and 18, and discussed the format of alarm data (alarm ID, status, threshold). Firmware dumps from different versions (1.09, 1.12) were compared, with emphasis on correct baud rate settings and flashing procedures (e.g., disconnecting TuyaMCU during flashing). Additional tools like hid_download_py and BK7231 EU Flasher were mentioned. A custom HTML interface was developed for configuration and error display, requiring specific flags set in autoexec. The discussion also covered challenges in extracting full energy values and handling device-specific features like prepaid options and phase detection. Overall, the thread provides detailed technical insights into reverse engineering, firmware customization, and advanced configuration of the EARU EAEMP3C-100-TY-W energy meter with TuyaMCU integration.
Summary generated by the language model.
ADVERTISEMENT