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. Forums
  3. How To Write(date and Time) Single Action Scheduler Using Ansi C.

how to write(date and time) single action scheduler using ansi C.

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Mohanraj , 1 May, 2020
Forums
General discussion

Hi Mikko,

could please tell the process i.e what are classes to be intiated for single action scheduler?
is there a sample code for this like com_updateClock()?. please provide

Thanks
Mohan Raj

Profile picture for user Kurumi

Kurumi

6 years 1 month ago

Hi Mohan,

Hi Mohan,

You can add new execution time like described here:
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSActionSchedule

BR,
Mikko

Mohanraj

6 years 1 month ago

In reply to Hi Mohan, by Kurumi

Hi Mikko,

Hi Mikko,
Thanks for the reply. I just followed the link and came up with below code snippet.
gxActionSchedule actionSchedule;
gxtime* tm;
unsigned char target[6] = { 0, 0, 10, 0, 1,255 };
const unsigned char ln[6] = { 0,0,15,0,0,255 };
cosem_init2((gxObject*)&actionSchedule, DLMS_OBJECT_TYPE_ACTION_SCHEDULE, ln);
memcpy(&actionSchedule.executedScriptLogicalName[0], target, 6);
actionSchedule.executedScriptSelector = 1;
actionSchedule.type = DLMS_SINGLE_ACTION_SCHEDULE_TYPE1;
tm = (gxtime*)malloc(sizeof(gxtime));
time_now(tm);
arr_push(&actionSchedule.executionTime, tm);
ret = com_write(connection, &actionSchedule.base, 4);
if (ret != DLMS_ERROR_CODE_OK)
{
return ret;
}

But it throws "Access Error : Device reports a inconsistent Class or Object."

here is the trace

./bin/gurux.dlms.client.bin -S /dev/ttyUSB0 -c 48 -s 1 -a High -P "0000000001035820" -C "AuthenticationEncryption" -g "0.0.0.1.0.255:2" -v "0.0.43.1.3.255" -t "Verbose" -I
updateInvocationCounter
TX: 7E A0 07 03 21 93 0F 01 7E
RX: FF F0 7E A0 1E 21 03 73 C3 7A 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
TX: 7E A0 2B 03 21 10 FB AF E6 E6 00 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 00 1E 1D FF FF C5 E4 7E
RX: FF F0 7E A0 37 21 03 30 6C 7C E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 02 30 00 07 B2 6C 7E
TX: 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 81 00 01 00 00 2B 01 03 FF 02 00 B5 67 7E
RX: FF F0 7E A0 15 21 03 52 5D 8A E6 E7 00 C4 01 81 00 06 AC 14 8C 3A 33 B7 7E
Invocation counter: -1407939525 (0xFFFFFFFFAC148C3B)
TX: 7E A0 07 03 21 53 03 C7 7E
RX: FF F0 7E A0 1E 21 03 73 C3 7A 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
InitializeConnection
TX: 7E A0 07 03 61 93 69 47 7E
RX: FF F0 7E A0 1E 61 03 73 B5 7C 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E
TX: 7E A0 6B 03 61 10 2A FF E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 41 42 43 44 45 46 47 48 8A 02 07 80 8B 07 60 85 74 05 08 02 02 AC 12 80 10 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 23 04 21 21 1F 30 AC 14 8C 3B C5 6E 6C EC C5 D0 5C E9 54 96 D6 72 FC 2A 46 07 FF 49 E6 F6 C4 58 32 90 A4 64 0A 68 7E
RX: FF F0 7E A0 77 61 03 30 AD 6C E6 E7 00 61 69 A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 00 A3 05 A1 03 02 01 0E A4 0A 04 08 4C 4E 54 39 30 38 33 34 88 02 07 80 89 07 60 85 74 05 08 02 02 AA 12 80 10 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 BE 23 04 21 28 1F 30 00 00 06 F8 47 2D 3C A8 A7 72 2C 44 10 6C E1 17 D7 8E A5 26 02 6D 61 45 F3 A8 D0 DA 9C BC 77 AA 7E
TX: 7E A0 3E 03 61 32 7B 46 E6 E6 00 CB 30 30 AC 14 8C 3C BF 96 83 ED 87 38 E1 99 53 52 04 F8 08 BB ED 28 D2 45 B2 CE 61 94 D9 05 FE F1 43 03 18 83 7B 67 84 BB 96 27 E9 CB 14 D3 12 40 AF 40 BB 7E
RX: FF F0 7E A0 37 61 03 52 0E 3A E6 E7 00 CF 29 30 00 00 06 F9 1C C6 63 C9 14 B3 35 7C EB 98 C7 60 E7 F6 6A 98 86 0A 47 5F E4 6E 6F A1 A3 33 4B B5 93 53 30 27 B9 70 47 91 A9 43 7E
Writing action scheduler
TX: 7E A0 3D 03 61 54 86 65 E6 E6 00 C9 2F 30 AC 14 8C 3E D8 74 CA B7 83 C8 0A 97 B8 1F D5 26 39 68 17 EB 3E 85 50 3D CA 6C 21 AC D7 EE F1 5D 97 58 94 24 DB E4 AB E1 7F 85 94 32 E0 BF 7D 98 7E
RX: FF F0 7E A0 23 61 03 74 77 CF E6 E7 00 CD 15 30 00 00 06 FA F8 A4 7A 1B 08 A7 FA EE 66 21 40 32 75 5E A1 36 57 39 7E
Write failed ActionSchedule 00.00.15.00.00.255:4 Access Error : Device reports a inconsistent Class or Object.

