Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Invoke Command To Meter

Invoke Command to Meter

By akshy , 18 July, 2023
Forums
Gurux.Net

Blow is the sample code I want o invoke command to meter how i can achieve,
0x01 is on and 0x02 is off like this

static void SendDlmsCommand(string ipAddress, int port, string logicalName, string command)
{
GXDLMSClient client = new GXDLMSClient();
client.IPAddress = ipAddress;
client.Port = port;

try
{
// Connect to the smart meter.
client.Open();

// Authenticate if needed.
// ...

// Select the desired object by logical name.
GXDLMSObject meter = client.Select(logicalName);

// Invoke the command on the meter.
GXReplyData reply = client.Action(meter, command);

// Handle the response from the meter.
// ...

Console.WriteLine("Command sent successfully.");
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
finally
{
client.Close();
}
}

Profile picture for user Kurumi

Kurumi

2 years 11 months ago

Hi, That depends on the…

Hi,

That depends on the object that you want to invoke, but you can use Method.
Something like this:

GXReplyData reply = client.Method(meter, 1, null);

BR,
Mikko

akshy

2 years 11 months ago

Which method I want to call…

Which method I want to call exactly can you please provide a sample code or class.

Profile picture for user Kurumi

Kurumi

2 years 11 months ago

Hi, That depends on the…

Hi,

That depends on the object that you want to invoke. WHat object you want to use?

BR,
Mikko

akshy

2 years 11 months ago

see 0x01 is On command or…

see 0x01 is On command or 0x02 is off Command, I want to send to client how I can do this

Profile picture for user Kurumi

Kurumi

2 years 11 months ago

Hi, You don't send just on…

Hi,

You don't send just on or off command. You need to define what COSEM object you want to use. For that reason, you need to know the logical name and object type.

BR,
Mikko

akshy

2 years 11 months ago

could you please provide a…

could you please provide a sample code for execute off or on command it would be save my time.

Profile picture for user Kurumi

Kurumi

2 years 10 months ago

Hi, I assume that you want…

Hi,

I assume that you want to use Disconnect control to open and close the valve.

GXDLMSDisconnectControl dc = new GXDLMSDisconnectControl();
ReadDataBlock(dc.RemoteDisconnect(client));

ReadDataBlock(dc.RemoteReconnect(client));

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin