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

Request: Support for Kamstrup Omnipower meters using GPK11 encryption key #126

Closed
heinekmadsen opened this issue Oct 6, 2021 · 255 comments
Closed

Comments

@heinekmadsen
Copy link

Hi...

I'm not sure this is even possible, as i have no deeper knowledge into this topic.
The case is, that i bought a Pow-K (Kamstrup) module from amsleser.no.
I have fittet it into my Kamstrup OmniPower meter and have supplied the GPK60 and GPK61 keys, but i get no data.

According to my power provider they state that it works with the Smart-Me modules using GPK11 key.
the provider does not have access to that part of the Kamstrup software where they can enable that feature.

So my request is, can this software use a GPK11 key to get data?

@ArnieO
Copy link
Contributor

ArnieO commented Oct 6, 2021

I propose we first establish whether the meter provides data at all, as there has been cases of meters not having the HAN port open despite the grid company insistance. Does the LED show a blue light flickering for around 1 second every 10 seconds?

@heinekmadsen
Copy link
Author

Theres a red flash every 2-3 seconds, and the HAN status In the web ui is red.

@ArnieO
Copy link
Contributor

ArnieO commented Oct 7, 2021

If there are no blue flashes there is no incoming data. The red flashes indicate the same as the red HAN status. There is a similar case in one of the threads here, the problem turned out to be that the port was not activated after all.

@ArnieO
Copy link
Contributor

ArnieO commented Oct 7, 2021

Here: #115

@heinekmadsen
Copy link
Author

If using a multimeter to test if my meter is sending data, then what should i expect to read?
I assume i need to measure between pin 5 and 6.

@ArnieO
Copy link
Contributor

ArnieO commented Oct 8, 2021

Correct. Looking into the meter you will measure between pins 5 and 6:
image

If the meter is open, the voltage on pin 5 will be 3,3V for around 9 seconds, then a data frame (voltage jumping between 0 and 3,3V; on a multimeter you will just see that the voltage is not stable) that lasts for around 1 second. There is one such data frame each 10 seconds.

@heinekmadsen
Copy link
Author

And is that the same data that a Smart-me module would utilize? or is it another type of data?
I Assume data is pushed and not pulled from the meter? is that the same for the smart-me modules?

@ArnieO
Copy link
Contributor

ArnieO commented Oct 8, 2021

Data is pushed from the meter, not pulled. The DATA_IN pin (2) is not used.
It is only on pin 5 data is delivered from the meter, so the Smart-me module must use the same pin and same data.

@heinekmadsen
Copy link
Author

So...
I hooked up some jump wires to the pins and my multimeter. Used my phone to record a video of the multimeter for 35 seconds.

Result: a steady 3,29v for the whole 35 seconds. Not a single deviation at all.

I assume this means no data is being sent from the meter. And if I used a smart-me module it wouldn't work either, correct?

According to the grid company my meter should be ready for a smart-me module, but it doesn't makes sense to me at all.

@ArnieO
Copy link
Contributor

ArnieO commented Oct 9, 2021

So - no data. You seem to have the same situation as the guy in #115

I would contact the grid company and ask them to double check that the HAN port is acivated.

@heinekmadsen
Copy link
Author

well.. decided to buy a smart-me module for testing... then I can tell the grid company, that even though they say a smart-me module will work, it doesn't (Or probably wont work) They state they don't have access to the feature in the Kamstrup software to enable/disable the HAN port, but a smart-me module works........... without data?

@ArnieO
Copy link
Contributor

ArnieO commented Oct 13, 2021

Sounds like an expensive way to prove there is no data. I think the other guy was in contact with Kamstrup directly in some way. Maybe ask him in the other thread?

@heinekmadsen
Copy link
Author

heinekmadsen commented Oct 14, 2021 via email

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

Well, this was surprising. There are around twenty Pow-K boards running in Denmark now, and I have not seen this problem before.

The only idea I can think of is that the meter needs an "enable" signal on an input pin to ensure the meter outputs data. This is not specified for the Kamstrup meters, but is used in the IEC 62056-21 interface standard used in for instance Sweden and Netherlands (see my overview here). Those interfaces have a "Request" input that must be set high from the device in order to get data from the meter.

The Kamstrup meter has one input pin, see this document, which is pin 2 (figure 5):
image

The document states (page 9) that pin 2 is pulled high inside the meter by an 82k resistor. It also states that the pin is used for "serial communication of data to the meter", which is in most countries not used (disabled in the meter firmware, I assume) - to eliminate the possibility of the user being able to do whatever could be done from this port. This is why I chose to have pin 2 on Pow-K not connected.

Now I can only speculate:

  • I assume you are 100% sure that you measured on the correct pins a stable (approx) 3,3V.
  • IF the Kamstrup meter needs the input pin to be high to enable HAN port data AND there is an error on that input on your meter (pullup resistor missing or wrong value?) AND the creators of the Smart-me decided to connect this pin to a high signal to be on the safe side THEN pulling pin 2 high on the Pow-K board could resolve the issue, causing the meter to deliver data.

However, pin 2 is specified for maximum voltage of 3,3V, so you cannot connect it to pin 1.

This is what you could do if you're comfortable with trying this and have access to a suitable resistor:

Connect a resistor (I would try 10k, but anything smaller than than 82k should work) between connector pin 2 and 3,3V on the Pow-K board. If you're equipped to solder it in that is fine, just be careful not to short circuit the connector pins, and also do not apply too much heat close to the large capacitor!
Like this:
image
If you are not equipped for soldering, try to twist the leads of the resistor in place, and be sure that there is no short circuit to other pins of the connector.

(Note that there is an unfortunate error on the silkscreen of the card: Vcc and GND on the large capacitor are switched.)

@heinekmadsen
Copy link
Author

Thanks for that really nice and detailed reply! :)

I'm fairly confident in soldering things. Can you possibly link me to a resistor? Just so I order the correct one :)

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

I would recommend a small kit, like this one: https://elektronik-lavpris.dk/p95985/k-res-e3-modstandssortiment-e3-480-stk/

(I am not familiar with Danish webshops for components, this was just the first one I found on google - there might be others that are better of cheaper, I have no idea. There might also be stores close to you where you can get such stuff.)

@heinekmadsen
Copy link
Author

Great.. just ordered...

I might have some resistors laying around bit will have to check their values.

I also assume i need to discharge the super-cap before doing anything... any how-to's on that? or should i just leave it unplugged for some time?

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

Yes, that is the safe and simple way - just leave it unplugged for some time. It will self discharge.
If you want to speed up the discharge, connect a (not much smaller than) 100 ohm resistor across the legs of the capacitor.
The voltage will in both cases decrease asymptotically, and faster with a resistor.

@heinekmadsen
Copy link
Author

Will this be sufficient?
image

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

Yes that will work.
I recommend measuring it with a multimeter to be sure of the value.

In fact you could connect just a wire (no resistance), but in case you make a mistake with the connection it is safer to use a resistor.

@heinekmadsen
Copy link
Author

I found a 10k ohm, but still no cigar 🤥 image

Should I try some higher ohm resistor?

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

That looks good.
Still no blue flashing on the LED?

@heinekmadsen
Copy link
Author

heinekmadsen commented Oct 14, 2021

Still no blue flashing, only red flashes and red status in the ui

@ArnieO
Copy link
Contributor

ArnieO commented Oct 14, 2021

What makes this strange is that what you reported earlier (multimeter measurement) indicates that there is no data coming from the meter. However, the Smart-me unit works as expected and reads data from the meter.

The blue pin on the LED is directly connected to the incoming data signal, so it will flash providing there is voltage on the board. Which there clearly is - as the ESP8266 is up and running, generates the UI and generates red flashes on the LED.

So let us assume the board does receive data from the meter, and look for potential errors that could prevent the blue LED from flashing. Could you be so kind as to check two points:

  1. The pin distance on the LED (D1) is very small, so I take great care to verify after soldering that there is no short circuit between pins. Can you check with ohmmeter the resistance between pin 3 and 4 on the LED? And if you have a good magnifying glass, check if you see any indication of a short circuit between them? The blue pin is pin 4, green is pin 3. If there is a short circuit between those, the signal to the green LED would interfere with the data signal. See below indications of D1 pins 3 and 4.
  2. This should not prevent the blue LED from flashing, but is still a point to check: I did have a bad batch of voltage regulators (U1) in the period I made that board - but I did not think I had shipped any board with bad U1. I can see you make good photos: Can you send me a photo showing the marking on U1? The "bad apples" are easy to identify from the marking.

image
image

@heinekmadsen
Copy link
Author

So i tried checking the led... I can't measure any short circuit....
I tried taking some pictures and a video when it's in the meter
image
image
https://user-images.githubusercontent.com/48906528/137384870-450b283f-cbae-4466-995e-a8fc9d39fc8d.MOV

Just thinking out loud and with minimal knowledge about the meters... could I be that the smart me module gets the data from the meter wirelessly?

And why does it only need one gpk key and the amstomqtt needs two gpk keys?

@gskjold
Copy link
Member

gskjold commented Oct 15, 2021

Regarding the keys: #73 (comment)

Just thinking out loud here, could it be that the smart-me module asks the meter for data rather than passively receiving?

@heinekmadsen
Copy link
Author

@gskjold not sure how to tie this with #73... But... i do recall that i might have read somewhere on the internet, that smart-me works by pull and amstomqttbridge works with push'ed data.

Would i be possible to implement a pull meter to the amstomqttbridge?
At first just for a POC (Need to return my smart-me module within 10 days :D )

@gskjold
Copy link
Member

gskjold commented Oct 15, 2021

Quote from the linked comment from #73 : "It seems the key they provided me was for the Smart-Me module. They're looking into getting me the other keys now."

If we are to implement data pull from the meter, I would need to know how to handshake the meter to receive data. If you have found any information related to this, let me know.

@heinekmadsen
Copy link
Author

Well.. that might be a dead-end :(
https://www.ihc-user.dk/forum/forums/topic/7467-kamstrup-elm%C3%A5lere/?do=findComment&comment=58737

A KMP protocol... Will try to reach out to Kamstrup and see if they are willing to hand out some documentation for this protocol.

@gskjold
Copy link
Member

gskjold commented Oct 15, 2021

I think you are better of asking your grid company for the GPK60/61 keys instead, like @mikfoo did.

Referencing this for the future (in case we ever figure out how this works): https://github.com/MTrab/Kamstrup

@ArnieO is the meters RX pin connected on Pow-K at all?

@jlaur
Copy link

jlaur commented Dec 17, 2022

HAN is now working on N1 in Denmark

@lmcemaj - how do you request the needed keys? I just ordered a Pow-K+, so now would like to prepare for receiving and installing it. :-)

@lmcemaj
Copy link

lmcemaj commented Dec 18, 2022

I just wrote an email to them

@jlaur
Copy link

jlaur commented Dec 29, 2022

Should Pow-K+ be powered through microUSB when used with Kamstrup OMNIPOWER? Manual says:

  1. Pow-K: Plug your device into the meter.
    Pow-U / Pow-P1: Power your device by the USB socket.

But since Pow-K is not the same as Pow-K+ I'm in doubt. This is my meter:

image

and this appears to be my problem:

image

image

Seems like approximately 5 mm for the microUSB connector. And they are usually several cm.

Did anyone successfully install this module in DIN-rail OMNIPOWER meter?

@ArnieO - perhaps you could help/elaborate? Unfortunately I didn't foresee this and can't seem to find detailed mounting instructions in the different manuals I downloaded.

@ArnieO
Copy link
Contributor

ArnieO commented Dec 29, 2022

@jlaur Pow-K and Pow-K+ take the power they need from the meter. The USB connector can be used if you want to power it on its own for configuration. It can also be used for reflashing the ESP if needed.

