Good day sir,
First of all, thank you for creating this DLMS library, it makes me able to learn and know so many things from my meter. I'm able to connect to meters using settings provided by the meter provider, and read needed values from it. Currently I'm able to read meter from EDMI, since that's what I have. I used Gurux DLMS C for that.
Now I want to learn how to create a gateway, so I can be able for example connect to multiple meter.
the connection is like this:
my windows pc -- raspberry pi -- meter 1
-- meter 2
here the raspberry pi is designed to be intermediary
And I came across GuruxDLMSDataGateway. I tried to compile it, after that I run it on port 4061, using this command:
./bin/gurux.dlms.datagateway.bin -S /dev/ttyUSB6 -t Verbose -p 4061
And here's the output:
Logical Name DLMS gateway using WRAPPER in port 4061.
Example connection settings:
GuruxDLMSClientExample -h localhost -p 4061-i WRAPPER
First I set the necessary parameter :
- Client Address = 6
- Physical Server = 1
- Logical Server = 0
Now I have no experience with using gateway to connect to the meter. From what I read from this forum, I need to set Network ID and Physical device address, so I set it like this:
- checked Use Gateway checkbox
- Network ID = 0
- Physical device address = 39130062561 (not the real serial number)
But when i tried to connect using those parameter in Gurux, it only sends AARQ :
15:55:04 Send AARQ request.
TX: 00 01 00 10 00 01 00 23 E6 00 01 06 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 62 1E 5D FF FF
15:55:09 Data send failed. Try to resend 1/3
15:55:14 Data send failed. Try to resend 2/3
15:55:19 Failed to receive reply from the device in given time.
I think the problem is I don't know how to bind/attach network ID and physical device addres to a meter in the code. I modified the gateway example by duplicating svr_initObjects :
int svr_InitObjects_Edm(
dlmsServerSettings *settings,
char *meterPort,
int serverPort,
GX_TRACE_LEVEL trace)
{
// GW uses pre-established connection.
settings->info.preEstablished = 1;
serialPort = meterPort;
conCl_init(&clientCon, trace);
// Initial setting for the client connection.
cl_init(&clientCon.settings, 1, 6, 1, DLMS_AUTHENTICATION_HIGH_GMAC, NULL, DLMS_INTERFACE_TYPE_HDLC);
return oa_verify(&settings->base.objects);
}
But still nothing.
I want to follow the mechanism described here:
https://www.gurux.fi/comment/26477#comment-26477
But I don't really get how the example code work.
I need your help learning this gateway stuff, so here are my questions:
1. How does the gateway handles the incoming request from my pc, parse and get necessary APDU and send it to the meter based on network ID and physical device address?
2. How to attach the network ID and physical device address to each meter? I plan to try it with two meters with identical settings as what I have
3. Can you give hint in the code, what should i look up to and modify it?
Thank you very much for this fantastic tool, and thank you for your help.
Best regards,
hs
Hi, One of yousettings is…
Hi,
One of yousettings is different that the meter expects and the meter doesn't answer.
At first check if your meter is supporting CMAC authentication?
When you connect to the GW and the password is checked, the GW tries to establish the connection to the meter by calling connect2Client.
You need to implement the logic so that the correct authentication and block cipher keys are used.
I suggest that you try connecting with Log authentication first. They are easier when you don't take care of the keys.
BR,
Mikko