Traceback (most recent call last):
File "/home/akreskin/development/com-port-test/dlms-ctd/gurux.py", line 163, in <module>
reader.readDLMSPacket(client.getApplicationAssociationRequest(), reply)
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/GXDLMSClient.py", line 581, in getApplicationAssociationRequest
challenge = GXSecure.secure(self.settings, self.settings.cipher, self.settings.cipher.invocationCounter, self.settings.getStoCChallenge(), pw)
AttributeError: 'NoneType' object has no attribute 'invocationCounter'
How can I solve this Issue? With the 1.0.91 version of library this code works properly.
2. ActivityCalendar writing issue:
I'm trying to write some data to 9'nth attribute - DayProfileTablePassive. I hope, that I'm clearly understand how to write attributes with gurux_dlms, but I can't resolve, what format of time should I give for parameter startTime of the class GXDLMSDayProfileAction. I mean this string in the method __setDayProfileTable of class GXDLMSActivityCalendar:
I have already tried give to it2[0] ISO-8601-time string, datetime object. As I understand, I should give byte string, looks like the string, returning in answers of reading ProfileGeneric objects with the reader.readRowsByEntry(), but I can't find a method or function to get it. Can you help me with this?
1. Have you made any changes to the source code? I just tested this and it works as expected.
2. You can give it using datetime or GXDateTime format. Some meters expect that seconds are set to zero. Try to read the value and then write it back. Are you receiving any error?
1. No, I didn't made any changes to the source. This error occurs only if I trying to connect with HIGH level og authentication, and only way that I can connect with meter is manually add:
2. I've already tried everything that I can imagine :) And I can't read this data and write it back, because when I trying to do this I got a TypeError: 'GXDLMSDayProfile' object is not subscritable. Look at this code snippet:
day_schedules_data = []
for point in data_from_cloud:
day_schedules_data.append(
[
GXTime(point.get('start_time'), "%H:%M:%S"),
script_ln,
point.get('tariff_number')
]
)
Traceback (most recent call last):
File "/home/akreskin/development/com-port-test/dlms-ctd/gurux.py", line 234, in <module>
day_profile_table_passive_attr,
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/objects/GXDLMSActivityCalendar.py", line 347, in setValue
self.dayProfileTablePassive = self.__setDayProfileTable(settings, e.value)
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/objects/GXDLMSActivityCalendar.py", line 313, in __setDayProfileTable
ac.startTime = _GXCommon.changeType(settings, it2[0], DataType.TIME)
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/internal/_GXCommon.py", line 231, in changeType
raise ValueError("Change type failed. Not enought data.")
ValueError: Change type failed. Not enought data.
Same error i get, if I trying to give datetime object. What am I do wrong?
Hi,
Hi,
1. Have you made any changes to the source code? I just tested this and it works as expected.
2. You can give it using datetime or GXDateTime format. Some meters expect that seconds are set to zero. Try to read the value and then write it back. Are you receiving any error?
BR,
Mikko
Hi,
Hi,
1. No, I didn't made any changes to the source. This error occurs only if I trying to connect with HIGH level og authentication, and only way that I can connect with meter is manually add:
client.settings.cipher = GXCiphering('')
client.settings.cipher.invocationCounter = 0
but it seems as a trick for me.
2. I've already tried everything that I can imagine :) And I can't read this data and write it back, because when I trying to do this I got a TypeError: 'GXDLMSDayProfile' object is not subscritable. Look at this code snippet:
data_from_cloud = [
{
'start_time': "06:00:00",
'tariff_number': 1,
},
{
'start_time': "12:30:00",
'tariff_number': 2,
},
{
'start_time': "16:00:00",
'tariff_number': 1,
},
{
'start_time': "20:00:00",
'tariff_number': 3,
},
]
script_ln = "0.0.10.0.100.255"
day_schedules_data = []
for point in data_from_cloud:
day_schedules_data.append(
[
GXTime(point.get('start_time'), "%H:%M:%S"),
script_ln,
point.get('tariff_number')
]
)
return [[1, day_schedules_data]]
day_profile_table_passive_attr = GXDLMSAttribute(
index=9,
type_=activity_calendar.getDataType(9),
uiType=activity_calendar.getDataType(9),
order=9,
)
day_profile_table_passive_attr.value = day_schedules_data
activity_calendar.setValue(
reader.client.settings,
day_profile_table_passive_attr,
)
reader.write(activity_calendar, 9)
When i run this snippet i got this error:
Traceback (most recent call last):
File "/home/akreskin/development/com-port-test/dlms-ctd/gurux.py", line 234, in <module>
day_profile_table_passive_attr,
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/objects/GXDLMSActivityCalendar.py", line 347, in setValue
self.dayProfileTablePassive = self.__setDayProfileTable(settings, e.value)
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/objects/GXDLMSActivityCalendar.py", line 313, in __setDayProfileTable
ac.startTime = _GXCommon.changeType(settings, it2[0], DataType.TIME)
File "/home/akreskin/.local/share/virtualenvs/com-port-test-mDPSA0Ke/lib/python3.7/site-packages/gurux_dlms/internal/_GXCommon.py", line 231, in changeType
raise ValueError("Change type failed. Not enought data.")
ValueError: Change type failed. Not enought data.
Same error i get, if I trying to give datetime object. What am I do wrong?
Thank you very much!
Hi,
Hi,
The reason was too clear. You must use the secure client. Like this:
client = GXDLMSSecureClient(forAuthentication=Authentication.HIGH)
You can write passive day profile table like this:
ac = GXDLMSActivityCalendar("0.0.13.0.0.255")
dp = GXDLMSDayProfile()
dp.dayId = 1;
ac = GXDLMSDayProfileAction()
ac.startTime = 'Get start_time'
ac.scriptLogicalName = "Get script_ln"
ac.scriptSelector = "Get script selector"
it.daySchedules.append(ac)
ac.dayProfileTablePassive.append(dp)
reader.write(activity_calendar, 9)
BR,
Mikko
Thank you very much!! It
Thank you very much!! It works for me!