Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Extract power calibration data #35

Open
dwmw2 opened this issue Aug 20, 2024 · 1 comment
Open

Feature request: Extract power calibration data #35

dwmw2 opened this issue Aug 20, 2024 · 1 comment

Comments

@dwmw2
Copy link

dwmw2 commented Aug 20, 2024

(This is a "duplicate" of libretiny-eu/ltchiptool#38 )

I have a bunch of Tongou DIN rail power meters (https://www.elektroda.com/rtvforum/viewtopic.php?p=21191153#21191153),. and have finally got round to liberating them.

I've been experimenting with them, and found that the calibration parameters for the BL0942 chip are available both in the DPs that the Tuya firmware reports, and also in the flash. More details at esphome/issues#6155

So apart from the one I already converted without reading its flash first, I can liberate them without losing the factory calibration. It would be nice if the tooling could help new users get this right.

Example firmware dump at http://david.woodhou.se/tongou-tuyafw.bin (sha256 a0b0a2804946f8760f5be0360a3b0325d204087c6aae6c7917297cba2f1341ba)

I found the calibration at 0x001d5000:

001d5000  60 3e 00 00 82 30 00 00  13 0c 00 00 5d 0a 00 00  |`>...0......]...|

That's

  • UREF = 0x3e60 = 15968
  • IREF = 0x3082 = 12418 (times ten to make 124180)
  • PREF = 0xc13 = 3091 (divide by ten to make 309.1)
  • EREF = 0xa5d = 2653

We can apply a sanity check to those, as the PREF can be derived from UREF/IREF, and EREF from PREF as described in the ESPHome ticket above.

@dwmw2
Copy link
Author

dwmw2 commented Aug 27, 2024

Now documented for ESPHome: https://devices.esphome.io/devices/Tongou-TO-Q-SY1-JWT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant