-
Notifications
You must be signed in to change notification settings - Fork 44
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
HDLC over IP #37
Comments
Hi. That depends on the meter. What brand and model are you using. Newer meters probably have direct HDLC on the optical port, but if you are using an RS converter I am guessing you have fixed contacts that you have connected to. Is it IDIS conformant? Should be printed on it. On some meters you need to start with IEC62056-21 and use the Mode E to transfer the meter into the HDLC state. |
Hi, it's apator norax3. I found this: so i guess that this meter supports direct hdlc. I can easily do readout with IEC using rs converter set to 7E1. Now i try to implement dlms. My very first scripts look like this read current client invocation counterwith DlmsClient.with_tcp_transport( |
OK. So the conformance testing of DLMS doesn't say much. It could still be that the device they tested with had direct HDLC enabled and yours does not. There can be 2 issues in your setup.
You are saying you get an answer on IEC62056-21? What does it answer? But the protocol is like this. -> you ask the meter to logon: Now you should be able to do HDLC communication with the meter.
But your problem is that you are using a TCP/IP converter sending serial data over TCP. and the converting it to serial at the meter. Subclass HdlcTransport and override the functions below to use a socket instead: def _write_bytes(self, to_write: bytes):
...
def _read_frame(self)
... |
Hi which version of HLS authentication is implemented in library ? |
HLS-GMAC. I haven't been able to get hold of any meter that use something else. |
Is everything progressing ok? |
Closing due to inactivity. |
Hello, sorry for inactivity. I can not put meter in mode E using IEC62056 library. When I set mod_char to "2" binary the meter responds with standard readout data.
|
Hi. No problem. It might be a good idea to switch this issue over to the iec62056-21 repo as it seems to be a feature that is missing there. The second readout with 8N1 is probably just that the bytes becomes wrong and the library cant find the end byte and stop the readout. So for setting the meter in mode E. -> b'/?!\r\n' There is a small note in the README of ice62056-21 that we assume protocol mode "normal". I had to look it up, but to change the meter into mode E we need to use protocol mode "HDLC protocol". To do that the following needs to be sent. -> b'/?!\r\n' The problem is that I hardcoded the protocol mode in the iec62056-21 library to normal mode: class AckOptionSelectMessage(Iec6205621Data):
"""
Only support protocol mode 0: Normal
"""
def __init__(self, baud_char, mode_char):
self.baud_char = baud_char
self.mode_char = mode_char
def to_representation(self):
return f"{constants.ACK}0{self.baud_char}{self.mode_char}{constants.LINE_END}" So try sending in the correct bytes by hand for now and raise an issue in iec62056-21 to support protocol mode = 2 in AckOptionSelectMessage |
I ended up needing this and implemented the capability in the above PR - figured I'd share if useful. Not sure it's the most beautiful implementation but it seems to do the job. Unfortunately the meter I'm reading uses short name referencing, so shortly after connecting to it using this HDLC+TCP implementation I hit #50. Therefore I guess it's back to using the Gurux DLMS library - which does support SN, but is otherwise a bit of a mess, so was hoping to avoid... |
I have separated the IO from Transports in the upcoming release. So you can just add a TcpIO or SerialIO for the HDLC-Transport so it is possible to run HDLC over TCP. And it is implemented in a more extensible way. Thanks for the PR but I had another implementation in mind. And for SN support we really need someone to sponsor the development as we have never had the need for it. |
Hello,
im trying to connect with the meter via rs converter. It should be 7E1 or 8N1 in config ?
Is encryption key and authentication key necessery to read from the meter ?
The text was updated successfully, but these errors were encountered: