Support for reading Multical 21 water meters

Kamstrup Multical is an extremely popular product used by millions of people in Europe. It is possible to read it over the air so it could be actually the perfect way to integrate water consumption monitoring into HA. It is waaay over my head but I found that some people are tinkering similar thing (not HA) in Github.( GitHub - weetmuts/wmbusmeters: Read the wireless mbus protocol to acquire utility meter readings. ) so it should be possible. This is a much better way than simply reading meter pulses. It is also interesting to know how many HA users actually use Multical reader.

Iā€™m currently tinkering with getting a Multical 21 meter to read data from it using a iM871A-USB - Wireless M-Bus USB-adapter to see if i can get readings of it.

Currently not sure the meter i have does Wireless MBUS but iā€™ve but a case with the utility company in this town for some information on it and possibly encryption keys incase they have it inplace. Which they probably will have if its wireless-MBUS so one canā€™t snoop on the neighbors water meters :slight_smile:

There is no mention of it in HA papers, (at least I have not seen it) but I actually found in Github [wmbusmeters] myself. They mention encryption as a possibility but as I understand it is so far not really used in real life. I donā€™t have at moment M-Bus adapter so I canā€™t be sure.

Iā€™ve just got my water meter replaced. Had a Multical21 but itā€™s replaced with a new itteration called FlowIQ 2200. But the old and the new one is supported in wmbusmeters.

And i got the decryption key from the utility company today, which enabled me to get it going.

So iā€™ve pieced together MQTT and wmbusmeters into HA so now i get m3 and m3/hour data every 16 seconds over wireless-MBUS.

So it seems to work with the iM871A-USB dongle. If you want some snippets or hints into get it working reply on this :).

Thanks
I got a cheap RTL8232 dongle and it seems to work great. I can see meter in the log files.
I donā€™t have the encryption key from the local company jet but I would have at this point if itā€™s possible some confirmation about setup information just in case if in HA everything works exactly as I understood.
As far as I understand, I need to create a MyTapWater file in the wmbusmeters.d folder to enter the settings and thatā€™s basically all.
Did u also alter the conf file for Multical21 or I dont have a need to touch that?
I also have not used MQTT before but this probably can wait until I actually get the key for the meter.
Thanks

Here is my config for wmbusmeters and HA sensor:

/etc/wmbusmeters.conf

loglevel=normal 
# Remember to change auto here to the device you are going to use in production.
device=rtlwmbus
logtelegrams=true
format=json
meterfiles=/var/lib/wmbusmeters/meter_readings
meterfilesaction=overwrite
logfile=/var/log/wmbusmeters/wmbusmeters.log
# Enable MQTT Support
shell=/usr/bin/mosquitto_pub -h localhost -t wmbusmeters/$METER_ID -m "$METER_JSON"

/etc/wmbusmeters.d/multical21

name=Tapwater
id=<replace_with_your_id>
key=<replace_with_your_key>
driver=multical21

HomeAssistant configuration.yaml snippet:

mqtt:
  sensor:
    - name: "Tapwater total"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      unit_of_measurement: "mĀ³"
      device_class: water
      state_class: total
      value_template: "{{ value_json.total_m3 }}"

    - name: "Tapwater target"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      unit_of_measurement: "mĀ³"
      device_class: water
      state_class: total
      value_template: "{{ value_json.target_m3 }}"
    
    - name: "Tapwater temperature"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      unit_of_measurement: "Ā°C"
      device_class: temperature
      state_class: measurement
      value_template: "{{ value_json.flow_temperature_c }}"

    - name: "Tapwater external temperature"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      unit_of_measurement: "Ā°C"
      device_class: temperature
      state_class: measurement
      value_template: "{{ value_json.external_temperature_c }}"

    - name: "Tapwater time leaking"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      device_class: timestamp
      value_template: "{{ value_json.time_leaking }}"

    - name: "Tapwater time bursting"
      state_topic: "wmbusmeters/<replace_with_your_id>"
      device_class: timestamp  
      value_template: "{{ value_json.time_bursting }}"

1 Like

I figured out that actually, it is not possible to change any wmbusmeters yaml file. The only way to setup wmbusmeters is thru the configuration page in HA. There was no clear mention of that in the help files so very annoying! So I did not create any yaml configuration.
I have not figured out what is the difference between water total and water target? What does that mean, water target??
my conf is

  loglevel=normal
  device=auto:t1
  donotprobe=/dev/ttyAMA0
  logtelegrams=false
  format=json
  logfile=/dev/stdout
  shell=/wmbusmeters/mosquitto_pub.sh "wmbusmeters/$METER_NAME" "$METER_JSON"

