logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] Teardown and flashing of Atorch GR2P-WS: DIN rail device with graphic screen

morgan_flint 10806 83
ADVERTISEMENT
📢 Listen (AI):
  • ADVERTISEMENT
  • #64 21784898
    GoldMember
    Level 12  
    I imported JSON in webapp and nothing changed.
  • #65 21784907
    divadiow
    Level 37  
    the JSON blocks are just information about the device from which to extract details needed to make a working autoexec. The JSON is from the Tuya dev site after pairing your firmware with the Tuya app in a test device. The second block in the previous post is just an easier to read version of the code above it.

    TuyaMCU guides and examples:

    TuyaMCU flashing, setup and configuration guide - configure dpIDs for Home Assistant
    https://www.elektroda.com/rtvforum/topic4038151.html

    TuyaMCU protocol - communication between the microcontroller and the WiFi module
    https://www.elektroda.com/rtvforum/topic3880546.html

    OpenBeken and TuyaMCU dimmer - configuration guide/tutorial
    https://www.elektroda.com/rtvforum/topic3898502.html

    Extracting DpIDs for TUYA MCU devices
    https://www.elektroda.com/rtvforum/topic4021129.html

    How to get dpID list of types and values for flashed TuyaMCU devices with OpenBeken
    https://www.elektroda.com/rtvforum/topic4049908.html

    How to make TuyaMCU device send more data points? Why are dpIDs not sent? Processing by the Wi-Fi...
    https://www.elektroda.com/rtvforum/topic4089722.html

    Scripting the behaviour of TuyaMCU relay OpenBeken - custom buttons, timers, events, countdown
    https://www.elektroda.com/rtvforum/topic4009196.html

    Autoexec Examples
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
  • ADVERTISEMENT
  • #66 21784956
    yarik8117
    Level 5  
    >>21784898
    Does your chip temperature also remain at 82 degrees after reflashing? Or is it just me? I haven't been able to start reading data yet. I think the firmware from BK7238 may not be entirely suitable for our T1-2S-NL. What specific firmware did you install?
  • #67 21784969
    divadiow
    Level 37  
    is anything giving sign OpenBK7238 is talking to the TuyaMCU? what about with flag 26 enabled to swap uart?
  • ADVERTISEMENT
  • #68 21785019
    yarik8117
    Level 5  
    >>21784969 >>21784969
    I don't see any signs of interaction. No buttons or data are being transmitted. I enabled flag 26 and disabled it, but it doesn't help.
    Screenshot of system status with one active TuyaMCU driver and 32 total channels
  • #69 21785120
    GoldMember
    Level 12  
    yarik8117 wrote:
    >>21784898
    Does your chip temperature also remain at 82 degrees after reflashing? Or is it just me? I haven't been able to start reading data yet. I think the firmware from BK7238 may not be entirely suitable for our T1-2S-NL. What specific firmware did you install?


    Yes, mine is too about 82. I downloaded the newest firmware via Beken flasher.
  • #70 21785131
    insmod
    Level 30  
    Ignore it, it's different for every chip.
    Some BK7238's can even have negative temperature.
  • #71 21785208
    yarik8117
    Level 5  
    No data from TuyaMCU in the console or on the sensor. No data at all. What else can I do? I am new to this and am trying to figure it out. Apparently, the DpId is the same, exactly the same as in the first post, only the bit width of some sensors is different. But no data is coming in at all, as if TuyaMCU does not exist.
  • #72 21785332
    divadiow
    Level 37  
    How did you flash BK7238? Did you have to cut traces or desolder t1-2s-nl module? How are you powering the device now, is it all back together and on the mains?

    Any results from command tuyaMcu_sendQueryState?
  • ADVERTISEMENT
  • #73 21785444
    GoldMember
    Level 12  
    In my case I desoldered the module and flashed it with BK Flasher. Everythinhg went ok so I put it back together and connected to mains.
    Result of command:
    Error:CMD:cmd tuyaMcu_sendQueryState NOT found (args )
    Unknown command
  • #74 21785449
    yarik8117
    Level 5  
    >>21785332
    In my case, I isolated RX and TX. And flashed it with BK Flasher. After a while, I flashed it again, thinking that it had been flashed with an error. Everything was flashed without errors.
    Info:CMD:[WebApp Cmd 'tuyaMcu_sendQueryState' Result] OK

    I'll add this. After a lot of hassle trying to get it to work on OpenBeken, I decided to check if the chip was actually working. I flashed the backup and it started working again on the factory firmware. It's working fine now and passing all the values normally. I flashed the backup without isolating TX and RX. Everything flashed without any problems. How can I now make it work on OpenBeken?
  • #75 21787621
    GoldMember
    Level 12  
    It's working!

    Interface with relay button and electrical data, status ON

    Except the power meter. I tried command startDriver BL0942 in autoexec but when is on nothing works.
    Any idea why is not showing power?
  • #76 21787625
    divadiow
    Level 37  
    what does your line for power in autoexec look like?

    startdriver bl0942 is not for TuyaMCU devices. Power reading will just be another dpID like the other things.
  • #77 21787638
    yarik8117
    Level 5  
    >>21787621
    Can you show me your autoexec file?
  • #78 21787689
    GoldMember
    Level 12  
    Autoexec.bat
    
    clearIO
    
    flags 0
    
    SetFlag 46 1
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    startDriver NTP
    ntp_setServer  150.214.94.5
    ntp_timeZoneOfs 2
    
    waitFor MQTTState 1
    //tuyaMcu_defWiFiState 4
    
    
    linkTuyaMCUOutputToChannel 1 bool 1
    setChannelType 1 toggle
    setChannelLabel 1 "Relay"
    
    
    linkTuyaMCUOutputToChannel 139 bool 2
    setChannelType 2 toggle
    setChannelLabel 2 "Prepayment"
    
    linkTuyaMCUOutputToChannel 141 bool 3
    setChannelType 3 toggle
    setChannelLabel 3 "Clr Prepaid Energy"
    
    linkTuyaMCUOutputToChannel 123 val 4
    setChannelType 4 EnergyTotal_kWh_div1000
    setChannelLabel 4 "Total Energy"
    
    linkTuyaMCUOutputToChannel 18 val 7
    setChannelType 7 Current_div1000
    setChannelLabel 7 "Current"
    linkTuyaMCUOutputToChannel 10 val 6
    setChannelType 6 Power_div100
    setChannelLabel 6 "Power"
    linkTuyaMCUOutputToChannel 20 val 5
    setChannelType 5 Voltage_div100
    setChannelLabel 5 "Voltage"
    
    linkTuyaMCUOutputToChannel 124 val 8
    setChannelType 8 TextField
    setChannelLabel 8 "Leakage Current"
    
    
    linkTuyaMCUOutputToChannel 132 val 9
    setChannelType 9 Readonly
    setChannelLabel 9 "Alarms"
    
    linkTuyaMCUOutputToChannel 104 val 10
    setChannelType 10 TextField
    setChannelLabel 10 "Overvoltage limit"
    
    
    linkTuyaMCUOutputToChannel 140 val 11
    setChannelType 11 EnergyTotal_kWh_div100
    setChannelLabel 11 "Remaining Prepaid Energy"
    
    linkTuyaMCUOutputToChannel 142 val 12
    setChannelType 12 TextField
    setChannelLabel 12 "Recharge Prepaid Energy [kWh*100], i.e. 1kWh = 100"
    
    linkTuyaMCUOutputToChannel 121 val 13
    setChannelType 13 TextField
    setChannelLabel 13 "Leakage threshold"
    
    linkTuyaMCUOutputToChannel 134 val 14
    setChannelType 14 PowerFactor_div100
    setChannelLabel 14 "Power Factor"
    
    linkTuyaMCUOutputToChannel 133 val 15
    setChannelType 15 Frequency_div100
    setChannelLabel 15 "Frequency [Hz]"
    
    linkTuyaMCUOutputToChannel 105 val 16
    setChannelType 16 TextField
    setChannelLabel 16 "Overcurrent limit"
    
    linkTuyaMCUOutputToChannel 106 val 17
    setChannelType 17 TextField
    setChannelLabel 17 "Power limit"
    
    linkTuyaMCUOutputToChannel 119 val 18
    setChannelType 18 TextField
    setChannelLabel 18 "Undervoltage limit"
    
    linkTuyaMCUOutputToChannel 125 val 19
    setChannelType 19 TextField
    setChannelLabel 19 "Refresh interval"
    
    linkTuyaMCUOutputToChannel 126 bool 20
    setChannelType 20 toggle
    setChannelLabel 20 "Real Time"
    
    linkTuyaMCUOutputToChannel 120 bool 21
    setChannelType 21 Toggle
    setChannelLabel 21 "Over-limit ctrl"
    
    linkTuyaMCUOutputToChannel 113 bool 22
    setChannelType 22 Toggle
    setChannelLabel 22 "Clear acc. data"
    
    linkTuyaMCUOutputToChannel 101 val 27
    setChannelType 27 TextField
    setChannelLabel 27 "Electricity price"
    
    linkTuyaMCUOutputToChannel 102 val 28
    setChannelType 28 ReadOnly
    setChannelLabel 28 "Total electricity cost"
    
    
    linkTuyaMCUOutputToChannel 143 val 30
    setChannelType 30 TextField
    setChannelLabel 30 "Low prepaid energy alarm value"
    
    linkTuyaMCUOutputToChannel 137 val 31
    setChannelType 31 TextField
    setChannelLabel 31 "Overvolt recov. delay"
    
    // test other Dpid - Ch 0
    // linkTuyaMCUOutputToChannel 138 enum 0
    // setChannelType 0 TextField
    // setChannelLabel 0 "Test DpID 138 Pwr on status" 
    
    // NOTE: addRepeatingEvent [RepeatTime] [RepeatCount]
    // code below will forever Send query state command every 5 seconds
    // addRepeatingEvent 5 -1 tuyaMcu_sendQueryState
    // Not needed in this device, since TuyaMCU sends everything when necessary
    // we need it just first time to obtain initial status. Some dpIDs not reported without asking
    tuyaMcu_sendQueryState
  • #79 21787703
    yarik8117
    Level 5  
    >>21787689
    I didn't see a single line about Power at all.

    linkTuyaMCUOutputToChannel 19 val 6
    setChannelType 6 Power_div100
    setChannelLabel 6 "Power"

    My mistake was probably in "tuyaMcu_setBaudRate 115200". I set it to 9600.
  • #80 21787724
    GoldMember
    Level 12  
    Now power is also working, it has to be like that:
    linkTuyaMCUOutputToChannel 19 val 6
    setChannelType 6 Power_div100
    setChannelLabel 6 "Power"
  • #81 21788001
    yarik8117
    Level 5  
    Everything worked for me. I had to fiddle with the HTML file a bit. But in the end, it works. Thank you all.
    ATORCH energy meter UI screen showing current values and adjustable settings
  • #82 21795755
    KaosuNeko
    Level 2  
    yarik8117 wrote:
    Everything worked for me. I had to fiddle with the HTML file a bit. But in the end, it works. Thank you all.
    ATORCH energy meter UI screen showing current values and adjustable settings


    Hello! I have the same device on T1-2S-NL. Can you attach your html? Thanks!
  • #83 21796023
    yarik8117
    Level 5  
    >>21795755
    script.js.gz and style.css.gz, just upload them as an archive. I couldn't upload them any other way, there wasn't enough space. I would like to add that this is for the T1-2S-NL processor. I am not sure how it will work with others.
  • #84 21796936
    KaosuNeko
    Level 2  
    >>21796023
    yarik8117 wrote:
    upload them as an archive. I couldn't upload them any other way, there wasn't enough space. I would like to add that this is for the T1-2S-NL processor.


    Thanks! It works great!
