Getting data from meter Python "DisconnectRequest"

13 posts / 0 new
Last post
ThomasS
Getting data from meter Python "DisconnectRequest"

Hi,

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.

Thank you in advance for your help.

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

ThomasS

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'?

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

ThomasS

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

ThomasS

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?

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

ThomasS

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

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

ThomasS

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.

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

ThomasS

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

Kurumi
Kurumi's picture

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

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi