Skip to content

Fix units and registers#4

Closed
jktjkt wants to merge 8 commits intogertvdijk:developfrom
jktjkt:fix-units-and-registers
Closed

Fix units and registers#4
jktjkt wants to merge 8 commits intogertvdijk:developfrom
jktjkt:fix-units-and-registers

Conversation

@jktjkt
Copy link
Copy Markdown
Contributor

@jktjkt jktjkt commented Jan 24, 2026

Thanks for an awesome tool. We have 10 pcs of Multical 603 and 148 of Multical 303, this PR is a result of some quick toying around with Zenovate/Tespro OP-BT optical head. Please review the individual commits for more details, this is just a summary:

  • unit handling
    • the unit of Kelvins is just K, there's no ˚K
    • add support for W and var with no prefix
    • add other units from the docs (and I learned about the \N{THAT GLYPH NAME} syntax, yay)
  • registers
    • add E1/V1/E8/E9 identification
    • convert some which were mentioned in the vendor's docs, but unused here
    • convert their numbers to decimal

The unit tests all pass. Some of your linters produce a diff which touches files that I have not modified, and I cannot run ruff in my env. Hope this is OK.

There are no "Kelvin degrees", it's always just Kelvins.
This is stated in the "58101758_B1_GB_02.2021" document (Modbus register
mapping, Modbus RTU, Modbus/KMP TCP/IP"). It also makes sense, looking
at all the other values in the table.
These data come from the "58101758_B1_GB_02.2021" document (Modbus
register mapping, Modbus RTU, Modbus/KMP TCP/IP"). I have not seen them
in my meters, but given that all the other values match, I\d say there's
a high chance of them being correct.
This is speculative (I have no KMP-speaking electricity meter with an
IEC optical port), but given that the "kvar" is already defined, and
looking at the other units, this is very likely a typo.
Some of these calculators support multiple flow meters, so let's
identify which "channel" this is using.
The datasheet has this information, so let's include it in the source
code.
Almost all of these were cross-checked against a number of PDFs which I
found on the web. The exceptions are documented in the code:

- 259 is very likely the Q_p, aka the nominal flow,
- 400 is an educated guess, a one-decimal-digit precise T1-T2 difference
- 675 is only there on our WM-Bus enabled Multical 303 which were
  procured with a transmission interval of 96 seconds

I'm using decimal numbers instead of hex because that's what the vast
majority of the documents use. I'll change the existing constants in a
follow-up commit.
The vast majority of the vendor-provided documentation uses decimal
numbers as the primary format -- and so does this tool in its default
output. I only found a couple of documents which used hex numbers, and
in these cases they were always accompanied with the decimal equivalent.
I saw no instance of hexadecimal with no decimal equivalents.

I checked that the resulting content of the list is exactly the same.
@gertvdijk
Copy link
Copy Markdown
Owner

Hi there and thank you for your PRs!

We have 10 pcs of Multical 603 and 148 of Multical 303 [...] with Zenovate/Tespro OP-BT optical head.

That's a really nice setup to play with! 😍

Great to hear that hardware / optical head is working well. Sounds like worth mentioning in the docs for other users.

Please review the individual commits for more details. [...] Some of your linters produce a diff which touches files that I have not modified, and I cannot run ruff in my env.

Yes, thanks, I would love to. I was having a quick look at your PR back in January and was also struggling to get things working again on current ruff versions for example. Time constraints didn't allow me to spend more time on that sooner, sorry about that.

Meanwhile I've created a 0.0.2 as reboot to get a clean slate to enable getting stuff in like this PR and #6 of you. I hope to get to this some time soon.

The other practical issue is that I don't really have access to a Kamstrup meter anymore, so I rely on my own test cases for now. It would be awesome if we can get some more models/setups in the field tested.

Comment thread src/pykmp/constants.py
0x13: "MVAh",
0x14: "GVAh",
0x15: "kW",
0x15: "W",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I agree that it's a lot more likely W is the correct unit. It was a funny one to track down the cause/source for the error.

I found in my notes I copied it from a blog which in turn got it from the PyKamstrup repo and there it was provided by some other person over 14 years ago. 😅

bsdphk/PyKamstrup@3ca8785

(same for the other commit fixing the kvar->var.)

Comment thread src/pykmp/constants.py
88: "Temp3",
0x0059: "Tempdiff",
91: "Pressure P1",
92: "Pressure P1",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

are you sure it's P1 repeated and not P2 for example?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, register number 92 is indeed "Pressure P2", or the analog input P2. Not P1. Thanks for catching this.

I'll take a look at your PR by tomorrow.

@gertvdijk
Copy link
Copy Markdown
Owner

gertvdijk commented Apr 19, 2026

Please have a look at #8. 😃

@jktjkt
Copy link
Copy Markdown
Contributor Author

jktjkt commented Apr 19, 2026

Thanks for adding the extra context, and I'm obviously perfectly OK with taking these changes in a modified form which fits better to the project that you maintain. Let's close this one in favor of #8.

Also, 400+ of water meters KWM2231 were installed last week. The IR head doesn't "click" into place as good as it did on the heat meters, but the SW works well :).

@jktjkt jktjkt closed this Apr 19, 2026
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