Closed r-werner closed 1 year ago
Thx for your elaborate info.
This driver is some work in progress based on user requests/support.
I'll add another datatype solving your issue soon.
Try latest dev release. It adds two new datatypes 6 and 8.
6 for swapped int32, 8 for swapped uint32 as you suggested.
Give it a try.
Thanks for the super quick turn around!!! ...tried just now, but it is dark, no sun, no power and inverter is "sleeping" ...only returning 00 00 00 00... and with this I can't see any difference ;-) will try again tomorrow.
tested and works as expected! :-) the following input value (received from the inverter): 01 04 04 EB EC 00 0E 8E 51 was successfully decoded to (incl. devision by 1000): 977.9000
PROBLEM DESCRIPTION
A clear and concise description of what the problem is. Generic Modbus energy meter (xnrg_29_modbus) allows to receive UINT32 and INT32 (4 byte) numerical values. The code needs to translate the data (4 bytes) received from the serial interface into native float.
When receiving numerical MODBUS values of "Datatype" 4 (called "4-byte unsigned" by the code comments) the current implementation is assuming a certain byte and word order (4 bytes are received in 2 words with 2 bytes per word).
But the current implementation does not match the expected behaviour of my solar inverter (SOLAX X3 MIC) resulting in wrong values (e.g. for "Energy Total") Several MODBUS specifications found online as well as other protocol implementations specify the following de-coding logic for INT32 values: 32-bit values must be read as two consecutive Modbus registers (register count = 2). The byte order (inside the single word) is MSB->LSB. In INT32 and UINT32 formats, the word order is LSW-> MSW.
Example: an int32 consisting of 4 bytes B3, B3, B1, B0 would be received in the order: B1, B0, B3, B2 This is because the 4 bytes are split across two MODBUS registers (e.g. A and A+1). The first register holds B1 and B0 and the next register holds B3 and B2 (both registers are read together resulting in 4 bytes to be decoded).
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log: