gurux_dlms version: 1.0.145
gurux_net version: 1.0.19
gurux_serial version: 1.0.20
Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x5a7c
Standard: 0
TX: 19:22:46 7E A0 0A 00 02 68 F9 21 93 51 F1 7E
RX: 19:22:46 7E A0 21 21 00 02 68 F9 73 89 93 81 80 12 05 01 80 06 01 3E 07 04 00 00 00 01 08 04 00 00 00 01 07 22 7E
TX: 19:22:46 7E A0 2E 00 02 68 F9 21 10 37 4B E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 02 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 1C 03 20 FF FF 80 AB 7E
RX: 19:22:47 7E A0 3A 21 00 02 68 F9 30 5D 20 E6 E7 00 61 28 A1 09 06 07 60 85 74 05 08 01 02 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 0F 04 0D 08 00 06 5F 1F 04 00 18 02 20 09 60 FA 00 0A A8 7E
val = reader.read(obj, v)
^^^^^^^^^^^^^^^^^^^
data = self.client.read(item, attributeIndex)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return self._read(item.name, item.objectType, attributeOrdinal)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sn += (attributeOrdinal - 1) * 8
TypeError: can only concatenate str (not "int") to str
Ended. Press any key to continue.
I'm running this code
reader = GXDLMSReader(settings.client, settings.media, settings.trace, settings.invocationCounter)
settings.media.open()
if settings.readObjects:
reader.initializeConnection()
if settings.outputFile and os.path.exists(settings.outputFile):
try:
c = GXDLMSObjectCollection.load(settings.outputFile)
settings.client.objects.extend(c)
except Exception as ex:
print(ex)
for k, v in settings.readObjects:
print(f'key: {k} value: {v}')
obj = settings.client.objects.findByLN(ObjectType.NONE, k)
#print(f'obj = {obj}')
if obj is None:
raise Exception("Unknown logical name:" + k)
#obj = GXDLMSRegister(ln=k)
val = reader.read(obj, v)
reader.showValue(v, val)
#if settings.outputFile:
# settings.client.objects.save(settings.outputFile)
else:
reader.readAll(settings.outputFile)
except (ValueError, GXDLMSException, GXDLMSExceptionResponse, GXDLMSConfirmedServiceError) as ex:
print(ex)
except (KeyboardInterrupt, SystemExit, Exception) as ex:
traceback.print_exc()
if settings.media:
settings.media.close()
reader = None
finally:
if reader:
try:
reader.close()
except Exception:
traceback.print_exc()
I've running test with the following instructions
- obj = GXDLMSRegister(ln=k) or #obj = GXDLMSRegister(sn=k)
-obj = settings.client.objects.findByLN(ObjectType.NONE, k)
Everytime I get the exact same response.
I have another file which generated an output.xml file and then read some value e.g Voltage "1.1.32.7.0.255:2" that one works.
all the above used an Ethernet connection
I have another file when a read through serial port where I don't use any file I just read as follows
reader = GXDLMSReader(settings.client, settings.media, settings.trace, settings.invocationCounter)
settings.media.open()
reader.initializeConnection()
if app_settings['smart_meter']['read_profile']:
pg = GXDLMSProfileGeneric("1.0.99.1.0.255")
reader.read(pg, 3)
start = datetime.strptime('07/01/2023 00:00:00', '%m/%d/%Y %H:%M:%S')
end = datetime.strptime('07/09/2023 00:00:00', '%m/%d/%Y %H:%M:%S')
rows = reader.readRowsByRange(pg, start, end)
print(rows)
print(rows[0][1])
else:
for k, v in app_settings['smart_meter']['obis'].items():
obis = v #"1.1.32.7.0.255"
obj = GXDLMSRegister(obis)
resultV = reader.read(obj, 2)
reader.showValue(2, resultV)
res = round(float(resultV / 10), 1)
This works without reading or generating any file and with NO need to read reader.getAssociationView() or reader.readAll(settings.outputFile)
Why the library works so random and weird.
Is it possible to read register from the meter (e.g voltage) under any circuntances or it always necessary to read getAssociationView() or readAll
Please someone let me know how this library works cause I don't really get it,
Hi, I believe that you haveā¦
Hi,
I believe that you have read your output.xml from some other meter. If that is the case, then your object settings are not correct and that causes the problem.
From the connection messages, I can see that you can establish the connection for the meter. Try to save the association view for the different name that output.xml.
I believe it'll help you to read the meter.
BR,
Mikko