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. Node
  3. System.InvalidCastException: 'Unable To Cast Object of Type 'Gurux.DLMS.Objects.GXDLMSActivityCalendar' To Type 'System.Object[]'.'

System.InvalidCastException: 'Unable to cast object of type 'Gurux.DLMS.Objects.GXDLMSActivityCalendar' to type 'System.Object[]'.'

By Rahuls , 9 May, 2024
Forums
Gurux.Net

Getting this error as I try to set activvity calender

object GetActivityWrite(){
GXDLMSActivityCalendar activity = new GXDLMSActivityCalendar();
activity.CalendarNamePassive = "Passive";
activity.DayProfileTablePassive = new GXDLMSDayProfile[] { new GXDLMSDayProfile(1, new GXDLMSDayProfileAction[] { new GXDLMSDayProfileAction(new GXTime(DateTime.Now), "0.0.10.0.100.255", 1) }) };
return activity;
}

object tempObj = GetActivityWrite();
ReadDataBlock(Client.Write(writeObj.Name, tempObj, dt, objectType, attributeIndex), reply);

trying to test the library, and i am getting error. It is reading smoothly, only error on this part, tried passed date in different formats, nothing works

Rahuls

2 years 6 months ago

Hi Mikko, Any update? thanks.

Hi Mikko,

Any update?

thanks.

Profile picture for user Kurumi

Kurumi

2 years 6 months ago

Hi, Try like this: object…

Hi,

Try like this:

object tempObj = GetActivityWrite();
ReadDataBlock(Client.Write(tempObj, 9), reply);

BR,
Mikko

Rahuls

2 years 6 months ago

Thanks Mikko, I was able to…

Thanks Mikko, I was able to write it to passive.

As of now i did manually activate from GURUX director, how can i activate it from code library?

Profile picture for user Kurumi

Kurumi

2 years 6 months ago

Hi, You can activate it by…

Hi,

You can activate it by calling the ActivatePassiveCalendar method. Like this:

ReadDataBlock(tempObj.ActivatePassiveCalendar(Client), reply);

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 11/19/2026 - 10:57
    Gurux.DLMS.Python 1.0.204
  • Thu, 11/19/2026 - 10:12
    gurux.dlms.c 9.0.2611.1901
  • Tue, 10/13/2026 - 12:00
    gurux.dlms.java 4.0.97
  • Tue, 09/22/2026 - 14:02
    Gurux.DLMS.Net 9.0.2609.2201
  • Mon, 09/21/2026 - 10:18
    Gurux.DLMS.Net 9.0.2609.2101

New forum topics

  • Mitra10 Pesanggrahan | WA 083148835648
  • Mitra10 Daan Mogot Jakarta Barat | WA 083148835648
  • Brata Jaya Material | WA 083148835648
  • Toko Bangunan Hari-hari | WA 083148835648
  • Supermarket Bangunan Abadi ( Bangunan Abadi ) Meruya | WA 083148835648
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin