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 multical 21 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adabrandt
Copy link

@adabrandt adabrandt commented Aug 28, 2020

This pull request adds support to read out the Kamstrup Multical 21 water meter using the optical eye from https://wiki.volkszaehler.org/hardware/controllers/ir-schreib-lesekopf (I used the USB version).

Notes about the multical 21 interface:

  • It is fully in line with the Kamstrup Protocol as documented at https://github.com/sloev/susie-report/raw/master/SusieReport.pdf
  • The initial request (0x80 ...) is fed back to the sender first, and needs to be ignored before processing the actual response (0x40 ...). This seems different from the other Kamstrup devices already supported (as the code did not seem to be able to handle that).

Open points:

  • CRC of the response seems not to be correct. This does not matter, as we dont need it, but is still strange. It might indicate a problem with the CRC calculation.
  • The 'Info' message is not fully parsed yet - although this can be done based on the info from the multical 21 manual (https://products.kamstrup.com/download.php?uid=515d4b410de78)

All comments welcome. I tried to stay as close as possible to the original code, with the exception of factoring out the common code between readvar and readvar_multiple into a new process_response function.

@adabrandt
Copy link
Author

adabrandt commented Aug 28, 2020

Example of CRC problem:

  • Full response from multical 21: 80 3f 10 01 00 63 19 45 0d 40 3f 10 00 63 33 02 00 00 00 cf 4e 0d
  • Relevant answer only (without start/stop bytes and CRC): 3f 10 00 63 33 02 00 00 00
  • CRC added by multical 21: cf 4e
  • CRC calculated on relevant answer only: f1 79

EDIT: I misunderstood how the CRC function works. Apparently one either needs to append two zero's at the end to get the CRC correctly calculated and returned, OR one can already put in the actual CRC, and then he CRC function will return '0' if the CRC is correct.

Thus:
3f 10 00 63 33 02 00 00 00 00 00 returns the correct CRC cf 4e
3f 10 00 63 33 02 00 00 00 cf 4e returns 0, indicating the CRC is correct.

The original code did this correctly - I will restore this shorthly.

@golles
Copy link

golles commented Jan 10, 2023

Hi @adabrandt, sorry I haven't found any other way to get in touch with you...

I really like that you implemented the readvar_multiple function. Can I copy your work into my project?
https://github.com/golles/ha-kamstrup_403/blob/main/custom_components/kamstrup_403/kamstrup.py

For more info, you can find my email on my GitHub profile page, feel free to contact me, thanks!

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