Please correct what is going wrong.

Thanks
Mohan Raj

Profile picture for user Kurumi

Kurumi

6 years 1 month ago

Hi Mohan,

Hi Mohan,

Can you try to read this action schedule first? Is that succeeded?

BR,
Mikko

Mohanraj

6 years 1 month ago

In reply to Hi Mohan, by Kurumi

Hi Mikko,

Hi Mikko,

Yes am able to read successfully. from that only we have found script logical name of it.

Thanks
Mohan Raj

Mohanraj

6 years 1 month ago

In reply to Hi Mikko, by Mohanraj

Hi Mikko,

Hi Mikko,

with below commands we are able to read

./bin/gurux.dlms.client.bin -S /dev/ttyUSB0 -c 48 -s 1 -a High -P "0000000001035820" -C "AuthenticationEncryption" -g "0.0.15.0.0.255:4" -v "0.0.43.1.3.255" -t "Verbose" -I

below is the trace
-------- Reading Object ActionSchedule 00.00.15.00.00.255
TX: 7E A0 2C 03 61 BE C8 F2 E6 E6 00 C8 1E 30 AC 14 8C 7E 8D F6 6C ED 8C C2 F2 7A 37 DC 13 54 43 3B 5B 15 76 F1 D8 7A 8B FE 5F DA 28 3E F6 7E
RX: 7E A0 2C 03 61 BE C8 F2 E6 E6 00 C8 1E 30 AC 14 8C 7E 8D F6 6C ED 8C C2 F2 7A 37 DC 13 54 43 3B 5B 15 76 F1 D8 7A 8B FE 5F DA 28 3E F6 7E 7E A0 34 61 03 1A 8F D1 E6 E7 00 CC 26 30 00 00 07 1D 1F 48 A2 17 A8 45 29 67 02 C7 21 B9 0A A5 A8 81 F4 C7 1E 63 60 39 10 97 71 09 3F 6D 59 14 76 13 F8 0C 8A 7E
Index: 2 Value: 00.00.00.00.00.00 0
Index: 3 Value: 0
Index: 4 Value: [/01 00:00:00]
TX: 7E A0 07 03 61 53 65 81 7E
RX: 7E A0 07 03 61 53 65 81 7E 7E A0 1E 61 03 73 B5 7C 81 80 12 05 01 80 06 01 80 07 04 00 00 00 01 08 04 00 00 00 01 53 3B 7E

Thanks
Mohan Raj

Profile picture for user Kurumi

Kurumi

6 years 1 month ago

Hi,

Hi,

Try to change time_now(tm);
to
time_init(tm, -1, -1, 1, 0, 0, 0, 0, 0);

If it fails, can you do this without ciphering?

BR,
Mikko

Mohanraj

6 years 1 month ago

In reply to Hi, by Kurumi

Hi Mikko,

Hi Mikko,

Thanks for the update. its working now.

Thanks
Mohan Raj

Profile picture for user Kurumi

Kurumi

6 years 1 month ago

Hi,

Hi,

Thank you for the info. Meter can't handle date-time that you try to give and returns an error because of that.

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

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin