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

add support for SML_TimestampLocal #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karolgwiazda
Copy link

No description provided.

@devZer0
Copy link

devZer0 commented Feb 24, 2021

hello. thanks for submitting. could you add a short description what's the purpose of this change/commit/enhancement ?

@karolgwiazda
Copy link
Author

karolgwiazda commented Feb 25, 2021

Enhancement:

  • add support for new SML_Time choice (localTimestamp - 0x03) which is the part of SML 1.04

@devZer0 is above description enough?

@r00t-
Copy link
Collaborator

r00t- commented Mar 10, 2021

@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)

@hacki11
Copy link

hacki11 commented Mar 11, 2021

@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?

@r00t-
Copy link
Collaborator

r00t- commented Mar 11, 2021

@hacki11: sorry, ignore me, i got confused and thought your timestamp issue was the same as for the "FROETEC Multiflex ZG22"

@karolgwiazda
Copy link
Author

@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

@devZer0
Copy link

devZer0 commented Dec 17, 2021

@karolgwiazda , would you like submitting a some binary dump from your smart meter to https://github.com/devZer0/libsml-testing ?

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.

4 participants