olliiiver / sml_parser

Low memory C++ library to parse Smart Message Language (SML) data from smart meters.
GNU Lesser General Public License v2.1
34 stars 15 forks source link

Add parsing of two-byte twos' complement message payloads. #6

Closed deltaphi closed 1 year ago

deltaphi commented 1 year ago

When observing the current power value and running a energy production unit (e.g., solar power on your own roof), it appears that in at least some meters the current power value is provided as a two-byte value in twos' complement representation (to be fully verified).

This change lets SML Parser parse two-byte values. In addition, it performs sign extension in case of negative values.

deltaphi commented 1 year ago

Testing revealed that - at least for the tested case - the meter in question uses twos' complement and this change prints out the values directly.

olliiiver commented 1 year ago

Hi @deltaphi. Thanks for adding this PR. Your request should have been solved within #7.