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. Write Date and Time To Meter

Write Date and Time to meter

By gpatane , 19 February, 2024
Forums
Gurux.DLMS

After 2 days of unsuccessful attempts I am forced to ask for help here.
I need to update the date and time of the Landis E650 meter and I tried using this method in VB.NET:

Dim objects As GXDLMSObjectCollection = Nothing
objects = comm.GetAssociationView()
Dim it As GXDLMSObject
it = objects.FindByLN(ObjectType.Clock, "0.0.1.0.0.255")
Dim newDate As Gurux.DLMS.GXDateTime = Now
Dim Values As New GXObisValueItemCollection
Dim itemValue As New GXObisValueItem(11200, newDate)
Values.Add(itemValue)
it.SetValues(0, Values)
comm.Write(it, 2)

Something is written on the meter because the meter date is reset to 01/01/2000 00:00:00

Can you help me?
Best regards
Giacomo

Profile picture for user Kurumi

Kurumi

2 years 3 months ago

Hi, Landis+Gyr E650 doesn't…

Hi,

Landis+Gyr E650 doesn't support deviatation (Time zone).
Try to ignore it like this:

Dim newDate As Gurux.DLMS.GXDateTime = Now
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation

Now I don't remember if the second should also be set to zero. Try that is it fails.

BR,
Mikko

gpatane

2 years 3 months ago

But is this correct? (look…

But is this correct? (look under ==>)

Dim objects As GXDLMSObjectCollection = Nothing
objects = comm.GetAssociationView()
Dim it As GXDLMSObject
it = objects.FindByLN(ObjectType.Clock, "0.0.1.0.0.255")
Dim newDate As Gurux.DLMS.GXDateTime = Now
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation
==> Dim Values As New GXObisValueItemCollection
==> Dim itemValue As New GXObisValueItem(11200, newDate)
==> Values.Add(itemValue)
it.SetValues(2, Values)
comm.Write(it, 2)

gpatane

2 years 3 months ago

Now works! ' ---------------…

Now works!

' -----------------------------------------------------------------------------
' Update date and time on meter Landis E650
' The following items are to be considered prerequisites:
' [comm] is GXCommunicatation object with connection established with the meter
' [objects] is GXDLMSObjectCollection with comm.GetAssociationView()
' -----------------------------------------------------------------------------

Try

' reads the current date and time of the meter
Dim it As GXDLMSObject = objects.FindByLN(ObjectType.None, "0.0.1.0.0.255")
Dim currentMeterDate As DateTime = comm.Read(it, 2)

' reads the current date and time of the system
Dim currentSystemDate As DateTime = DateTime.Now

' difference in seconds between the system time and the meter's
Dim secondsDifference As Long = DateDiff(DateInterval.Second, currentMeterDate, currentSystemDate)

If secondsDifference <= -60 Or secondsDifference >= 60 Then
' difference greater than 60 seconds
Dim Clock1 As New GXDLMSClock("0.0.1.0.0.255", 11200) ' it is important to specify the shortname otherwise it won't work
Dim newDate As New GXDateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, 0)
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation
Clock1.Time = newDate
comm.Write(Clock1, 2)
End If

Catch ex As Exception
MsgBox(ex.ToString)
End Try

Profile picture for user Kurumi

Kurumi

2 years 3 months ago

Hi Giacomo, I'm glad that…

Hi Giacomo,

I'm glad that you solved this. You can find the clock object from association view and use it. In that way, you don't need set the short name. Something like this:

Dim it As GXDLMSObject = objects.FindByLN(ObjectType.None, "0.0.1.0.0.255")
it.Time = newDate
it.Skip = newDate.Skip And DateTimeSkips.Deviation
comm.Write(it, 2)

You can also save the association view to the database or file. That makes reading faster.

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