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

Made verifying the checksum of a message optional #18

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

Conversation

fremouw
Copy link

@fremouw fremouw commented Oct 31, 2018

In the DSMR 3.0 spec there's no checksum value to verify a (P1) message, so a simple message could look like this,
`/ISk5\2ME382-1000

1-0:1.8.1(000671.578kWh)
1-0:1.7.0(00.318
kW)
!`

I've mainly added an optional parameter to the parse function to not verify the checksum and added some if statements to not actually verify it. As it's optional it should not conflict with current code.

Copy link
Owner

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for my superlate response. Overall, you change looks good (left one remark inline). However, I'm not quite sure if adding a (runtime) bool parameter to parse is the best way to configure this. In #22 I just wrote:

This is probably best fixed with an option somewhere, probably in the parser, which means either a runtime argument to the P1Parser::parse function, or a template argument to the P1Parser class (where the latter might make more sense). The argument could either be a DSMR version number (deriving whether a checksum is needed from that, a simple boolean enable_crc or something, or an object/struct containing an enable_crc which allows more options later). Any thoughts on that?

next = data_end;
while (next < str + n && *next != '\r' && *next != '\n') {
++next;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Is there a CRLF after the !? If I read the v4 spec correctly, there should be no CRLF after the last line (which I think is the checksum line in v4, and the ! line in v3)? Are you seeing a CRLF in your messages?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you could be right, I've checked the v3 spec and there's no CRLF. Need to check if that's somehow added to my recording.

@fremouw
Copy link
Author

fremouw commented May 14, 2019

Apologies for my superlate response. Overall, you change looks good (left one remark inline). However, I'm not quite sure if adding a (runtime) bool parameter to parse is the best way to configure this. In #22 I just wrote:

This is probably best fixed with an option somewhere, probably in the parser, which means either a runtime argument to the P1Parser::parse function, or a template argument to the P1Parser class (where the latter might make more sense). The argument could either be a DSMR version number (deriving whether a checksum is needed from that, a simple boolean enable_crc or something, or an object/struct containing an enable_crc which allows more options later). Any thoughts on that?

I've added it runtime so I can use one firmware for multiple smart meters and make it configurable over a web interface.

@mrWheel
Copy link

mrWheel commented Jul 19, 2019

Matthijs,
For a builder of my DSMR-logger I also need a way to escape the CRC.
Is there any plan (any time soon) you will merge this into the master branche?

@matthijskooijman matthijskooijman mentioned this pull request Jan 2, 2022
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.

3 participants