logo elektroda
logo elektroda
X
logo elektroda

TOMZN TOMPD-63-LW Wifi Multi Function (DIN) WB3S (BK7231T)

crash1912 21186 128
ADVERTISEMENT
  • #31 20831201
    p.kaczmarek2
    Moderator Smart Home
    Well, since you have a 2MB backup, maybe we can skip the UART capture process which is risky and requires isolation for USB to UART converter, and just try to flash OBK? In worst case you can always restore the backup.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20836960
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    maybe we can skip the UART capture process which is risky and requires isolation for USB to UART converter, and just try to flash OBK?

    Hello again after an "intense" long weekend... Yes, that's probably the better option and I will do it as soon as possible, but I wanted to explore all the Tuya-related capabilities before flashing OBK.

    morgan_flint wrote:
    The rest of the hardware seems to be the same (I will add photos later on)

    Here are the photos:
    Close-up of an electronic component with copper wires and capacitors on a circuit board. Close-up of an electronic module with visible heat sinks, wires, and copper components. Close-up of an electronic board with wires and capacitors. Close-up of an electronic circuit with colorful wires and capacitors. Printed circuit board with electronic components and copper wires. Two green printed circuit boards with a display and buttons. Circuit board with WiFi module and integrated chip. Close-up of the interior of an electronic device with wires and components. Image of a green circuit board with various electronic components. Two green PCBs with electronic components. Display of the TOMZN multi-function protector device with WiFi functionality.

    And some screenshots of the App:
    Screenshot of an app displaying energy consumption. Screenshot of an energy expense management app with the prepayment switch turned off. Screenshot of an app showing temperature as NaN°C in four fields. Screenshot of an app showing settings for various electrical alarms. Screenshot of app settings showing a leakage alarm with a 30 mA threshold and control toggle enabled. Screenshot of an app with over-voltage alarm settings. Screenshot from an app showing device update information.

    I've also done a little bit of "reverse engineering" of the schematic; just for the sake of doing it, as it doesn't add much to making it work with OBK, but once I clean it up a bit I'll post it here.
  • #33 20836967
    p.kaczmarek2
    Moderator Smart Home
    That's a lot of dpIDs. Have you tried to look up the full list of datapoints at Tuya developer website?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #34 20837351
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    Have you tried to look up the full list of datapoints at Tuya developer website?

    Is it the attached listing (pdf)?

    If not, Where do I have to look?

    EDIT: I also copied the contents under "Standard Instruction Set" and "Standard Status Set" of this screenshot in another attachment (zip)
    Screenshot of the Central Europe Data Center interface with the device debugging panel.
  • #35 20837417
    p.kaczmarek2
    Moderator Smart Home
    I am not sure but it doesn't look right, there are no dpId numbers there?

    Maybe try this method?
    https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html
    Instructions for finding a data point using developer tools.
    Code: Javascript
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #36 20837470
    morgan_flint
    Level 14  
    Curiously, I was looking at the device logs, where you can find a dropdown menu called "Select DP ID":
    Dropdown menu with various options for selecting DP ID. Dropdown list with DP ID selection options. Screenshot of a dropdown menu with options like Switch, Alarm set1, Alarm set2, Breaker id, Voltage, Leakage current test, Current, and Chinese characters.
    (the first Chinese text translates as "Refresh report" and the second one as "Active Power")

    Of course, I would have never imagined a procedure like the one you found!! I followed the instructions you posted and got this:
    {"1":"Total forward energy","6":"Phase A","9":"Fault","11":"Switch prepayment","12":"Clear energy","13":"Balance energy","14":"charge energy","15":"Leakage current","16":"Switch","17":"Alarm set1","18":"Alarm set2","19":"Breaker id","21":"Leakage current test","101":"Clear Energy","104":"Power Factor","105":"Grid Frequency","106":"刷新上报","116":"Voltage","117":"Current","118":"有功功率"}

    20 DP IDs, if I'm counting well

    This would be the correspondence with the list of my previous post (pdf file), with also 20 entries (two first columns), and the new info (the other two)
    DP InstructionStandard InstructionDP IDDescription
    total_forward_energytotal_forward_energy1Total forward energy
    phase_aphase_a6Phase A
    faultfault9Fault
    switch_prepaymentswitch_prepayment11Switch prepayment
    clear_energyenergy_reset12Clear energy
    balance_energybalance_energy13Balance energy
    charge_energycharge_energy14charge energy
    leakage_currentleakage_current15Leakage current
    switchswitch16Switch
    alarm_set_1alarm_set_117Alarm set1
    alarm_set_2alarm_set_218Alarm set2
    breaker_idbreaker_number19Breaker id
    leakagecurr_testleakagecurr_test21Leakage current test
    clr_all_energy-101Clear Energy
    power_factor-104Power Factor
    supply_frequencysupply_frequency105Grid Frequency
    refresh-106刷新上报 (Refresh report)
    output_voltage-116Voltage
    output_current-117Current
    output_power-118有功功率 (Active Power)

    Also, in case it's of some help, I'm attaching some of the device log contents (TOMPD-63LW_logs.pdf)
  • #37 20837702
    p.kaczmarek2
    Moderator Smart Home
    I think we may also need to know the variable types, altough in most cases it should be very easy to guess them. Ok, so we are ready to flash OBK?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #38 20837808
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    I think we may also need to know the variable types

    Maybe this can be (at least, partially) extracted from the information in the first attachment here.

    It contains information for 14 of the 20 variables (all of those that have info in the second column (Standard instruction) of the table in my previous post, and the listing is in the same order, so easy to match.

    I'm transcribing it here so it's easier to read. This first table is for "Standard Status Set":
    DP IDCodeTypeValues
    1total_forward_energyInteger{
    "unit": "kW·h",
    "min": 0,
    "max": 99999999,
    "scale": 2,
    "step": 1
    }
    6phase_aRaw{}
    9faultBitmap{
    "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"
    ]
    }
    11switch_prepaymentBoolean"{true,false}"
    12energy_resetEnum{
    "range": [
    "empty"
    ]
    }
    13balance_energyInteger{
    "unit": "kW·h",
    "min": 0,
    "max": 999999,
    "scale": 1,
    "step": 1
    }
    14charge_energyInteger{
    "unit": "kW·h",
    "min": 0,
    "max": 99999,
    "scale": 1,
    "step": 1
    }
    15leakage_currentInteger{
    "unit": "mA",
    "min": 0,
    "max": 1000,
    "scale": 0,
    "step": 1
    }
    16switchBoolean"{true,false}"
    17alarm_set_1Raw{}
    18alarm_set_2Raw{}
    19breaker_numberString{
    "maxlen": 255
    }
    21leakagecurr_testBoolean"{true,false}"
    105supply_frequencyInteger{
    "unit": "Hz",
    "min": 0,
    "max": 1000,
    "scale": 1,
    "step": 1
    }


    And the second one for "Standard Instruction Set":
    DP IDCodeTypeValues
    11switch_prepayment Boolean "{true,false}"
    12clear_energy Boolean "{true,false}"
    14charge_energy Integer {
    "unit": "kW·h",
    "min": 0,
    "max": 99999,
    "scale": 1,
    "step": 1
    }
    16switch Boolean "{true,false}"
    17alarm_set_1 Raw {}
    18alarm_set_2 Raw {}
    21leakagecurr_test Boolean "{true,false}"
  • #39 20838423
    p.kaczmarek2
    Moderator Smart Home
    This looks somewhat complete, altough I am not sure why dpID 9 is marked as bitmap and not as raw bytes data.
    Helpful post? Buy me a coffee.
  • #40 20838557
    morgan_flint
    Level 14  
    It's strange, so I checked it again:
    Screenshot of the standard status set containing various device-related alarms.

    I'm not very sure of the reliability of Tuya info; for example, there's one of the screenshots I posted from the App, acceded after clicking "Temperature" on the main screen for the device, that shows no info and makes no sense, as there aren't any temperature sensors in the hardware. I'm afraid product developers just customize some general kind of information without paying too much attention
  • #41 20839053
    p.kaczmarek2
    Moderator Smart Home
    Do you need all of these data supported, or only the basic information like voltage, etc?
    Helpful post? Buy me a coffee.
  • #42 20841322
    morgan_flint
    Level 14  
    Of course (and abusing your patience...), it would be ideal if we could support as many as possible, as the main appeal of this device is the amount of functions it performs...

    Maybe we could leave to the local keyboard the adjustment of the different protection thresholds, as these are values rarely changed but, for example, it would be interesting to know remotely which of the protections has acted.

    I'll flash OBK now to see what we can do with that, but I've just ordered the isolators to be able to capture traffic and, once they arrive, I could flash the original FW again if we need to see something there...

    BTW, I've also ordered one of the devices similar to this one but with just one relay (I found it at a very good price and couldn't resist...). I see coincidences in some of the DP IDs in that device's thread, so maybe between both devices, we will be able to decipher all of them.

    I've also compiled in the attached .pdf all the info on the previous tables, to make it easier to see all at a glance. I'm also attaching the "diagnostics" from the Tuya integration in Home Assistant, in case they can give new information. It seems to have contents relative to all the functions, although the device's page only shows a few of them:
    Control panel with a switch and unavailable sensor data.

    Thank you for all your help; I'm sorry I'm so noob on this subject :-(
  • #43 20841332
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    This looks somewhat complete, altough I am not sure why dpID 9 is marked as bitmap and not as raw bytes data.

    Regarding this, and looking at the combined table, maybe "bitmap" just means the DP reports the number of the alarm in the list:
    Table showing a list of alarms with assigned numbers and report statuses.

    If this is true, "0" in the reports would be no alarm, and "8" would be "self_test_alarm", which is the 8th in the list (I made some self-tests of the leakage current with the device by pressing the button labeled "T")
  • #44 20842617
    p.kaczmarek2
    Moderator Smart Home
    Yes, I also think we can now try flashing OBK and see how it goes.
    Helpful post? Buy me a coffee.
  • #45 20842982
    morgan_flint
    Level 14  
    morgan_flint wrote:
    If this is true, "0" in the reports would be no alarm, and "8" would be "self_test_alarm", which is the 8th in the list (I made some self-tests of the leakage current with the device by pressing the button labeled "T")

    I'm afraid I was wrong; I provoked 3 different alarms (overcurrent, leakage, and low credit, individually, not simultaneously) and got these values for this DP ID: 4,8 and 32768 (2², 2⁴ and 2¹⁵)
    So now "bitmap" makes sense: the activated alarms of the list of possible values are those that correspond with the "1" bits of the binary conversion of the decimal value of this DP ID:
    Screenshot of a list of alarms with corresponding binary values.

    I still have to figure out the meaning of the cryptic values of "Phase A", "Alarm set 1", and "Alarm set 2"
  • #46 20843011
    p.kaczmarek2
    Moderator Smart Home
    Ah, sorry, now I understand! I may have been working too much. By Bitmap, they do not mean Bitmap as in "an image", but they mean what I usually call flags, where each bit (1 or 0) is a flag describing a state. Silly me. Now everything is clear. Thanks for pointing that to me!
    Helpful post? Buy me a coffee.
  • #47 20843435
    morgan_flint
    Level 14  
    morgan_flint wrote:
    I still have to figure out the meaning of the cryptic values of "Phase A", "Alarm set 1", and "Alarm set 2"

    Following the ideas in this post (specifically, base64 to hex conversion), I think the meaning of "Phase A" is now clear:
    Data table from the device event log showing various event codes in Phase A.
    Screenshot of a Base64 to hexadecimal converter with the input text CPAAH/4AB1M.

    08 F0 hex = 2288 dec = 228.8V
    00 1F FE hex = 8190 dec = 8.190 mA = 8,190A
    00 07 53 hex = 1875 dec = 1.868 W = 1,868 kW

    These coincide with the values I noted down at that time during tests I did yesterday with a heater connected as a load.

    I imagine the values for "Alarm set 1", and "Alarm set 2" are also base 64, but I'm afraid they are going to be more difficult to decode
  • #48 20845322
    morgan_flint
    Level 14  
    Finally flashed OBK and used the autoexec.bat from this post. These are the results:
    User interface with device status information from OpenBK7231N. Screenshot of the device configuration interface in OBK software. Screenshot of editing an autoexec.bat file with TuyaMCU configuration instructions.

    I also copied all the "TUYAMCU received" strings from the attached file "TOMPD-63LW_OBK_LOG.txt" to the also attached "TUYAMCU received.txt", and analyzed them with TuyaMCUAnalyzer:
    Screenshot of TuyaMCU Analyzer interface with various data packets.

    It shows up to 10 DP IDs in the brief time covered by the log, including those of Power Factor (104), Grid Frequency (105), Leakage Current (15), and the cryptic Alarm set 1 (17).

    Also, DP ID 13 (Balance energy), that must correspond with the remaining prepaid energy in 1/10 kWh (It shows 8, I programmed this with the minimum, 1 kWh, and have expended 0.2, ):
    55 AA 03 07 00 08 0D 02 00 04 00000008 2C
    HEADER VER=03 State LEN dpId=13 Val V=8 CHK

    BTW, there's a string in the logs (55 AA 03 07 00 10 12 00 00 0C 01 01 00 13 03 01 00 FA 04 01 00 D2 21) that gives an error in TuyaMCUAnalyzer:
    Screenshot of the TuyaMCU Explorer interface with an error message. Screenshot of log analysis from TuyaMCU.

    morgan_flint wrote:
    Following the ideas in this post (specifically, base64 to hex conversion), I think the meaning of "Phase A" is now clear:

    😥 Supid of me... I see the contents of this DP were already known and are well-decoded


    EDIT: Adding a screenshot from the device's page in Home Assitant:
    Screenshot of a device panel in Home Assistant showing details and logs for a BK7231N device by Beken Corporation.

    EDIT 2: Analyzing the link posted by @fakuivan here, in the last post there's a detailed description of "Alarm set 1":
    Code: JSON
    Log in, to see the code


    Unfortunately, "abilityId" (must be the same as DP ID) 104 and 105 have different meaning there.
  • #49 20845548
    p.kaczmarek2
    Moderator Smart Home
    Good job! For a start, I can see you have numbers like "4" and "5" on your HA panel.
    Can you try to use:
    
    setChannelLabel 4 Something
    

    to get better names on UI? Try it out and let me know if it works

    See more info on our command docs page: https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Helpful post? Buy me a coffee.
  • #50 20845842
    morgan_flint
    Level 14  
    Ok, thanks!

    Some progress here:
    Screenshot of OpenBK7231N interface with Relay and Prepayment functions enabled. Device configuration webpage for TuyaMCU driver with device settings.
    // start TuyaMCU driver
    startDriver TuyaMCU
    // always force 0x04 WiFi state (paired to cloud), otherwise TuyaMCU might skip some data points
    tuyaMcu_defWiFiState 4
    startDriver NTP
    
    // let's choose that channel 1 will be main relay state
    setChannelType 1 toggle
    // label it
    setChannelLabel 1 "Relay"
    
    setChannelType 2 Voltage_div10
    
    setChannelType 3 Power
    setChannelLabel 3 "Power"
    
    setChannelType 4 Current_div1000
    setChannelLabel 4 "Current"
    
    setChannelType 5 EnergyTotal_kWh_div100
    setChannelLabel 5 "Energy"
    
    setChannelType 7 toggle
    setChannelLabel 7 "Prepayment"
    
    // MF "power factor"
    setChannelType 10 PowerFactor_div1000
    setChannelLabel 10 "Power Factor"
    
    // MF "supply frequency"
    setChannelType 11 Frequency_div100
    setChannelLabel 11 "Grid Frequency"
    
    // link id 16 "switch" to channel 1
    linkTuyaMCUOutputToChannel 16 bool 1
    
    // link id 1 "total forward energy" to channel 5
    linkTuyaMCUOutputToChannel 1 val 5
    
    // TAC2121C VoltageCurrentPower Packet
    // This will automatically set voltage, power and current
    linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP
    
    // link id 11 "switch prepayment" to channel 7
    linkTuyaMCUOutputToChannel 11 bool 7
    
    // MF link id 104 "power factor" to channel 10
    linkTuyaMCUOutputToChannel 104 val 10
    
    // MF link id 105 "supply frequency" to channel 11
    linkTuyaMCUOutputToChannel 105 val 11
    
    // NOTE: addRepeatingEvent [RepeatTime] [RepeatCount]
    // code below will forever toggle relay every 15 seconds
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState 

    (BTW: ¿Why is NTP driver needed?)

    I could add power factor (correct) and frequency (shows 5.00 Hz and channel value is 500.00, but there's only "Frequency_div100" option for this type). I'm afraid the real resolution for this variable is 1-2 decimal at most; it's very difficult that the real frequency is 50,000 Hz

    Also, the Home Assistant screenshot:
    Screenshot of the Home Assistant interface displaying information about a Beken Corporation device.

    Some of the labels seem to be different to those in autoexec.bat and RSSI says "Desconocido" (Unknown)

    I will continue trying to add more things, but I'm afraid the Alarm Set 1 and 2 are beyond my possibilities 😢

    EDIT: Deleting previous edit about leakage current; there must be some error, I'll add later

    Added after 2 [hours] 17 [minutes]:

    Regarding leakage current, ff I add to autoexec.bat the following:
    setChannelLabel 12 "Leakage Current"
    linkTuyaMCUOutputToChannel 15 val 12

    But leave as "Default" or "Custom" the channel type, I get the following:
    Screenshot of the TuyaMCU interface displaying channel values like voltage, power, and frequency, with some values marked in red.

    Channel shows the same value as on the device's screen but nothing in the listing above (I imagine this is normal behavior). Then, if I change channel type to "Current_div100" I get:
    Screenshot from Home Assistant showing various data on voltage, current, energy, and other parameters.

    Correct value for the channel again and something coherent (apart from the rounding) shows in the listing. It should be 0,060 A or 60 mA, but I choose div100, so my fault...

    BUT, if I choose change channel type to "Current_div1000" then I get:
    Screenshot showing measurement data from a device with channels for voltage, power, current, energy, and other parameters.

    An invalid value, both in the channel and in the listing, that are now cloning the values for Current on channel 4. I imagine this is because you can't use the same channel type for 2 different channels. Is this intended or is a bug?

    Thank you for your patience, again!
  • #51 20846223
    p.kaczmarek2
    Moderator Smart Home
    I will add Frequency_div10 for you, but in general, we may consider something more flexible in the future, of course, with backwards-compatibility included.

    NTP is just for current time, maybe previous config author used that.

    I think you need a leakage current channel type for leakage current.
    Helpful post? Buy me a coffee.
  • #52 20846290
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    I will add Frequency_div10 for you, but in general, we may consider something more flexible in the future, of course, with backwards-compatibility included


    Thank you! A possibility would be to separate the type and the scale (multiplier or divisor), but you'll know better what would be easier to implement

    p.kaczmarek2 wrote:
    I think you need a leakage current channel type for leakage current.

    But it doesn't exist yet, does it?

    On the other hand, if we had more than one current measurement (in a three-phase meter, for example), would it work well if you assigned the same type to more than one channel?
  • #53 20849043
    morgan_flint
    Level 14  
    Hello again!

    I did a deeper analysis of DPIDs 17 and 18. I started rewriting the JSON on EDIT2 here in a more legible way:
    Screenshot showing a JSON code snippet about alarm settings in an electrical circuit.
    Screenshot of a JSON fragment related to alarm settings.
    (I pasted it like an image because the tabulations get distorted if I publish it like code, but I'm also attaching the file, remove ".txt" after downloading)

    So, for example, for DPID 17:
    55 AA030700 08110000 040401001E49
    HEADERVER=03StateLENdpId=17RawLEN=4V=67174430CHK

    The "payload" 04010050 translates to:
    1st byte (indicating the presence of the alarm): 04
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 001E (HEX translates to DEC 30; corresponding to the 30mA which coincides with my setting of the leakage current threshold).

    For DPID 18 the analysis would be, for example:
    55 AA030700 10120000 0C01010013 030100FA 040100D2 21
    HEADERVER=03StateLENdpId=17RawLEN=12ValuesCHK

    The "payload" 01010013 030100FA 040100D2 translates to:
    01010013
    1st byte (indicating the presence of the alarm): 01 Could be the code for overcurrent 1st byte (indicating the presence of the alarm): 03 Could be the code for overvoltage (see 3rd and 4th bytes)
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 00FA (HEX translates to DEC 250; corresponding to the 19A which coincides with my setting of the overvoltage threshold).(see 3rd and 4th bytes)
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 0013 (HEX translates to DEC 19; corresponding to the 19A which coincides with my setting of the overcurrent threshold).

    030100FA
    1st byte (indicating the presence of the alarm): 03 Could be the code for overvoltage 1st byte (indicating the presence of the alarm): 03 Could be the code for overvoltage (see 3rd and 4th bytes)
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 00FA (HEX translates to DEC 250; corresponding to the 19A which coincides with my setting of the overvoltage threshold).(see 3rd and 4th bytes)
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 00FA (HEX translates to DEC 250; corresponding to the 19A which coincides with my setting of the overvoltage threshold).

    040100D2
    1st byte (indicating the presence of the alarm): 04 Could be the code for undervoltage in this DP(see 3rd and 4th bytes)
    2nd byte (when this alarm occurs, the circuit breaker control mode (0X01 trip, 0X00 no action, only alarm)): 01 (trips)
    3rd and 4th bytes: setting alarm threshold: 00D2 (HEX translates to DEC 210; corresponding to the 19A which coincides with my setting of the undervoltage threshold).

    So, more or less, everything is clear; the only thing that puzzles me is the different meaning of the alarm code in both DPs, but could be normal as can be deducted from the examples in the JSON

    Anyway, these DP IDs seem to be useful only for reading and setting the thresholds for alarms which, like I said before, can be done from the local interface and doesn't change frequently, so could be skipped in OBK (apart from the sake of completion...). More interesting would be to include DP ID 9, which is the alarm status, that is very interesting to have reported remotelly.

    morgan_flint wrote:
    BTW, there's a string in the logs (55 AA 03 07 00 10 12 00 00 0C 01 01 00 13 03 01 00 FA 04 01 00 D2 21) that gives an error in TuyaMCUAnalyzer:

    I opened an issue in Github related to this; I checked the string against Tuya specs for this command and the string seems correct, including checksum
  • #54 20852658
    morgan_flint
    Level 14  
    Hello again!
    I have changed/completed the autoexec.bat so now almost all DPIDs of interest are shown:
    Code: Java
    Log in, to see the code


    Screenshot of OpenBK7231N user interface showing various channels and their values.
    In red/green I've added the channel numbers. Some comments:

    All channels show correct values except for:

    - Channel 6: shows 0.28 kWh and the value in the display is 2.8 kWh. I'm using channel type "EnergyTotal_kWh_div100", so could be corrected if "EnergyTotal_kWh_div10" existed (or an alternative for divisors)

    - Channel 11: shows 5.00 Hz and the value in the display is 50 Hz. I'm using channel type "Frequency_div100", so could be corrected if "Frequency_div10" existed (or an alternative for divisors)

    - Channel 9 (power factor) shows the correct value but doesn't seem to recognize the label set in autoexec.bat. Am I doing something wrong?

    Other comments regarding channels:

    - I've set Channels 8 and 14 ("Clear Prepayment" and "Test Leakage") as "Toggle", and they work as intended, i.e., when "pushed", channel 6 sets to 0 (first case) and leakage alarm appears and switch trips (second case). The "problem" is that they stay green (0) and don't go back to red (0) by themselves, as could be expected. In these cases, a "momentary" button type would be a possible solution (or maybe include something in the autoexec for these channels that made them return to 0 a few seconds after toggling to 1?)

    - Channel 15 (Alarm set 1) shows in the textfield the correct decimal value for the expected hex value, according to the analysis in my previous post but, surprisingly, the value shown below for the same channels is different (67174490 vs 67174488.00). At that moment, I had the setting of the leakage current threshold in 90mA, which coincides with the last two digits in the textfield and, if I changed it to 30 in the device, the textfield would react accordingly. What doesn't work is the opposite: if I change the value in the textfield to 67174430 and hit "Set!", the value changes momentarily to this one but returns to 67174490 in a few seconds (and the value in the device's screen doesn't change). So, unfortunately, this isn't a way to set the thresholds from the web interface.

    - I tried a similar approach with "Alarm set 2", but it doesn't show any values (stays at 0). I'm afraid it's due to its length (similar to the exception in TuyaMCUAnalyzer).

    - Finally, channel 17 ("Fault") shows the correct decimal value for a given alarm, according to the analysis in this post. For example, 4 if I force an overcurrent or 8 during the leakage test. I don't know if there is a better way to treat these "bitmaps" in OBK

    Here are some more screenshots in different situations:
    OpenBK7231N control screen displaying various settings and DPID values. User interface displaying measurement data from a device managed by OpenBK7231N_TuyaMCU. Screenshot of the OpenBK7231N control panel showing various channels and values. Screenshot of OpenBK7231N interface showing various channel settings and values.

    And the screenshot from Home Assistant:
    Home Assistant user interface showing various sensor and relay settings

    The textfields are ignored, and the label for power is not the same; curiously, the label for power factor is correct here

    Apart from some details, all the interesting DPs are covered; the only thing I consider interesting that is missing is a better treatment for "Fault" signaling (knowing remotely what has been the protection that has acted: overload, overvoltage, undervoltage or leakage)
  • #55 20852685
    p.kaczmarek2
    Moderator Smart Home
    Good progress, keep it on! I will try to add required channel types tomorrow.
    Helpful post? Buy me a coffee.
  • #56 20853227
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    Good progress, keep it on! I will try to add required channel types tomorrow.

    Thank you!

    Another curious fact about this device: It can detect negative (export) power:
    Display of TOMZN WIFI Multi-Function Protector showing negative power reading of -0.062 kW.

    To check this I simply inverted input and output. The problem is, as the device feeds itself from the input and the relay is open, it doesn't start, but if you temporarily bridge the input and the output (N to N and L to L, of course...) then the device starts and, once it closes the relay, you can remove the bridges and do the test.

    Unfortunately, it doesn't report the negative sign to the module, so it doesn't reflect on the web page. Also, despite power being negative, the energy counters continue to increase...
  • #57 20854635
    morgan_flint
    Level 14  
    >>20719315
    I'm also interested in this subject, as the third listing posted by @crash1912 here was the most informative for identifying the DP IDs of the device, and I have a different one in it's way home, so using this method could be the simplest way.

    I have tried accessing https://openapi.tuyaeu.com/v2.0/cloud/thing/xxxxxxxxxxxxxxx/model, replacing xxxxxxxxxxxxxxx with the "device id" that appears on Tuya platform for developers, but I get an error:
    Screenshot of an error showing an invalid token in a browser.

    It seems like a "token" is missing...

    I've asked @crash1912 privately, as I see he hasn't been around for a while but, just in case @fakuivan or somebody else knows the answer: What am I doing wrong? Is the "device id" the correct replacement for xxxxxxxxxxxxxxx?

    Thanks!

    EDIT: I continued searching on my own and I think I'm on the right way now. The link to look is this one:
    https://iot.tuya.com/cloud/explorer

    You have to have a Tuya Developer account and create a project (same as for this method).

    Still have to find there the query that includes /model, that gives the most complete info

    EDIT 2: Found. In https://eu.iot.tuya.com/cloud/device/, copy the "device_id":
    Screenshot of the Tuya IoT platform showing basic device information.

    Then, in the previous link, select Device Control -> Query Things Data Model:
    Screenshot showing the Tuya IoT platform with the Query Things Data Model function open.

    Then, hit "Copy" in the "response" and you get this:
    Code: JSON
    Log in, to see the code

    The interesting part is the one enclosed between quotation marks after "model": :
    Code: JSON
    Log in, to see the code


    The problem is that is all in one line (no carriage returns), so not very legible. This, joined to the fact that the word "model" didn't show well in the previous screenshot is what made it difficult to locate. To make it more legible, I pasted it into notepad++ and made the following substitutions:
    {\ -> {\n 
    ,\ -> ,\n
    \" -> "
    [{ -> [\n{
    }] -> }\n]
    ]} -> ]\n}

    With "extended" selected in search mode. Here's an example for the first substitution:
    Notepad++ text replacement dialog box
    (I recorded a macro for that)

    Then, after installing "JSON Viewer" plugin, select "JSON format":
    Screenshot showing a context menu in Notepad++ with the JSON Viewer extension selected.

    The results are like this:
    Code: JSON
    Log in, to see the code


    Much easier to read!!

    After that, a little bit of translation from Chinese and manual formatting is still needed to get what I attached here

    If @p.kaczmarek2 finds it interesting, I could open a thread with a tutorial for this
  • #58 20856455
    p.kaczmarek2
    Moderator Smart Home
    Yes, please do, we can send you an Elektroda gadget for doing such tutorial. A guide from start to finish, how to get dpIDs.
    Still, keep in mind that it may be also possible to use online JSON formatters/beautifiers
    Helpful post? Buy me a coffee.
  • #59 20858019
    crash1912
    Level 4  
    Hello again! I was away for a long time, sorry.
    I am very impressed with the great progress!
    @morgan_flint Congratulations on your great work, you've worked hard!
    @p.kaczmarek2 As always, your help is amazing.

    I arrive very late and I see that they have solved practically everything, I don't know if I can contribute anything now... I can only repeat, wow! your work is incredible!
  • #60 20859565
    morgan_flint
    Level 14  
    p.kaczmarek2 wrote:
    Yes, please do, we can send you an Elektroda gadget for doing such tutorial. A guide from start to finish, how to get dpIDs.
    Still, keep in mind that it may be also possible to use online JSON formatters/beautifiers


    Done!


    A bit long, but I hope it's useful. Anyway, please make any suggestions you may have to improve it. Thanks!

Topic summary

The discussion revolves around the TOMZN TOMPD-63-LW Wifi Multi Function power meter, focusing on the integration of OpenBK firmware. Users share experiences with flashing the device, performing UART data capture, and configuring the device for optimal performance. Key features include remote control capabilities, voltage and current monitoring, and customizable protection settings. Users discuss challenges with data extraction, dpID configurations, and the functionality of the device's web interface. Solutions are proposed for issues related to data logging, channel types, and the visibility of certain features in the user interface. The conversation highlights the importance of proper firmware and configuration for achieving desired functionality.
Summary generated by the language model.
ADVERTISEMENT