Timezone offset of DLMS timestamp
Closed this issue · 1 comments
I'm not 100% certain if this is a bug in AMS Reader or if I'm reading the spec wrong and it is an implementation fail of my meter ;)
Meter: Kaifa MA309MH4LAT1 Austria/Vorarlbergnetz
Basically I think deviation should be added, not subtracted:
amsreader-firmware/lib/AmsDecoder/src/Cosem.cpp
Lines 26 to 28 in 81b3aac
I'm reading the spec to mean that the date/time fields are always local time and deviation
is how much needs to be added to get to UTC:
https://github.com/dbeinder/KsmWestKaifaReader/raw/master/spec/Blue-Book-Ed-122-Excerpt.pdf (page 33)
This is a decrypted DLMS frame of my meter, captured at 2024-06-15 20:23:45+02:00
: dlms.zip
It reports 2024-06-15 20:23:45
in the date/time fields, and a deviation of -120
.
The current AMS Reader code turns this into
meterTimestamp = 1718490225 (2024-06-15 22:23:45 UTC)
instead of
meterTimestamp = 1718475825 (2024-06-15 18:23:45 UTC)
Absolutely right, thank you!
07e8 06 0f 06 14 17 2d 00 ff88 80
2024-06-15 SAT 20:23:45.000 -120 (0x80 == daylight saving active)
I think this may be the first meter I've seen where the deviation field is used, most meters report 0x8000