There is a QR code on the protective bag that takes you to this video. It shows how to install and configure it: https://amsleser.no/blog/post/17-video-how-to-install-and-configure-your-pow-k

@martin-tastensen
Copy link

@ArnieO Just wanted to add that Dinel A/S supports both GPK11 (pull) and DLMS/COSEM - GPK60/61 (push), at least for my Kamstrup Omnipower :)

https://ens.dk/sites/ens.dk/files/Statistik/elnetgraenser.pdf

@emilstahl Yes, there is no problem with Kamstrup Omnipower meters. It is the older Kamstrup meters that is the issue, they have a different firmware, and cannot be configured for "Push".

I'm curious. I was fairly sure that mine was a Kamstrup Omnipower meter, and since my house is from 2016 i expected it to be "new enough". Are there an age cap on the Kamstrup Omnipower meters for it to be supported?

Dinel just informed me:

"Den måler du har installeret understøtter kun KMP protokollen via HAN modulet. Data er ikke krypteret.
Skal data udlæses via DLMS skal det optiske øje benyttes."

Which roughly translated means:

The installed meter only supports the KMP protocol, using the HAN module. The data is not encrypted.
If you wish to use DLMS then you have to use the optic eye.

I suspect the optic eye being the blinking light on the front.

From what i can read here, KMP is proprietary and won't be supported - which leaves me with a bit of a dissapointment :|

@jgrau
Copy link

jgrau commented Jan 23, 2023

I'm curious. I was fairly sure that mine was a Kamstrup Omnipower meter, and since my house is from 2016 i expected it to be "new enough"

AFAIC it's not about "how new your installation is" but "how new the installations in the area" is. Dinel told me that it's because the meters communicate with each other so can't install a "meter model x" in an area where all the other meters are "model y"... :) But I'm no expert...

I'm pretty sure the Omnipower meters says "Omnipower" on them. I recently had my meter replaced and they still installed a model 382MxG.

@martin-tastensen
Copy link

I'm curious. I was fairly sure that mine was a Kamstrup Omnipower meter, and since my house is from 2016 i expected it to be "new enough"

AFAIC it's not about "how new your installation is" but "how new the installations in the area" is. Dinel told me that it's because the meters communicate with each other so can't install a "meter model x" in an area where all the other meters are "model y"... :) But I'm no expert...

I'm pretty sure the Omnipower meters says "Omnipower" on them. I recently had my meter replaced and they still installed a model 382MxG.

That makes sense - Might be me, but i thought the 382MxG was an Omnipower device, and that Omnipower was basically an umbrella with multiple devices in a series.

This was based on the official "sales material" stating
Consumer Communication Channel-modulport
Åben port til kommunikationsmodul til trådløs kommunikation med energidisplays og
smart-home-udstyr.

Traslated
Open port for communicationsmodule for wireless communication with energydisplays and smart-home equipment.

turns out there was a port, but apparantly not that "open" as i expected :) So seems i took a wrong conclusion somewhere.

@Sonnengruesser
Copy link

Trying to return to the issue title....

Is there anything we can do to make the GPK11 work?
It's nice of your energy companies to provide other keys as well. My provider is not able to (seems lack of technical knowledge and missing will). So this issue is still open, even if a lot of other things are resolved here.
Sorry for getting a bit frustrated...

@ArnieO
Copy link
Contributor

ArnieO commented Mar 6, 2023

Trying to return to the issue title....

Is there anything we can do to make the GPK11 work? It's nice of your energy companies to provide other keys as well. My provider is not able to (seems lack of technical knowledge and missing will). So this issue is still open, even if a lot of other things are resolved here. Sorry for getting a bit frustrated...

I share your frustration, and understand there is a large number of "older" Kamstrup meters in Denmark that cannot be configured for Data push (which is the core issue).

We will discuss the subject internally and get back to you in this thread.

@ArnieO
Copy link
Contributor

ArnieO commented Sep 26, 2023

Update as promised:

