I'm facing an issue with communication between the meter and the computer (Python). I am using Landis+Gyr E650 and USB converter plugged through RS485. When I'm running the Gurux.DLMS.Client.Example.python using this command "python main.py -S COM4:9600:8None1 -r sn -c 32 -s 1 -a Low -P 00000000" I'm getting log like this https://pastebin.com/TfgH6Esb (I'm running it on windows, all libraries are up to date).
The first problem I've got is the 'DisconnectRequest' at the end after its console is frozen.
And the second question is how to retrieves just specific data from the meter. I mean retrieves for example object with names and values of chosen parameters.
Can you run this with -t Verbose parameter to get more data.
If you want to read data from the meter, you need to know object type and OBIS code. Check updateFrameCounter method from the client example. It'll read data object without reading association view.
Hi,
Thank you very much for your quick response.
This is the output of command with -t Verbose https://pastebin.com/XY1PSdHw At the and 'DisconnectRequest' was printed from function close() in GXDLMSReader.py.
Ok, I'll look at this function to read data and test it.
edit: How to use updateFrameCounter method? I need to invoke it in the main.py instead of readAll? and then to commad add "-g OBIS code" and what is the 'object type' what you have mentioned?
edit2: Meter it is not currently connected to any external devices. Could it be the reason of 'DisconnectRequest'?
The client example is improved to close the media if there is an error. That was causing the hanging. Get the latest version and let me know if you have problems.
Copy idea to readAll.
Object type is COSEM Object Type. Example Clock, Data, Register, etc. If data type is wrong, error is returned.
Hi,
I was trying debug DisconnectRequest problem and commment some block of codes but nothing helps. When I comment self.media.close() in close() method programme goes a few steps turther but at the and I'm facing "Ended. Press any key to continue" and console is still frozen.
When comes to reading data. For now, I use for reading profiles getProfileGenericColumns(). The register is read by readScalerAndUnits(). To "Data" object I can get in getReadOut() method. I have got a problem with reading values. When I look at it in debug I can see all names but without value (value=none). Do I have to use another method for this?
Is there a function to read only 'RegisterMonitor" or I have to 'catch' those values form another function?
And I can't see the "THD" in register (I have got firmware B32 so it should be somewhere) how can I find this?
Hi,
I've got Python 3.8.3.
I don't know why but I'm getting 403 Forbidden when I put there more text so here is rest of my answer and questions https://pastebin.com/pS4qZGsg
I don't know, but maybe there is an invalid character in your text.
In general, I don't like sleep fixes because they usually hide the original issue.
We'll try to repeat your error and install Python 3.8.3 to one Windows PC. Let's see what happens.
Thank you very much for your commitment. If it will help I can also upgrade/downgrade pyhthon.
Yeah, this 403 error occurs due to sth in the first paragraph, now it works.
So is it possible to 'add' values to the whole object of 'data', 'register'...? If yes, how?
Or I have to do this by selecting each OBIS code and then reading the value?
I saw you add in another topic code to read each obis code like this:
in ReadAll()
it = GXDLMSRegister("1.1.1.8.1.255")
# Read scaler and unit.
self.read(it, 3)
# Read value.
self.read(it, 2)
print( it.value)
but running this I'm facing an error like this "TypeError: can only concatenate str (not "int") to str"
Reading only one value as you show works for me fine, but I rather want to read more value in the program and has it as an output.
Hi,
I tried to do it this way but in debug I can see it's crashing in read() method in "data = self.client.read(item, attributeIndex)[0]" this line. Nothing is signed to 'data' and the program ends. This in the output now (with str(it.value)) https://pastebin.com/nF909jq8
Sorry, I didn't remember that Landis+Gyr E650 is using Short Name referencing. Change code to this:
it = GXDLMSRegister("1.1.1.8.1.255", SHORT_NAME)
You can get the short name when you read the association view.
Note! Short name might change in different firmware versions. Most of the meters are using Logical Name referencing at the moment. You can get the sort name from the GXDLMSDirector *.gxc file. Find the correct object using the Logical Name and then check ShortName-tag.
Hi,
Thank you very much, that was it. Now I can read the whole 'register' with values.
I've got one more question connected with reading profiles. I've found on the forum solution for that but it doesn't work for me.
loadProfile = GXDLMSProfileGeneric("1.0.99.1.0.255", 25200)
captureObjects = self.read(loadProfile, 3)
capturePeriod = self.read(loadProfile, 4)
sortMethod = self.read(loadProfile, 5)
sortObject = self.read(loadProfile, 6)
entriesInUse = self.read(loadProfile, 7)
entries = self.read(loadProfile, 8)
start = datetime.datetime(year=2020, month=11, day=2, hour=9, minute=50, second=0)
end = datetime.datetime.now()
rows = self.readRowsByRange(loadProfile, start, end)
it goes to last line and then 'rows' is empty and then it's ending in readRowsByRange() in "self.readDataBlock(data, reply)", "reply.value"=None. Do you know what could be wrong with it?
It's ending with this "Access Error : Device reports a unmatched type."
And those are values:
captureObjects: [(<gurux_dlms.objects.GXDLMSClock.GXDLMSClock object at 0x036AFBF8>,...]
capturePeriod: 900
sortMethod: 1
sortObject: 0.0.0.0.0.0
entriesInUse: 23377
entries: 23377
len objects 9
This is the last part of output with -t Verbose
TX: 15:41:25 7E A0 44 03 41 90 BB 65 E6 E6 00 05 01 04 0A B0 01 02 04 02 04 12 00 00 09 06 00 00 00 00 00 00 0F 02 12 00 00 09 0C 07 E4 0B 04 03 09 31 00 00 FF 88 00 09 0C 07 E4 0B 05 04 0F 29 19 00 FF 88 00 01 00 C4 8B 7E
RX: 15:41:25 7E A0 10 41 03 38 1B 2D E6 E7 00 0C 01 01 0C 2C 4B 7E
DisconnectRequest
TX: 15:41:25 7E A0 07 03 41 53 56 A2 7E
RX: 15:41:25 7E A0 1E 41 03 73 8E 7F 81 80 12 05 01 80 06 01 3E 07 04 00 00 00 01 08 04 00 00 00 01 07 22 7E
Access Error : Device reports a unmatched type.
You try to read profile generic and it fails. I believe that the reason is minutes or seconds.
Start time: 4.11.2020 9.49.00
End time: 5.11.2020 15.41.25
Try to change minutes and seconds to zero like this:
Start time: 4.11.2020 9.00.00
End time: 5.11.2020 15.00.00
Hi,
I made one more try with those settings
start = datetime.datetime(year=2020, month=11, day=6, hour=1, minute=0, second=0)
end = datetime.datetime(year=2020, month=11, day=6, hour=8, minute=0, second=0)
rows = self.readRowsByRange(loadProfile, start, end)
Unfortunately the output is the same. Nothing is signed to 'rows' and it throws 'Access Error : Device reports a unmatched type.'
I checked in GXDLMSDirector there are some values so it seems to be working fine.
Hi,
I did it this way
loadProfile = GXDLMSProfileGeneric("1.0.99.1.0.255", 25200)
captureObjects = self.read(loadProfile, 3)
...
rows = self.readRowsByRange(loadProfile, start, end)
so I read capture object or I have to do it in another way?
There is what is inside one of captrue obj https://pastebin.com/xhTMTna2 (view from debugger).
Hi,
No unfortunately it doesn't work. I had these line self.read(loadProfile, 3) in my code from the begining. So it should be sth else.
I see in capture obj there is no short name, could it be the reason? due to that what you mentionet before Landis+Gyr E650 is using Short Name referencing
BR,
Thomas
Yes, I can show total trace with rading buffer but it takes a lot of time for now its working 25minutes and still doesn't end. Should I restart the meter to reset the buffer?
I just notest that GXDLMSDirector is returning the same error when you try to read that same object.
How many rows there are? If there are only a few, it might that you can access it only reading all data.
Hi,
Thank you very much, that was it. You were right with that i can acces it only reading all data.
Now I made it this way
profiles = self.getProfileGenericColumns()
and then temporary i pass just first element profiles[1]
rows = self.readRowsByRange(profiles[1], start, end)
And I can see values in rows obj.
Now I have a problem with values. I think it will be easier to see on ss so here it is https://i.imgur.com/DwpyYac.png
on the left debug on the right GXDLMSDirector. It seems like missing dot. How can I get proper values? dividing by 10 not sounds like best option
You need to read register object scaler and unit before you read the profile generic buffer. When register object scaler and unit are set they are updated automatically.
The best way usually is to read them once and save the scaler and unit to the DB.
Hi,
Thank you very much, now it works as I wanted.
I've got one more question. Which version of Python are you using? Or are you facing the same crash problem(frozen console) with Python version 3.8 as me?
Hi,
Hi,
Can you run this with -t Verbose parameter to get more data.
If you want to read data from the meter, you need to know object type and OBIS code. Check updateFrameCounter method from the client example. It'll read data object without reading association view.
BR,
Mikko
Hi,
Hi,
Thank you very much for your quick response.
This is the output of command with -t Verbose https://pastebin.com/XY1PSdHw At the and 'DisconnectRequest' was printed from function close() in GXDLMSReader.py.
Ok, I'll look at this function to read data and test it.
edit: How to use updateFrameCounter method? I need to invoke it in the main.py instead of readAll? and then to commad add "-g OBIS code" and what is the 'object type' what you have mentioned?
edit2: Meter it is not currently connected to any external devices. Could it be the reason of 'DisconnectRequest'?
Hi,
Hi,
The client example is improved to close the media if there is an error. That was causing the hanging. Get the latest version and let me know if you have problems.
Copy idea to readAll.
Object type is COSEM Object Type. Example Clock, Data, Register, etc. If data type is wrong, error is returned.
BR,
Mikko
Hi,
Hi,
I checked it, unfortunately the result is the same. The close() method print "DisconnectRequest" and console is frozen. This is the output https://pastebin.com/x6t1NBpK and with -t Verbose https://pastebin.com/TET86Z3y
I appreciate your help with these problems
BR,
Thomas
Hi,
Hi,
I was trying debug DisconnectRequest problem and commment some block of codes but nothing helps. When I comment self.media.close() in close() method programme goes a few steps turther but at the and I'm facing "Ended. Press any key to continue" and console is still frozen.
When comes to reading data. For now, I use for reading profiles getProfileGenericColumns(). The register is read by readScalerAndUnits(). To "Data" object I can get in getReadOut() method. I have got a problem with reading values. When I look at it in debug I can see all names but without value (value=none). Do I have to use another method for this?
Is there a function to read only 'RegisterMonitor" or I have to 'catch' those values form another function?
And I can't see the "THD" in register (I have got firmware B32 so it should be somewhere) how can I find this?
Hi,
Hi,
We have try to test this and it works without problems. Can you run this and let me know what python version you are using.
python --version
You need to read attribute #2 from data and register the object to get the value. readScalerAndUnits reads scaler and unit, but not the value.
Landis+Gyr E650 is using Short Name referencing. You can save association view to the file so it's faster to read.
-o output.xml
You can read only one value like this:
-g 0.0.1.0.0.255:2
It will read clock date and time value from the meter.
BR,
Mikko
BR,
Mikko
Hi, I've got Python 3.8.3
Hi,
I've got Python 3.8.3.
I don't know why but I'm getting 403 Forbidden when I put there more text so here is rest of my answer and questions https://pastebin.com/pS4qZGsg
BR,
Thomas
Hi,
Hi,
I don't know, but maybe there is an invalid character in your text.
In general, I don't like sleep fixes because they usually hide the original issue.
We'll try to repeat your error and install Python 3.8.3 to one Windows PC. Let's see what happens.
BR,
Mikko
Thank you very much for your
Thank you very much for your commitment. If it will help I can also upgrade/downgrade pyhthon.
Yeah, this 403 error occurs due to sth in the first paragraph, now it works.
So is it possible to 'add' values to the whole object of 'data', 'register'...? If yes, how?
Or I have to do this by selecting each OBIS code and then reading the value?
I saw you add in another topic code to read each obis code like this:
in ReadAll()
it = GXDLMSRegister("1.1.1.8.1.255")
# Read scaler and unit.
self.read(it, 3)
# Read value.
self.read(it, 2)
print( it.value)
but running this I'm facing an error like this "TypeError: can only concatenate str (not "int") to str"
Reading only one value as you show works for me fine, but I rather want to read more value in the program and has it as an output.
Hi,
Hi,
Try with this:
print(str(it.value))
You need to loop all the values that you want to read. You can try to read several values with readList -method.
BR,
Mikko
Hi,
Hi,
I tried to do it this way but in debug I can see it's crashing in read() method in "data = self.client.read(item, attributeIndex)[0]" this line. Nothing is signed to 'data' and the program ends. This in the output now (with str(it.value)) https://pastebin.com/nF909jq8
BR,
Thomas
Hi,
Hi,
Sorry, I didn't remember that Landis+Gyr E650 is using Short Name referencing. Change code to this:
it = GXDLMSRegister("1.1.1.8.1.255", SHORT_NAME)
You can get the short name when you read the association view.
Note! Short name might change in different firmware versions. Most of the meters are using Logical Name referencing at the moment. You can get the sort name from the GXDLMSDirector *.gxc file. Find the correct object using the Logical Name and then check ShortName-tag.
BR,
Mikko
Hi,
Hi,
Thank you very much, that was it. Now I can read the whole 'register' with values.
I've got one more question connected with reading profiles. I've found on the forum solution for that but it doesn't work for me.
loadProfile = GXDLMSProfileGeneric("1.0.99.1.0.255", 25200)
captureObjects = self.read(loadProfile, 3)
capturePeriod = self.read(loadProfile, 4)
sortMethod = self.read(loadProfile, 5)
sortObject = self.read(loadProfile, 6)
entriesInUse = self.read(loadProfile, 7)
entries = self.read(loadProfile, 8)
start = datetime.datetime(year=2020, month=11, day=2, hour=9, minute=50, second=0)
end = datetime.datetime.now()
rows = self.readRowsByRange(loadProfile, start, end)
it goes to last line and then 'rows' is empty and then it's ending in readRowsByRange() in "self.readDataBlock(data, reply)", "reply.value"=None. Do you know what could be wrong with it?
BR,
Thomas
It's ending with this "Access
It's ending with this "Access Error : Device reports a unmatched type."
And those are values:
captureObjects: [(<gurux_dlms.objects.GXDLMSClock.GXDLMSClock object at 0x036AFBF8>,...]
capturePeriod: 900
sortMethod: 1
sortObject: 0.0.0.0.0.0
entriesInUse: 23377
entries: 23377
len objects 9
This is the last part of output with -t Verbose
TX: 15:41:25 7E A0 44 03 41 90 BB 65 E6 E6 00 05 01 04 0A B0 01 02 04 02 04 12 00 00 09 06 00 00 00 00 00 00 0F 02 12 00 00 09 0C 07 E4 0B 04 03 09 31 00 00 FF 88 00 09 0C 07 E4 0B 05 04 0F 29 19 00 FF 88 00 01 00 C4 8B 7E
RX: 15:41:25 7E A0 10 41 03 38 1B 2D E6 E7 00 0C 01 01 0C 2C 4B 7E
DisconnectRequest
TX: 15:41:25 7E A0 07 03 41 53 56 A2 7E
RX: 15:41:25 7E A0 1E 41 03 73 8E 7F 81 80 12 05 01 80 06 01 3E 07 04 00 00 00 01 08 04 00 00 00 01 07 22 7E
Access Error : Device reports a unmatched type.
Hi,
Hi,
You try to read profile generic and it fails. I believe that the reason is minutes or seconds.
Start time: 4.11.2020 9.49.00
End time: 5.11.2020 15.41.25
Try to change minutes and seconds to zero like this:
Start time: 4.11.2020 9.00.00
End time: 5.11.2020 15.00.00
Some meters can't handle if seconds are used.
BR,
Mikko
Hi,
Hi,
I made one more try with those settings
start = datetime.datetime(year=2020, month=11, day=6, hour=1, minute=0, second=0)
end = datetime.datetime(year=2020, month=11, day=6, hour=8, minute=0, second=0)
rows = self.readRowsByRange(loadProfile, start, end)
Unfortunately the output is the same. Nothing is signed to 'rows' and it throws 'Access Error : Device reports a unmatched type.'
I checked in GXDLMSDirector there are some values so it seems to be working fine.
BR,
Thomas
Hi,
Hi,
Can you post a trace from sent bytes? You can get it if you add -t Verbose parameter. Post GXDLMSDirector request as well.
BR,
Mikko
Here is the output with -t
Here is the output with -t Verbose https://pastebin.com/DQ9zC5Q2
And how to get it from GXDLMSDirector ?
Hi,
Hi,
Select "Log" and "View Log" from the "View" menu.
BR,
Mikko
Ok thanks now I see it. There
Ok thanks now I see it. There is an output from GXDLMSDirector https://pastebin.com/CJw7HhSs
BR,
Thomas
Hi,
Hi,
You haven't read capture objects. You need to read it first. Read attribute #3 first.
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric
BR,
Mikko
Hi,
Hi,
I did it this way
loadProfile = GXDLMSProfileGeneric("1.0.99.1.0.255", 25200)
captureObjects = self.read(loadProfile, 3)
...
rows = self.readRowsByRange(loadProfile, start, end)
so I read capture object or I have to do it in another way?
There is what is inside one of captrue obj https://pastebin.com/xhTMTna2 (view from debugger).
BR,
Thomas
Hi,
Hi,
You can save capture objects or read them from the meter, but capture objects are required to convert read data to human format. Is it working now?
BR,
Mikko
Hi,
Hi,
No unfortunately it doesn't work. I had these line self.read(loadProfile, 3) in my code from the begining. So it should be sth else.
I see in capture obj there is no short name, could it be the reason? due to that what you mentionet before Landis+Gyr E650 is using Short Name referencing
BR,
Thomas
Hi,
Hi,
No. Logical name is used there. Can you show your total trace when you are first reading capture objects and then buffer?
Have you tried to read it with the client example? I just try to read one meter that is using short name referencing and it worked without problems.
BR,
Mikko
Yes, I can show total trace
Yes, I can show total trace with rading buffer but it takes a lot of time for now its working 25minutes and still doesn't end. Should I restart the meter to reset the buffer?
BR,
Thomas
It's too long to paste all
It's too long to paste all trace https://pastebin.com/79zWunFP so I paste last part of reading. Is it usefull or I should past it on cloud?
When comes to client example. Did you mean this part of code? Those are outputs of those lines of code
self.getProfileGenericColumns() https://pastebin.com/77uwxKYM
self.getReadOut() https://pastebin.com/cQv3LfTr
self.getProfileGenerics() https://pastebin.com/M7YAi8UB
BR,
Thomas
HI,
HI,
I just notest that GXDLMSDirector is returning the same error when you try to read that same object.
How many rows there are? If there are only a few, it might that you can access it only reading all data.
BR,
Mikko
Hi,
Hi,
Thank you very much, that was it. You were right with that i can acces it only reading all data.
Now I made it this way
profiles = self.getProfileGenericColumns()
and then temporary i pass just first element profiles[1]
rows = self.readRowsByRange(profiles[1], start, end)
And I can see values in rows obj.
Now I have a problem with values. I think it will be easier to see on ss so here it is https://i.imgur.com/DwpyYac.png
on the left debug on the right GXDLMSDirector. It seems like missing dot. How can I get proper values? dividing by 10 not sounds like best option
BR,
Thomas
HI,
HI,
You need to read register object scaler and unit before you read the profile generic buffer. When register object scaler and unit are set they are updated automatically.
The best way usually is to read them once and save the scaler and unit to the DB.
BR,
Mikko
Hi,
Hi,
Thank you very much, now it works as I wanted.
I've got one more question. Which version of Python are you using? Or are you facing the same crash problem(frozen console) with Python version 3.8 as me?
BR,
Thomas
Hi,
Hi,
The Python version is 3.7.4. We don't have any problems. What kind of USB converter you are using (manufacturer and model)?
BR,
Mikko
Hi,
Hi,
manufacturer: AVT
model: AVTMOD03
BR,
Thomas