libsml
libsml copied to clipboard
add support for SML_TimestampLocal
hello. thanks for submitting. could you add a short description what's the purpose of this change/commit/enhancement ?
Enhancement:
- add support for new SML_Time choice (localTimestamp - 0x03) which is the part of SML 1.04
@devZer0 is above description enough?
@karolgwiazda: good stuff, many thanks. the first question that comes to mind when reading this, can you give an example for which meter(s) this adds support for? (is it the "FROETEC Multiflex ZG22" mentioned in the comment being removed?)
it's great that a unit-test is included, but can you maybe also post a full example transmission from such a meter. (just attach a hexdump here) (otherwise nobody but you can verify the code is actually useful - we had a repository of sample data somewhere at some point i think)
@r00t- How can that be tested? I don't think my meter supports sml 1.0.4. I don't think it's for the buggy Holley here.
What is that feature about? Local timezone timestamp support?
@hacki11: sorry, ignore me, i got confused and thought your timestamp issue was the same as for the "FROETEC Multiflex ZG22"
@karolgwiazda: good stuff, many thanks. the first question that comes to mind when reading this, can you give an example for which meter(s) this adds support for? (is it the "FROETEC Multiflex ZG22" mentioned in the comment being removed?)
it's great that a unit-test is included, but can you maybe also post a full example transmission from such a meter. (just attach a hexdump here) (otherwise nobody but you can verify the code is actually useful - we had a repository of sample data somewhere at some point i think)
SML 1.0.4 is used by this meter - https://www.isabellenhuette.de/praezisionsmesstechnik/dc-energiebezugszaehler-neu This enhancement adds partial support for this meter (some other fixes are needed as well. Will be provided when this enhancement is merged) SML 1.0.4 adds new option to represent time: SML_Time ::=CHOICE { secIndex [0x01] Unsigned32, timestamp [0x02] SML_Timestamp, localTimestamp [0x03] SML_TimestampLocal }
SML_TimestampLocal ::=SEQUENCE { timestamp SML_Timestamp, localOffset Integer16, seasonTimeOffset Integer16 }
The element 'localOffset' must be specified in minutes. The 'seasonTimeOffset' element must be specified in minutes. The local time is calculated as follows: localTime = Timestamp + localOffset + seasonTimeOffset
below is an example of setting the time on the meter {"utcSec":1615984546,"localOffsetMin":60,"seasonTimeOffsetMin":0} 1b1b1b1b01010101760b132c9580cf334fbcb13562016200726500000100770105636f6e310973657472746369640b0901495341000112cc260101620163aae300760b5061711cd7cc48c0bb8162016200726500000600750b0901495341000112cc2601017107010000090b007307010000090b0072620472620373656051f7a253003c5300000163e56200760b92f9140f37fe40e8a1b1620162007265000002007101634133001b1b1b1b1a00979c and response from meter 1b1b1b1b01010101760b132c9580cf334fbcb13562016200726500000101760105636f6e310973657472746369640b0901495341000112cc26726201650005729b620163a0d400760b5061711cd7cc48c0bb816201620072650000ff01740b0901495341000112cc26078181c7c7fd00034f4b016373e100760b92f9140f37fe40e8a1b1620162007265000002017101639d69001b1b1b1b1a00c293
@karolgwiazda , would you like submitting a some binary dump from your smart meter to https://github.com/devZer0/libsml-testing ?