Following a technical dialogue with Kamstrup, we see a potential way to solve this.
This is "Work in progress" for the time being - and (on the condition that we manage to solve it) will be introduced on the next Pow-K board that we expect to launch late Q4/23.
Previous and current designs will not be compatible.

The need for this update has increased since this discussion started, as we have learned that the solution from Smart-Me is no longer available.

@erathor82
Copy link

Update as promised:

Following a technical dialogue with Kamstrup, we see a potential way to solve this. This is "Work in progress" for the time being - and (on the condition that we manage to solve it) will be introduced on the next Pow-K board that we expect to launch late Q4/23. Previous and current designs will not be compatible.

The need for this update has increased since this discussion started, as we have learned that the solution from Smart-Me is no longer available.

Sounds good and definantly interested in trying it out. 👍

@gskjold
Copy link
Member

gskjold commented Oct 28, 2023

Question, does anyone of you have the GPK11 key? I am wondering if this is a HEX formatted key or just plain text.
Currently working on a possible solution and need to know if I am on the right path

@Sonnengruesser
Copy link

Sonnengruesser commented Oct 28, 2023

In this video the guy says he received the key via email an just copy/pastes it into the textfield.
So 34 characters in plain text.
Edit: around 1:00

@gskjold
Copy link
Member

gskjold commented Oct 28, 2023

Perfect, thanks, this is text yes, but represents HEX. Now I know what I am dealing with at least

@tauchmi
Copy link

tauchmi commented Dec 18, 2023

Hi there,

I also do have a Kamstrup Omnipower 3 phase smart meter in Austria. My (rather small) energy provider has no knowledge about the HAN interface and told me to contact Kamstrup directly. I sent them my serial number and the name of the energy provider and received following answer:

leider kann bei Ihrem Zähler keine HAN-Aktivierung erfolgen, da der Zähler eine nicht passende Firmware besitzt (Upgrade nicht möglich).

Unfortunately the HAN port can not be activated on your meter as the firmware is not suitable (upgrade not possible).

Will the new solution work for this meter?
omnipower

@Noschvie
Copy link

Your energy provider have to replace the smartmeter in case no HAN port is supported.

@ArnieO
Copy link
Contributor

ArnieO commented Dec 18, 2023

Hi there,

I also do have a Kamstrup Omnipower 3 phase smart meter in Austria. My (rather small) energy provider has no knowledge about the HAN interface and told me to contact Kamstrup directly. I sent them my serial number and the name of the energy provider and received following answer:

leider kann bei Ihrem Zähler keine HAN-Aktivierung erfolgen, da der Zähler eine nicht passende Firmware besitzt (Upgrade nicht möglich).

Unfortunately the HAN port can not be activated on your meter as the firmware is not suitable (upgrade not possible).

Will the new solution work for this meter?

I believe you have edited the photo.
To answer, I need the model number - which is in this location:
image

@Sonnengruesser
Copy link

Hi @tauchmi,
seems your energy provider was also one of the early ones in Austria (same as mine).
I got the same reply, but found out that "HAN port not activated" means that data push is not activated. You can however communicate with the device and request data via the HAN port. I was able to read meter number etc. via RS232 converter and a tool called GuruX.
Unfortunately the interesting data is encrypted with the GPK11 key, so I'm also waiting for the solution here.
I guess you got the same firmware version - so keep our fingers crossed.

@ArnieO
Copy link
Contributor

ArnieO commented Dec 18, 2023

@Sonnengruesser @tauchmi : Are your meters a Kamstrup Omnipower model 382MxG?
If so, we do not have a solution for them yet (even if you obtain the encryption keys).

We are working on finding a solution, as there is a large number of such meters in Denmark that we want to be able to serve. The challenge is that model 382MxG cannot be upgraded to do data push. The only option to read from them is by using a Kamstrup proprietary protocol (KMP).

We have tried reading them by using DLMS protocol - but as @Sonnengruesser points out: To access the interesting data, a special encryption key is needed that the grid companies do not have access to. So that turned out to be a dead end. 😞