📢 Listen (AI):

Topic summary

The discussion centers on the teardown, firmware flashing, and integration of the Atorch GR2P-WS DIN rail energy meter featuring a graphic screen and BK7231N WiFi module. Users share experiences flashing OpenBK7231N firmware to replace the original Tuya firmware, aiming to eliminate cloud dependencies and enable local control via Home Assistant. Challenges include configuring WiFi credentials, MQTT setup, and linking Tuya MCU outputs to OBK channels through customized autoexec.bat scripts. The MCU firmware (CH573F) versions (1.0.3, 1.0.4, 1.0.9) and update mechanisms are discussed, with attempts to dump and reflash MCU firmware via USB ISP and UART ISP modes proving difficult due to bootloader restrictions and hardware specifics. Newer GR2PWSL versions with external current transformers and different MCU firmware are noted, with similar device schema IDs but differing update availability in the Tuya app. Diagnostic data reporting (RSSI, IP, SSID) to Home Assistant via MQTT is enabled by adjusting OBK flags. The relay internals and driver IC datasheet are shared. Community members contribute modified autoexec.bat configurations adding SSDP, NTP, and Wemo drivers. The discussion also covers the translation of Chinese JSON strings in device models to English for better integration. Overall, the thread provides detailed technical insights into hardware teardown, firmware flashing, MCU communication, and Home Assistant integration of Atorch GR2P-WS devices using BK7231N and CH573F chips.
Summary generated by the language model.
ADVERTISEMENT