RalfOGit / sma-emeter-simulator

An SMA(TM) emeter simulator written in C++
MIT License
16 stars 5 forks source link

Emeter UDP packet size #2

Closed gonzabrusco closed 1 year ago

gonzabrusco commented 1 year ago

Hi @RalfOGit,

I'm just starting to develop a meter that sends out the information using the SMA protocol, so your library comes really useful. Thank you for your work!

Anyway, I have a real EMETER at hand and I see that the sent packets are 608 bytes in size. But when looking at your code here, I see you are using a payload size of 600 bytes instead. Is that correct?

https://github.com/RalfOGit/sma-emeter-simulator/blob/b77a558aed413f6b966cb6d5eae40302e935892f/src/main.cpp#L55

image

RalfOGit commented 1 year ago

Hi Gonzalo,Interesting. I modelled the UDP packet to be identical to what my own emeter sends out. Can you send me a wireshark dump of the 608 byte packet? It would be interesting to see what they have changed.Best regards RalfAm 04.05.2023 um 19:18 schrieb Gonzalo Brusco @.***>: Hi @RalfOGit, I'm just starting to develop a meter that sends out the information using the SMA protocol, so your library comes really useful. Thank you for your work! Anyway, I have a real EMETER at hand and I see that the sent packets are 608 bytes in size. But when looking at your code here, I see you are using a payload size of 600 bytes instead. Is that correct?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

gonzabrusco commented 1 year ago

Check this!

https://github.com/kettenbach-it/FHEM-SMA-Speedwire/blob/8e406890be575a245a6908d91008f2b32ccd1820/77_SMAEM.pm#L391

RalfOGit commented 1 year ago

… ok, this explains it. Thanks for the Wireshark dump. There is a new 8-byte field that needs to go behind PowerFactorTotal:

obis = insert(emeter_packet, obis, ObisData::NegativeApparentEnergyTotal,  327.62);

obis = insert(emeter_packet, obis, ObisData::PowerFactorTotal,               0.54); 

    0e04000000c39300

Looking at the OBIS definitions and at fields displayed, or better not displayed, by the Energy Meter app for iOS, this is likely a value for the grid frequency. I will need to adapt the code to accommodate for this new field. Give me a bit of time for this change.

Have a nice evening

Ralf

RalfOGit commented 1 year ago

Hi Gonzalo,

I just added obis definitions for frequency measurements to libspeedwire and added it to the emeter-simulator as well. Please update both git repositories and check if this works for you.

I deleted your email with the zip attachment for privacy reasons.

Best regards

Ralf

gonzabrusco commented 1 year ago

Thanks @RalfOGit !! That was fast!!

I will check it out. Thanks again