We are now reverting our efforts towards using KMP. The challenge is that we need to sign an NDA with Kamstrup that does not allow us to publish source code that shows the implementation of the KMP protocol. We are looking into solving that by not publishing that sensitive part of the source code, but instead linking in a compiled binary section for that part.

This means that users that need code for 382MxG will probably not be able to build the binary from source. This is currently the best compromise solution we see, given the need to use the KMP protocol for those meters.

(To those of you that now want to point out that some individuals have already published Python code etc. for the KMP protocol on private Github repos: Yes, we know that. But we are running this as a business, so we cannot work like that. And we want to maintain a good relationship with Kamstrup.)

@tauchmi
Copy link

tauchmi commented Dec 18, 2023

Hi there,
I also do have a Kamstrup Omnipower 3 phase smart meter in Austria. My (rather small) energy provider has no knowledge about the HAN interface and told me to contact Kamstrup directly. I sent them my serial number and the name of the energy provider and received following answer:
leider kann bei Ihrem Zähler keine HAN-Aktivierung erfolgen, da der Zähler eine nicht passende Firmware besitzt (Upgrade nicht möglich).
Unfortunately the HAN port can not be activated on your meter as the firmware is not suitable (upgrade not possible).
Will the new solution work for this meter?

I believe you have edited the photo. To answer, I need the model number - which is in this location: image

It is 684-11-31A-N24-3101-056

@ArnieO
Copy link
Contributor

ArnieO commented Dec 19, 2023

It is 684-11-31A-N24-3101-056

Thank you!
I am puzzled. This is a common, modern Kamstrup meter, you will find it on our list here: https://github.com/UtilitechAS/amsreader-firmware/wiki/Known-hardware-configurations

So I simply do not understand the message you received from your grid company.

My Kamstrup model number is 684-11-31B-N24-3101-040, just as an indication.

@tauchmi
Copy link

tauchmi commented Dec 19, 2023

The message was from Kamstrup Austria. I can only guess, maybe they don't care because my energy provider is too small?

I will try to get more information.

@ArnieO
Copy link
Contributor

ArnieO commented Dec 19, 2023

The message was from Kamstrup Austria. I can only guess, maybe they don't care because my energy provider is too small?

I will try to get more information.

You're right, I misread your first message - sorry for that. That answer was from Kamstrup Austria.
It could indeed be that your energy provider has not bought that part of the package from Kamstrup, so that firmware upgrade is indeed not possible. In that case, your energy provider should be able to answer.

There was a similar situation in some Danish grid companies two years ago: The meters could not be upgraded to do "Data push", and a proprietary protocol was needed to read them. It is resolved now, probably because Danish legislation required "open protocol" on the HAN ports, so I think (but not 100% sure) what happened is that the grid companies upgraded their service agreement with Kamstrup, and the meters were then upgraded to do Data push.

@chmadkk
Copy link

chmadkk commented Dec 19, 2023 via email

@ArnieO
Copy link
Contributor

ArnieO commented Dec 19, 2023

Still a problem for many danish smaller grid providers. I have one of the legacy 382m meters. It only supports pull. And KMP protocol. So im using an esphome based solution until they decide to change the meters

Correct, the 382 meters cannot do data push. We're working on finding a solution to read them. #126 (comment)

@ArnieO ArnieO closed this as completed Jan 28, 2024
@ArnieO
Copy link
Contributor

ArnieO commented Jan 28, 2024

Update regarding supporting Kamstrup 382M meters will be provided in this thread: #725

@ArnieO
Copy link
Contributor

ArnieO commented Jun 4, 2024

Will the new solution work for this meter?

@tauchmi : We are now getting close to finding a solution for the Kamstrup 385M meters, see #725 (comment).

So we would like to find out whether this solution can also be used on your Kamstrup Omnipower 684-11-31B-N24-3101-040, which Kamstrup Austria has said cannot be upgraded to push data.

Do you have a contact point at Kamstrup Austria, or can you help us with the dialogue (mein Deutsch ist leider ganz sclecht...)?

EDIT: Followed up here: #725 (reply in thread)

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

No branches or pull requests