Or maybe increase the log buffer size?
Here is PR with this buffer increased from 1024 to 8192:
https://github.com/openshwprojects/OpenBK7231T_App/pull/1059
You can download the binary from it once it compiles.
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamp.kaczmarek2 wrote:Do you have a Github account, do you know how to do PR? Maybe it would be easiest if you could comment/delete fragments of the log yourself? You don`t even need to download anything, everything is compiled online.
Quote:Info:TuyaMCU:Received: 55 AA 03 07 00 08 01 02 00 04 00 00 00 06 1E
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCUarseState: id 1 type 2-val len 4
Info:TuyaMCUarseState: int32 6
Info:TuyaMCU:Received: 55 AA 03 07 00 08 7D 02 00 04 00 00 00 06 9A
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCUarseState: id 125 type 2-val len 4
Info:TuyaMCUarseState: int32 6
Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 09 0C 00 00 00 00 00 00 38
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 19
Info:TuyaMCUarseState: id 6 type 0-raw len 8
Info:TuyaMCU:Received: 55 AA 03 07 00 05 0B 01 00 01 00 1B
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCUarseState: id 11 type 1-bool len 1
Info:TuyaMCUarseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 08 0D 02 00 04 00 00 00 00 24
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCUarseState: id 13 type 2-val len 4
Info:TuyaMCUarseState: int32 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 10 01 00 01 00 20
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCUarseState: id 16 type 1-bool len 1
Info:TuyaMCUarseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 65 04 00 01 00 78
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCUarseState: id 101 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 02 7B
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 102 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 2
Info:TuyaMCU:Received: 55 AA 03 07 00 05 67 04 00 01 01 7B
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 103 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 1
Info:TuyaMCU:Received: 55 AA 03 07 00 05 68 04 00 01 02 7D
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 104 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 2
Info:TuyaMCU:Received: 55 AA 03 07 00 05 69 04 00 01 00 7C
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 105 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 6B 04 00 01 02 80
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 107 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 2
Info:TuyaMCU:Received: 55 AA 03 07 00 05 6D 04 00 01 00 80
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 109 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 6E 04 00 01 00 81
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 110 type 4-enum len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 70 01 00 01 00 80
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 112 type 1-bool len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 08 72 02 00 04 00 00 00 1E A7
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 114 type 2-val len 4
Info:TuyaMCU:P arseState: int32 30
Info:TuyaMCU:Received: 55 AA 03 07 00 08 73 02 00 04 00 00 00 F5 7F
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 115 type 2-val len 4
Info:TuyaMCU:P arseState: int32 245
Info:TuyaMCU:Received: 55 AA 03 07 00 08 74 02 00 04 00 00 00 DB 66
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 116 type 2-val len 4
Info:TuyaMCU:P arseState: int32 219
Info:TuyaMCU:Received: 55 AA 03 07 00 08 76 02 00 04 00 00 02 26 B5
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 118 type 2-val len 4
Info:TuyaMCU:P arseState: int32 550
Info:TuyaMCU:Received: 55 AA 03 07 00 08 77 02 00 04 00 00 08 4B E1
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 119 type 2-val len 4
Info:TuyaMCU:P arseState: int32 2123
Info:TuyaMCU:Received: 55 AA 03 07 00 08 78 02 00 04 00 00 00 0A 99
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 120 type 2-val len 4
Info:TuyaMCU:P arseState: int32 10
Info:TuyaMCU:Received: 55 AA 03 07 00 08 83 02 00 04 00 00 01 54 EF
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 131 type 2-val len 4
Info:TuyaMCU:P arseState: int32 340
Info:TuyaMCU:Received: 55 AA 03 07 00 08 89 02 00 04 00 00 02 58 FA
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 137 type 2-val len 4
Info:TuyaMCU:P arseState: int32 600
Info:TuyaMCU:Received: 55 AA 03 07 00 05 6F 01 00 01 00 7F
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 111 type 1-bool len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 05 8D 01 00 01 00 9D
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCU:P arseState: id 141 type 1-bool len 1
Info:TuyaMCU:P arseState: byte 0
Info:TuyaMCU:Received: 55 AA 03 07 00 08 8C 02 00 04 00 00 00 05 A8
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 15
Info:TuyaMCU:P arseState: id 140 type 2-val len 4
Info:TuyaMCU:P arseState: int32 5
Info:TuyaMCU:Received: 55 AA 03 07 00 05 8E 04 00 01 02 A3
Info:TuyaMCU:P rocessIncoming[v=3]: cmd 7 (State) len 12
Info:TuyaMCUarseState: id 142 type 4-enum len 1
Info:TuyaMCUarseState: byte 2
Info:TuyaMCU:Received: 55 AA 03 07 00 04 8A 03 00 00 9A
Info:TuyaMCUrocessIncoming[v=3]: cmd 7 (State) len 11
Info:TuyaMCUarseState: id 138 type 3-str len 0
Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
Info:TuyaMCUrocessIncoming[v=3]: cmd 0 (Hearbeat) len 8
Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 09 0C 00 00 00 00 00 00 38
Info:TuyaMCU:ParseState: id 6 type 0-raw len 8
p.kaczmarek2 wrote:Have you checked that?
Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 09 0C 00 00 00 00 00 00 38 Info:TuyaMCU:ParseState: id 6 type 0-raw len 8
Package: 55 AA 03 07 00 0C 06 00 00 08 09 0C 00 00 00 00 00 00 38
Let`s remove the checksum and header: 09 0C 00 00 00 00 00 00
Quote:09 09 00 00 44 00 00 0D 86 - load 13/14W
09 07 00 00 11 00 00 04 48 - load 4W
Quote:
Package: 55 AA 03 07 00 0C 06 00 00 08 09 0C 00 00 00 00 00 00 38
Let`s remove the checksum and header: 09 0C 00 00 00 00 00 00
Quote:
Can I somehow filter out only id = 6
Quote:
Can I somehow convert values on the fly in OpenBeken according to the formula I presented?
p.kaczmarek2 wrote:I guess that`s it. Even the dpID from the comment is correct - dpID 6. Add to autoexec.bat:
Set the type channels ChType_Voltage_div10 ChType_Current_div1000 ChType_Power and OBK itself will parse it in the current firmware version.
linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP
Quote:startDriver TuyaMCU
tuyaMcu_setBaudRate 115200
tuyaMcu_defWiFiState 4
setChannelType 1 toggle
setChannelType 2 TextField
setChannelType 3 TextField
setChannelType 4 TextField
setChannelType 5 TextField
setChannelType 6 TextField
setChannelType 7 temperature_div10
setChannelType 8 Current_div1000
setChannelType 9 Voltage_div10
setChannelType 10 Power
setChannelLabel 2 "OverCurrentProtection (A)"
setChannelLabel 3 "OverVoltageProtection (V)"
setChannelLabel 4 "UnderVoltageProtection (V)"
setChannelLabel 5 "OverTempProtection (C)"
setChannelLabel 6 "OverPowerProtection (W)"
setChannelLabel 7 "ProcessorTemperature (C)"
setChannelLabel 8 "Current (A)"
setChannelLabel 9 "Voltage (V)"
setChannelLabel 10 "Power (W)"
linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP
linkTuyaMCUOutputToChannel 16 bool 1
linkTuyaMCUOutputToChannel 114 2 2
linkTuyaMCUOutputToChannel 115 2 3
linkTuyaMCUOutputToChannel 116 2 4
linkTuyaMCUOutputToChannel 118 2 5
linkTuyaMCUOutputToChannel 119 2 6
linkTuyaMCUOutputToChannel 131 2 7
tuyaMcu_sendQueryState
Selfdrivers wrote:
As for the LOG buffer, I think I would leave it enlarged because in the future there will certainly be other devices that will have such a large number of dpIDs and this LOG size ensures that all available dpIDs will be displayed. Everything in the control panel currently looks like this
BK7231T (WB3S, WB2S, WB2L, etc)
BK7231N (CB2S, CB2L, WB2L_M1, etc)
T34 (T34 is based on BK7231N)
BL2028N (BL2028N is a Belon version of BK7231N)
XR809 (XR3, etc)
BL602 (SM-028_V1.3 etc)
LF686 (flash it as BL602)
W800 (W800-C400, WinnerMicro WiFi & Bluetooth), W801
W600 (WinnerMicro chip), W601 (WIS600, ESP-01W, TW-02, TW-03, etc)
LN882H WIP platform, see sample device teardown and flashing
Selfdrivers wrote:
If anyone sees channels that may be responsible for the above-mentioned functionalities, feel free to write to me, it will make my task easier.
Selfdrivers wrote:
Now there is another problem, the values are not updated continuously only when the relay is switched. This is strange because previously it updated itself every few seconds.
// every 10 seconds, request update from TuyaMCU
addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
p.kaczmarek2 wrote:And the logger is the main module, so I would have to test on all these platforms whether it still works after the changes, because I don`t want to, as they say, "brick" dozens of devices for users.
p.kaczmarek2 wrote:At most, I could increase the size of the log on Beken, but then I would have to test how much to increase it, because in this PR I increased the buffer quite generously as a test.
Maybe when you finish the autoexec.bat of this device, you could spare a moment (at least by PM) and I will send you a build with, for example, a buffer only twice as large and check if it is enough?
p.kaczmarek2 wrote:You can request regular updates:
Quote:
startDriver TuyaMCU
tuyaMcu_setBaudRate 115200
tuyaMcu_defWiFiState 4
setChannelType 1 toggle
setChannelType 2 TextField
setChannelType 3 TextField
setChannelType 4 TextField
setChannelType 5 TextField
setChannelType 6 TextField
setChannelType 7 temperature_div10
setChannelType 8 Current_div1000
setChannelType 9 Voltage_div10
setChannelType 10 Power
setChannelLabel 1 "MainRelay"
setChannelLabel 2 "OverCurrentProtection (A)"
setChannelLabel 3 "OverVoltageProtection (V)"
setChannelLabel 4 "UnderVoltageProtection (V)"
setChannelLabel 5 "OverTempProtection (C)"
setChannelLabel 6 "OverPowerProtection (W)"
setChannelLabel 7 "ProcessorTemperature (C)"
setChannelLabel 8 "Current (A)"
setChannelLabel 9 "Voltage (V)"
setChannelLabel 10 "Power (W)"
linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP
linkTuyaMCUOutputToChannel 16 bool 1
linkTuyaMCUOutputToChannel 114 2 2
linkTuyaMCUOutputToChannel 115 2 3
linkTuyaMCUOutputToChannel 116 2 4
linkTuyaMCUOutputToChannel 118 2 5
linkTuyaMCUOutputToChannel 119 2 6
linkTuyaMCUOutputToChannel 131 2 7
addRepeatingEvent 2 -1 tuyaMcu_sendQueryState
Selfdrivers wrote:
Sure, I`m in favor, finally an open source project to which I`ll start contributing, I deal with web applications on a daily basis (so I can understand OpenBeken interfaces if there`s anything)
Selfdrivers wrote:
I also thought about it and checked it, and yes it works, the current autoexec.bat:
Selfdrivers wrote:
Personally, what I would add is to the command tuyaMcu_sendQueryState gave the opportunity to provide parameters (e.g. to update id = 6 and not everything possible), of course I don`t know if this is possible when it comes to hardware and software (communication interface), but if there was such an option, it would certainly enable more efficient updating data.
p.kaczmarek2 wrote:Every 2 seconds is quite often, in case of problems, enable TuyaMCU queue in the flags, it improves stability and will probably be enabled by default soon.
p.kaczmarek2 wrote:It`s very nice of you, create a separate topic and I`ll give you suggestions on what could be improved on the website.
p.kaczmarek2 wrote:but documentation is documentation, if you want, you can send the command 0x08 with one payload byte being dpID and see what happens.
Selfdrivers wrote:
Where can I find a list of flags? Because I understand that flags are set using SetFlag .
Selfdrivers wrote:
Also in the IoT part of the forum, right?
Selfdrivers wrote:
is this also using uartSendHex?
Selfdrivers wrote:
Is there maybe a channel type textField_div10? I need it for textField because there is an option to set OverTempProtection, but currently you have to enter values in hundreds (750 for 75C). I must admit, it`s not very comfortable.
Selfdrivers wrote:In order to upload the OpenBeken software, I had to unsolder the white board from the blue board, which actually only connects the E469716 board with the rest of the MCB. Everything after desoldering looks like this:
Selfdrivers wrote:https://a.aliexpress.com/_EyCIK5X I bought this auction on Aliexpress.
Selfdrivers wrote:I managed to determine that the relay has dpID 16, (but e.g. dpID 11 turns off the relay without the possibility of turning it on again, it looks a bit like it is a "safety" signal)
Selfdrivers wrote:One more thing, I read that there are custom manufacturer`s devices above dpID 100, everything below 100 is designed by Tuya, but unfortunately they like to change dpID values very often (I looked in Tasmota`s default list and no dpID from their list works).
p.kaczmarek2 wrote:2. You can try to get dpIDs from Tuya: Extracting DpIDs for TUYA MCU devices
Extracting DpIDs for TUYA MCU devices
p.kaczmarek2 wrote:Example of a user-generated dashboard: https://www.elektroda.com/rtvforum/topic4022907-60.html#20933658
morgan_flint wrote:Hi! I see that this device has a few features in common with the two I have: https://www.elektroda.com/rtvforum/topic3995777.html https://www.elektroda.com/rtvforum/topic4022907.html Here are some comments if will prove useful:Selfdrivers wrote:There is probably no need to desolder the module; it looks like the needed signals (TX1, RX1, Vcc and GND) are not interfered with by the Tuya MCU, thanks to the blue board being detachable from the rest. You may not need to solder anything because you can connect the necessary cables to the connector. TX1 and RX1 are connected to the header with resistors, but this should not be a problem.To upload the OpenBeken software, I had to unsolder the white board from the blue one, which actually only connects the E469716 board to the rest of the MCB. Everything after desoldering looks like this:Selfdrivers wrote:I see in this ad that the display shows the date and time, so you will probably need to add the NTP driver to your autoexec: Code: javascript Expand Select all Copy to clipboardstartDriver NTPhttps://a.aliexpress.com/_EyCIK5X I bought this listing on Aliexpress.
ntp_setServer 150.214.94.5 //or whatever you like
ntp_timeZoneOfs 1 //adapt to your zone By the way, this device seems a bit more expensive (42€!) compared to similar ones.Selfdrivers wrote:In my devices, DpID16 is also used for the relay, and DpID 11 is used to reset the prepaid energy, which is a counter that allows you to set a certain amount of kWh which, when used, turns off the relay until more "prepaid energy" appears loaded or the prepaid function is disabled (via two additional DpIDs). So this is probably the reason that it turns off the relay without being able to turn it on again.I managed to determine that the relay has dpID 16 (but e.g. dpID 11 turns off the relay without the possibility of turning it on again, it looks a bit like a "safety" signal)Selfdrivers wrote:This seems to confirm the similarities between the DpIDs mentioned, as well as DpID 6, commented on in other posts.One more thing, I read that there are custom devices from manufacturers above dpID 100, everything below 100 is designed by Tuya, but unfortunately they like to change dpID values very often (I looked at Tasmota`s default list and there is no dpID from their list that works).p.kaczmarek2 wrote:If you have a backup of your original firmware, you can try this method (tutorial written by me, BTW). It`s a bit tedious because you have to create an account on the Tuya developer site, but it`s worth it because you can get a lot of information about DpIDclass="notranslate">2. You can try to get dpID from Tuya: Extracting DpIDs for TUYA MCU Devices Extracting DpIDs for TUYA MCU Devicesp.kaczmarek2 wrote:Example of a user-created dashboard: https://www.elektroda.com/rtvforum/topic4022907-60.html#20933658
Finally, if you browse this thread, you can see the great work done by @p.kaczmarek2 and @Angel0fDeath in decoding and setting DpIDs related to alarms (DpID 9) and some security thresholds (17 and 18) which may be the same in this device (m. incl. dashboard cited earlier)... Have you seen these DpIDs in any of your logs?
TL;DR: The TO-Q-SYS-JWT DIN-rail meter packs a 60 A / 250 V bistable relay, an HC32F460 MCU, and Wi-Fi via BK7231N; “Very interesting, fuse, current measurement and control/reading by applications in one.” [Elektroda, gulson, post #20937562] OpenBeken enables full local control, ditching Tuya cloud.
Why it matters: You get a sub-€45 smart breaker that can log kWh offline and integrate with Home Assistant.
• Relay rating: 60 A, 250 V AC [Elektroda, Selfdrivers, post #20937367] • Main MCU: HC32F460 (STM32F103-compatible) [Elektroda, Selfdrivers, post #20937367] • Wi-Fi module: BK7231N, UART 115 200 bps default [Elektroda, p.kaczmarek2, post #20938300] • Flash backup size: 2 MB full image advised [Elektroda, p.kaczmarek2, post #21088469] • Street price: ≈ €42 on AliExpress [Elektroda, Selfdrivers, post #20941591]