logo elektroda
logo elektroda
X
logo elektroda

EAMPDW-TY63 Alternative Firmware: Access Measurement Data with OpenBeken via TuyaMCU

xury 11373 76
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #61 20975848
    njhuiz
    Level 5  

    The device with firmware version 2.0.3 (response to "uartSendHex 55 aa 00 01 00 00 00") seems to have pretty much the same dpIDs like the TOMPD-63 minus the Prepaid functions. Also the reset times can't be set (and there is only one). Other than that, we can use the autoexec.bat and the REST html of @angelofdeath

    There is just a minor problem with the current FW version 1.17.480. The bool to clear the Energy is on dpID 12, which does not show up with "tuyaMcu_sendQueryState". When I set dpID 12 in the autoexec.bat like in the TOMPD-63 example, the "/cm?cmnd=Dp" page delivers a malformed JSON:

    {"id":12,"type":2,"data":0}

    Which crashes the JavaScript code on the html page.

    My observation is also in other cases, that if a dpID is assigned in autoexec.bat, but does not show in QueryState, the JSON has an extra " at the end of the corresponding field, which obviously results in an invalid JSON expression. I had a short look at the sources, but did not find the corresponding code.
  • ADVERTISEMENT
  • #62 20975915
    p.kaczmarek2
    Moderator Smart Home
    Can you show exactly how the malformed JSON look like?
    Helpful post? Buy me a coffee.
  • #63 20976537
    njhuiz
    Level 5  
    Using the TOMPD-63 autoexec, I get the following response to /cm?cmnd=dp

    {"id":105,"type":2,"data":0"},{"id":104,"type":2,"data":0"},{"id":17,"type":2,"data":67174430},{"id":14,"type":2,"data":0"},{"id":13,"type":2,"data":0},{"id":18,"type":0,"data":"0101000C03010100040100800801000109000000"},{"id":9,"type":0,"data":"00"},{"id":15,"type":2,"data":2},{"id":6,"type":201,"data":"08F70004140000D0"},{"id":1,"type":2,"data":0},{"id":12,"type":1,"data":1},{"id":11,"type":1,"data":1},{"id":16,"type":1,"data":1},{"id":19,"type":3,"data":0"}]
    


    The result has extra " for almost all dpIDs, which are not listed in QueryState: 105, 104, 14, 19. But somehow with this autoexec.bat dpID 12 is the exception, it has no extra " and also does not appear in QueryState. Maybe I can solve the problem of accessing dpID 12 in another way. But in general, it would probably be best, if any request produces a valid JSON.

    EDIT: If I delete the definitions for dpID 104 and 105 from the autoexec.bat, I get the extra " in dpID12. Strange error.
    [{"id":17,"type":2,"data":67174430},{"id":14,"type":2,"data":0"},{"id":13,"type":2,"data":0},{"id":18,"type":0,"data":"0101000C03010100040100800801000109000000"},{"id":9,"type":0,"data":"00"},{"id":15,"type":2,"data":2},{"id":6,"type":201,"data":"08F700040D0000CE"},{"id":1,"type":2,"data":5},{"id":12,"type":1,"data":0"},{"id":11,"type":1,"data":1},{"id":16,"type":1,"data":1},{"id":19,"type":3,"data":0"}]
    


    The result of tuyaMcu_sendQueryState is given below.

    nfo:TuyaMCU:Received: 55 AA 03 07 00 08 01 02 00 04 00 00 00 02 1A 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 1 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 2
    Info:TuyaMCU:Received: 55 AA 03 07 00 0C 06 00 00 08 08 F5 00 04 11 00 00 CF 04 
    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 05 09 05 00 01 00 1D 
    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:TuyaMCU:Received: 55 AA 03 07 00 05 0B 01 00 01 01 1C 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 11 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 0D 02 00 04 00 00 00 00 24 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 13 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 0
    Info:TuyaMCU:Received: 55 AA 03 07 00 05 10 01 00 01 01 21 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 16 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 0F 02 00 04 00 00 00 00 26 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 15 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 0
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 11 00 00 04 04 01 00 1E 49 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 17 type 0-raw len 4
    Info:TuyaMCU:ParseState: int32 67174430
    Info:TuyaMCU:Received: 55 AA 03 07 00 18 12 00 00 14 01 01 00 0C 03 01 01 00 04 01 00 80 08 01 00 01 09 00 00 00 F2 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 31
    Info:TuyaMCU:ParseState: id 18 type 0-raw len 20
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 0F 02 00 04 00 00 00 02 28 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 15 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 2
  • #64 20976543
    p.kaczmarek2
    Moderator Smart Home
    Oh sure, I can see a problem, here's a fix:
    https://github.com/openshwprojects/OpenBK7231...mmit/7da0682c76a9a5d2cd54d61f08b70101b50545fd
    or at least I hope that's a fix! can you update and recheck?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #65 20976576
    njhuiz
    Level 5  

    Perfect! With this change we can in principle also use the rev6.1 html of @Angel0fDeath for this device. But I'll also make a reduced version for this device, or maybe a common one for both. EAMPDW-TY63 has no breaker ID, and therefore it is easy to tell both apart.
  • #66 20976582
    p.kaczmarek2
    Moderator Smart Home
    Please post it as a separate topic in the Tutorials section, and maybe add some generic information on the script. This is a good work and it deserves to have separate topic so more people can see it.
    Helpful post? Buy me a coffee.
  • #67 20977895
    Angel0fDeath
    Level 13  

    @njhuiz Sorry, was busy last few weeks and didn't visit the forum, but it seems my script works for you also, which I am glad to hear :)
    Feel free to change whatever you want in my script in order to fulfill your needs :)

    EDIT:

    Important: In order for the script to work correctly, all dpID's which you want to receive SHOULD be mapped with CORRECT data type. It doesn't matter on which channel dpID's will be mapped but should be mapped, since OBK works with only mapped dpID's - that's what we agreed with @p.kaczmarek2 . Data type - if something doesn't work as you expect, change data type in mapping to raw and handle received bytes from the script.

    I hope the above will help to make the script better for your needs.

    PS: As I said in another post, the script shows how you can do something with the device. Since flash of the device is limited and we already have a solution, do not expect all these additional features to be included in firmware. Make a module for your home automation server. I'm using FHEM and a lot of my script already incorporated
  • ADVERTISEMENT
  • #68 20978054
    njhuiz
    Level 5  

    Actually, the EAMPDW-TY63 is pretty similar to the TOMPD-63. Mainly just without Prepaid, BreakerID, the two settable timeouts. It has two additional values in dpID 18, whose effect I don't yet know. We can even use your autoexec.bat, if buttons without function on the main page are of no concern.

    I'll try to make an html page for both devices. The TOMPD-63LW also seems similar. Maybe with some JavaScript it would be possible to write a unified html for this class of devices.
  • #69 20978183
    Angel0fDeath
    Level 13  
    @njhuiz
    Quote:
    The TOMPD-63LW also seems similar.


    Correct. Breaker2.html for that device will be published next week, I'm working on that. As I said was busy last few weeks...

    Quote:
    I'll try to make an html page for both devices.

    Everybody likes common solutions, but intention of the script was to host it on the device's LFS. I also have thoughts about making a unified web page, but for now this is a background issue for me - more important things to do... Of course, feel free to make it... For all 3 devices now :)

    EDIT: The latter device (63LW) has 2 more buttons and dpID 104 & 105 are read only.
  • ADVERTISEMENT
  • #70 20978775
    njhuiz
    Level 5  

    This device is strange. It has indeed some prepaid functionality, which can be toggled by dpID 11 and works just like in TOMPD-63. Prepaid energy can be read on dpID 13 and added to by writing to dpID 14. The energy used is then automatically subtracted from the prepaid energy.

    In dpID 18 there are two more variables compared to TOMPD-63.

    If the first is set to be bigger than zero and the prepayment toggle is on and the prepaid energy (dpID 13) is also bigger than zero, then a "Not Enough Credit" fault will be triggered, and can be used to turn off the breaker by setting the corresponding protection byte. Maybe there is some dpID to which some "Credits" can be written.

    The value of the second one will always be read as zero, but the protection byte can be written. If the protection is on, the breaker turns off when the prepaid energy is less than zero.

    This can be used to turn off the breaker after a certain amount of energy has been used. I'm still missing some information, to be able to use the first variable. But since I don't need the prepaid functionality, I won't investigate further. Probably.
  • #71 20979622
    njhuiz
    Level 5  
    The breaker also signals the "No Prepaid Energy" fault, during the shutdown due to that reason. That's to my knowledge the only fault which will not be raised, when the corresponding protection byte is 0. All other faults will be signaled whenever their condition is satisfied.


    Added after 7 [hours] 13 [minutes]:

    Here are my current files for operating this device. You have to modify "baseURL" in the html file to your needs. This is just a minor mod of the files of @angelofdeath for the TOMPD-63.

    This should cover pretty much all of the functionality of the device. I just haven't found a way to set the recovery time.

    Is there a way to read the product information (response to uartSendHex 55 aa 00 01 00 00 00) via JavaScript, like cm?cmnd=status ? This would be useful to be able to compare firmware versions and to warn people, if their version hasn't been tested yet. Or to implement patches for different versions.
  • #72 20985011
    njhuiz
    Level 5  

    The leakage seems to be measured correctly on my devices. I just measured 4mA with 56KOhm and 8mA with 27KOhm at 230V. I've just been curious, because someone in this thread reported the leakage measurement in his devices to be way off. Maybe that's been a flaw in earlier devices.
  • #73 20988172
    Angel0fDeath
    Level 13  
    @njhuiz I just posted updated script for TOMPD-63-LW here:

    https://www.elektroda.com/rtvforum/topic3995777-60.html#20988137

    You can check it if something could be used in your script.

    Quote:
    This should cover pretty much all of the functionality of the device. I just haven't found a way to set the recovery time.

    On which dpID in your device is recovery time? I don't see this dpID mapped in your autoexec.bat file and therefore the script will never receive this dpID. Dp command works only with mapped dpID's. It doesn't matter on which channel dpID's will be mapped, but should be mapped. I also don't see any attempt to read this dpID in html file...
    If you post here response of tuyaMcu_sendQueryState for this dpID (recovery time) probably will be able to assists you to set this.

    Added after 5 [hours] 32 [minutes]:

    @njhuiz I updated your html script to match the rest scripts, I issued today.
    The reason of update is descried here:

    https://www.elektroda.com/rtvforum/topic4022907-90.html#20988474

    There is also new release of the script for TOMPD-63-LW here:

    https://www.elektroda.com/rtvforum/topic3995777-60.html#20988663

    In your script, I didn't altered anything else, except some comments and of course synchronization with the other scripts, so it should work. Now all scripts should behave and look identically (with necessary differences :) ). Please test and send feedback.

    If you change something - be sure to follow file naming convention - there is a comment inside the script.

    If you need help for something - just let me now :) . Regards.

    PS: Since I tested the script as long as I can with my device, do not forget to change IP/URL address with the address of your device :)
  • #74 20989290
    njhuiz
    Level 5  

    Thanks for looking at my version of the scripts. This device probably does not have a way to set the response time. I did map all dpIDs that the devices reports and two more (12 and 14), which I took from your scripts. Maybe that is an error in the firmware. Also the official Tuya App does not have an option to set the time.

    I called the two registers unique to this device initially U1 and U2, since I had no idea, what they were for. I should have given them a proper name before uploading though. U1 is still kind of a mystery. It triggers a "Not enough Credit" fault, even though in the Tuya App there is no way to set credits. Another peculiarity of the firmware.

    I've got one suggestion for the UI. There should be a button to stop updates of the settings to the device. The other day I accidentally touched the under voltage slider on my smartphone, which easily could have led to an unwanted shutdown of the breaker.

    I've also ordered a TOMPD-63-LW on sale for 15 Euros on March 1st. It's a new version with color display. Let's hope that they did not change anything else.
  • #75 20989505
    Angel0fDeath
    Level 13  
    Quote:
    I've got one suggestion for the UI. There should be a button to stop updates of the settings to the device. The other day I accidentally touched the under voltage slider on my smartphone, which easily could have led to an unwanted shutdown of the breaker.

    @njhuiz Exactly due to this reason the settings are hidden when you load the page...

    Quote:
    U1 is still kind of a mystery. It triggers a "Not enough Credit" fault, even though in the Tuya App there is no way to set credits. Another peculiarity of the firmware.


    In the other 2 devices - 'Not enough credit' is triggered only when you turn on Prepaid Energy Toggle and no prepaid energy is set in the device. Btw, this also turns off the main relay. So if this is the case with your device this definitely is Prepaid Energy Switch. I don't know how you can set prepaid energy. Maybe really peculiarities of the firmware. If so, I can recommend you just to forget about this feature and to use the device without it. After you finish all adjustments - clean your autoexec.bat and html script from what is not necessary and submit them on Github page. Also submit them here:

    https://www.elektroda.com/rtvforum/topic4040354.html
  • Helpful post
    #76 21612824
    vincenzoernst1
    Level 8  
    just for the google search

    Alternative names for the
    * EARU EAMPDW-TY63
    are
    * SMTONOFF Tuya WiFi 2P 63A
    * TOMZN TOMPD-63 (LW or SW) or  TOVA-63T
    * DIYGO DGC-63T
    * TANELE TVP51-63T
    * UNKAS WIFI Function Protector
    * TNCE Automatic Reclosing Protector

    *there is also a brand sold in russia....cant find it right now

    @xury
    can you plz add the vendor to the topics subject?
    can you add the alternative names to your first post
    and
    can you add the current working config to your fist post, so i can easily be found?


    just in case attached is also a backup of the orig fw and a pdf of the "manual" from my device

    @p.kaczmarek2

    p.kaczmarek2 wrote:
    xury wrote:

    How can you upload Openbeken without soldering? If you have dump flash from one, can you use it for others? I'm asking because in the case of, for example, Sonoff, you need to have the original backup.

    To program other devices without soldering, you need a full dump of flash memory (2MB) from a device from the same series and with the same build version. Then it's handed over to the Cutter team to add support, but that's what I can do now - just do a full 2MB read and post the dump.


    could u send the attached backup orig fw to the cloudcutter team?
  • #77 21613612
    morgan_flint
    Level 14  
    Zogdan wrote:
    Just a small warning on quality:

    I bought a few more of these devices, and they all have the same problem with measuring leak current.

    The RCD function (Residual Current Device) of the EAMPDW-TY63 is unusable and you should not rely on that as a protection device, since it consistently reads too high values, tripping the set protection. If readings are so much all over the place you might wonder if it is reading anything useful, so I just switch it off...

    For completeness or those searching : the printed sticker says EARU EAMPDW-TY-63


    Hello @Zogdan and rest of topic followers.

    I understand the quoted post is old, but just in case you didn't solve the problem and/or others are having the same.

    From the photos in your previous post:
    EAMPDW-TY63 Alternative Firmware: Access Measurement Data with OpenBeken via TuyaMCU

    I can see the current transformer for leakage current (toroidal yellow part top left of the photo) is only measuring one of the poles, so, logically, it is showing a very high current (in fact, it's measuring the phase current). To measure leakage current (i.e., the difference between the phase and neutral currents), it should encompass the two poles: the one that goes through the relay and the other one, which has the current shunt (the one in the lower part of the case in your photo).

    I'm not sure if it came mounted like that from the factory or if it was due to your teardown. As you mentioned, you bought and tested a few more, and if you tested them before opening, I understand it's the first possibility, which would indicate very poor quality control. From the photos, it may be a bit tricky to put it correctly, but it should surely be possible.

    Hope this helps if you're still monitoring the thread.

    Regarding using this as a protection device, I'd rather trust my life to a "traditional" RCD, approved for use by local regulations (in my country it's mandatory to have a 30 mA unit upstream every 5 circuits), but this kind of device could still be useful to measure residual currents in individual circuits and/or tripping at lower levels than the one upstream, if you want to have a more sensible protection for some reason (e.g., a test panel in a lab).

    EDIT: in the second photo of your teardown here:
    Inside of an electronic meter with visible components and Taoplus BK7231N WiFi module after removing the back cover.

    You can see how the residual current transformer (black in this one) is surrounding both poles, This is the correct way to install it to measure the difference between input and output currents.

Topic summary

The discussion revolves around the EAMPDW-TY63 device, focusing on the implementation of alternative firmware, OpenBeken, to access measurement data via TuyaMCU. Users share experiences with flashing the device, configuring it to read voltage, current, and power data, and troubleshooting issues related to data accuracy and communication. Key points include the need for specific commands to enable data reporting, the importance of MQTT configuration, and the challenges faced with leakage current measurements. The conversation also touches on the device's firmware capabilities, including the mapping of dpIDs to channels for effective data retrieval and control.
Summary generated by the language model.
ADVERTISEMENT