Can u maybe tell what the logtelegrams and meterfiles difference looking at your conf file make in real life?

I see. I setup the wmbusmeters manually (since Iā€™m not using the HA plugin).

The water target seems to be the total water usage since last ā€œreadā€ by the water company.

For us, they read ā€œwater totalā€ every quarter. So ā€œwater totalā€ - ā€œwater targetā€ = usage in current period.

For reference also see these:

and

and

Hi

Is there any tools out there to decrypt / brute force the data to try to find the key? My municipality wonā€™t provide me with the decryption key. They said that with the key I could change parameters in the meter :frowning:

No. Even if there were it would be no help. Brute force would only work with dictionary attack (when real words in key are used). For guessing the alphanumerical key u have to wait 1000 yrs (if lucky) or build your own quantum computer.
Talking about changing parameters in meter is of course extremely stupid. It is the same level as watching TV show u could screw up something in the studio. The technology is exactly the same (I even use basically USB TV stick) but officials are not blessed with special intelligence, and in addition, they feel power over others, which they will not relinquish under any circumstances. It took me a whole month of correspondence simply because the clerk did not understand what was being said, recommending to simply look at the meter to find out the reading. In the end, I had to threaten with the court, and luckily then I was contacted by a local Kamstrup representative who sent the necessary files. I definitely do not dare to recommend this last method because different country, different customs!

2 Likes

thanks, I sent an e-mail to the manufacturerā€¦ long shotā€¦

regarding threat to go to courtā€¦ under what law should you be able to win? You live in EU, should be the same for me maybeā€¦

Wellā€¦ The EU is one thing, but each country still has its own laws. First of all, the claim that reading the information allows the client to somehow change the reader himself is just extraordinarily stupid and wrong. The reader sends information on a radio frequency, and the client reads it on the specified frequency. Thats all! The water company reads it exactly the same way.
In recent years, the EU has strongly emphasized that customer/user data belongs to the user, and in my opinion, denying access to it is a violation of such rights. The water readerā€™s screen does give access to current water consumption information, but this is far from all that the reader collects and transmits. In total, Multical 21 (other models are probably different) gives the data of incoming water temperature, burst, dry, leak, flow reversed, target consumption (this month), total consumption, max flow and ambient temp. This is all data that belongs to the customer according to EU ideology, which the reader transmits to the water company, but which in this case is not shared (denied) with the customer. I see here that according to data protection rules, the customer should have the right to these data, but still, each country looks at the matter from its own perspective. Finally, each country has its own legislators, laws, and understandings of how to enforce them.
I think that in my case it was easier because they didnā€™t really have a particular desire to refuse, but I was just an annoyance they were trying to get rid of.

2 Likes

Hi!
Interesting reading. My provider will certainty not provide me any keys, they is believers that iā€™m going to burn down the studio for sure. But how about reading the optical circuit, does anyone of you have any experience? Its M-bus what I understood and might be possible to get data into HA, I hope.

I found interesting reading how a magnet could activate ir eye, did a test on my Multical 21 but without any luck. 17.13 https://lafipa.lv/wp-content/uploads/2021/09/flowIQ-2101-Technical-Description-English.pdf

So question is have anyone got this working?

Best regards
Patric

I finally got the key from the municipality but it is not in the right format. wmbusmeters wants a key according to key=00112233445566778899AABBCCDDEEFF
but the key I got was of type ase-128-cbc, 512 characters: F4KA4g7oOkā€¦ad1O5njwz

Is there a way to convert it?

Edit: I found the tool in https://github.com/wmbusmeters/wmbusmeters/tree/master/utils to import the kem-file. But I also need a password, back to the municipality.

Edit2: Got it all working now

@rothman Is this in Belgium? You got the key? Iā€™m trying todo the same thing. But its not really working.

No this is in Sweden. Talk to the municipality or what kind of service how provide water. I wrote to my provider: ā€œHowever, given that we are subject to EU law and one of the GDPRā€™s core principles is transparency, ā€œRemember that those whose data you process (referred to as ā€˜the data subjectā€™ in the GDPR), have the right to know exactly what data you are collecting aboutā€ .ā€ and a couple of weeks later I got the key.

2 Likes

Have you actually tried contacting water-link (or whichever your provider is)? I am too looking for a solution to read the watermeter.

I recently came across the Kamst-IR Gateway : Kamst-IR Gateway voor Kamstrup Multical meters - SmartGateways.nl
This should be able to read the Multical 21. Does anyone have experience with this (in combination with water-link)?

Have you found a way to enable the IR communication?I had no luck so far unfortunately