We do not have your meter so I can't test this, but usually one of following settings is wrong.
Password, Server Address, Client Address or Use Logical name referencing.
Can you connect without authentication (None)? If you can, then I believe that your client address is wrong. Client address is changing when authentication level changes.
Hi,
Below my obx file in which I put my config.
I used GXDLMSDirector and connection works fine!
So, I tried to put the same config in the obx file but it doesn't work too.
CX2000
Hi,
We do not have your meter so I can't test this, but usually one of following settings is wrong.
Password, Server Address, Client Address or Use Logical name referencing.
Can you connect without authentication (None)? If you can, then I believe that your client address is wrong. Client address is changing when authentication level changes.
BR,
Mikko
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thank you for your reply.
I think that this issue is caused from authentification. In fact, I have to use the MD5 one.
Vould you send me an example of .obx file where password is hashed with MD5?
thanks.
BR,
Badi3
CX2000
Hi,
You can create new OBIS file or select MD5 to authentication level.
Then just add password and it's done.
BR,
Mikko
Hi,
Hi,
Thank you for your reply.
I am using the project gurux.dlms.client.example.java and I updated the passowrd and set the authentification type to MD5 but it doesn't work.
Can I send you the class to double check please?
Thank you in advance.
BR,
Badi3
CX2000
Hi,
Can we access your meter using Internet? Send email to me if we can we can try to check this.
BR,
Mikko
Hi,
Hi,
Unfortunately the IP is not a public address.
Share me your e-mail and I'll send you the needed informations.
Thanks a lot.
Regards,
Hi,
Hi,
Below my main class:
package gurux.dlms.client;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.PrintWriter;
import gurux.common.IGXMedia;
import gurux.dlms.enums.Authentication;
import gurux.dlms.manufacturersettings.GXManufacturer;
import gurux.dlms.manufacturersettings.GXManufacturerCollection;
import gurux.dlms.secure.GXDLMSSecureClient;
import gurux.net.GXNet;
import gurux.net.enums.NetworkType;
import gurux.terminal.GXTerminal;
public class sampleclient {
public static void main(String[] args) {
GXCommunicate com = null;
PrintWriter logFile = null;
try {
logFile = new PrintWriter(
new BufferedWriter(new FileWriter("logFile.txt")));
com = getManufactureSettings(args);
// If help is shown.
if (com == null) {
return;
}
com.initializeConnection();
com.readAllObjects(logFile);
} catch (Exception e) {
System.out.println(e.toString());
} finally {
if (logFile != null) {
logFile.close();
}
try {
///////////////////////////////////////////////////////////////
// Disconnect.
if (com != null) {
com.close();
}
} catch (Exception Ex2) {
System.out.println(Ex2.toString());
}
}
System.out.println("Done!");
}
static GXCommunicate getManufactureSettings(String[] args)
throws Exception {
IGXMedia media = new GXNet();
GXCommunicate com;
String path = "ManufacturerSettings";
try {
if (GXManufacturerCollection.isFirstRun(path)) {
GXManufacturerCollection.updateManufactureSettings(path);
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
// 4059 is Official DLMS port.
String id = "SAG", host = "197.26.18.67", port = "4059", pw = "SAG00003";
boolean trace = false, iec = true;
Authentication auth = Authentication.HIGH_MD5;
int startBaudRate = 9600;
String number = null;
for (String it : args) {
String item = it.trim();
if (item.compareToIgnoreCase("/u") == 0) {
// Update
// Get latest manufacturer settings from Gurux web server.
GXManufacturerCollection.updateManufactureSettings(path);
} else if (item.startsWith("/m=")) {
// Manufacturer
id = item.replaceFirst("/m=", "");
} else if (item.startsWith("/h=")) {
// Host
host = item.replaceFirst("/h=", "");
} else if (item.startsWith("/p=")) {
// TCP/IP Port
media = new gurux.net.GXNet();
port = item.replaceFirst("/p=", "");
} else if (item.startsWith("/sp=")) {
// Serial Port
if (media == null) {
media = new gurux.serial.GXSerial();
}
port = item.replaceFirst("/sp=", "");
} else if (item.startsWith("/n=")) {
// Phone number for terminal.
media = new GXTerminal();
number = item.replaceFirst("/n=", "");
} else if (item.startsWith("/b=")) {
// Baud rate
startBaudRate = Integer.parseInt(item.replaceFirst("/b=", ""));
} else if (item.startsWith("/t")) {
// Are messages traced.
trace = true;
} else if (item.startsWith("/s=")) {
// Start
String tmp = item.replaceFirst("/s=", "");
iec = !tmp.toLowerCase().equals("dlms");
} else if (item.startsWith("/a=")) {
// Authentication
auth = Authentication.valueOf(
it.trim().replaceFirst("/a=", "").toUpperCase());
} else if (item.startsWith("/pw=")) {
// Password
pw = it.trim().replaceFirst("/pw=", "");
} else {
return null;
}
}
if (id.isEmpty() || port.isEmpty()
|| (media instanceof gurux.net.GXNet && host.isEmpty())) {
return null;
}
////////////////////////////////////////
// Initialize connection settings.
if (media instanceof GXNet) {
GXNet net = (GXNet) media;
net.setPort(Integer.parseInt(port));
net.setHostName(host);
net.setProtocol(NetworkType.TCP);
}
else {
throw new Exception("Unknown media type.");
}
GXDLMSSecureClient dlms = new GXDLMSSecureClient();
GXManufacturerCollection items = new GXManufacturerCollection();
GXManufacturerCollection.readManufacturerSettings(items, path);
GXManufacturer man = items.findByIdentification(id);
System.out.println("man**** "+man);
if (man == null) {
throw new RuntimeException("Invalid manufacturer.");
}
dlms.setObisCodes(man.getObisCodes());
com = new GXCommunicate(5000, dlms, man, iec, auth, pw, media);
com.Trace = trace;
dlms.setClientAddress(16);
dlms.setServerAddress(1);
return com;
}
}
Hi,
Hi,
Below my obx file in which I put my config.
I used GXDLMSDirector and connection works fine!
So, I tried to put the same config in the obx file but it doesn't work too.
<?xml version="1.0" encoding="utf-8"?>
<GXManufacturer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Identification>SAG</Identification>
<Name>SAGEMCOM</Name>
<NetworkType>TCP</NetworkType>
<UseLN>true</UseLN>
<InactivityMode>None</InactivityMode>
<WaitTime>7000</WaitTime>
<ObisCodes>
<GXObisCode>
<LogicalName>0.0.1.0.0.255</LogicalName>
<Interface>Clock</Interface>
<ObjectType>8</ObjectType>
<Attributes />
</GXObisCode>
</ObisCodes>
<StartProtocol>DLMS</StartProtocol>
<Settings>
<GXAuthentication>
<Type>HIGH_MD5</Type>
<ClientID xsi:type="xsd:unsignedByte">2</ClientID>
<Password>SAG00003</Password>
</GXAuthentication>
</Settings>
<ServerSettings>
<GXServerAddress>
<HDLCAddress>0</HDLCAddress>
<Formula />
<PhysicalAddress xsi:type="xsd:unsignedByte">16</PhysicalAddress>
<LogicalAddress>1</LogicalAddress>
</GXServerAddress>
<GXServerAddress>
<HDLCAddress>1</HDLCAddress>
<PhysicalAddress xsi:type="xsd:unsignedByte">16</PhysicalAddress>
<LogicalAddress>1</LogicalAddress>
</GXServerAddress>
<GXServerAddress>
<HDLCAddress>2</HDLCAddress>
<PhysicalAddress xsi:type="xsd:unsignedByte">16</PhysicalAddress>
<LogicalAddress>1</LogicalAddress>
</GXServerAddress>
</ServerSettings>
</GXManufacturer>
Any Help please?!!
BR,
Badi3