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

fix: use from_le_bytes in Real32Bit #36

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

dragonnn
Copy link
Contributor

One more thing I hit during my testing, only one of our heatmeters did return temperatures using Real32Bit encoding, the decoded value was wrong. This was fixed by using litte-endian byte order instead of big.
As far I can tell pymeterbus uses little-endian too:

https://github.com/ganehag/pyMeterBus/blob/d1a7552c9adcf52a59d04c9812478d496c191c89/meterbus/telegram_field.py#L64

It uses struct.unpack function with reading the documentation:
https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment
"Native byte order is big-endian or little-endian, depending on the host system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-endian"
So that would mean running it on most systems would be little-endian (and running it on big-endian systems would lead to a bug :D).

@maebli maebli merged commit 58a3201 into maebli:main Jan 26, 2025
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants