logo elektroda
logo elektroda
X
logo elektroda

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

xury 10725 74
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.
  • ADVERTISEMENT
  • #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.
  • #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.
  • ADVERTISEMENT
  • #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
  • #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.
  • #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.
  • ADVERTISEMENT
  • #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

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