Reading HXE smart meter using optical head with python
Hello, I am trying to read from HXE energy meter using optical probe. From the documentation, the meter works with Protocol mode E. I download Gurux dlms python library and ran the main.py script and i keep getting this
$python3 main.py -S /dev/ttyUSB0 -t Verbose
Authentication: Authentication.NONE
ClientAddress: 0x10
ServerAddress: 0x1
TX: 00:34:45 7E A0 07 03 21 93 0F 01 7E
Data send failed. Try to resend 1/3
Data send failed. Try to resend 2/3
RX: 00:35:00
DisconnectRequest
Traceback (most recent call last):
File "main.py", line 81, in main
reader.readAll()
File "/home/pi/Gurux.DLMS.python/Gurux.DLMS.Client.Example.python/GXDLMSReader.py", line 423, in readAll
self.initializeConnection()
File "/home/pi/Gurux.DLMS.python/Gurux.DLMS.Client.Example.python/GXDLMSReader.py", line 235, in initializeConnection
self.readDLMSPacket(data, reply)
File "/home/pi/Gurux.DLMS.python/Gurux.DLMS.Client.Example.python/GXDLMSReader.py", line 91, in readDLMSPacket
self.readDLMSPacket2(data, reply)
File "/home/pi/Gurux.DLMS.python/Gurux.DLMS.Client.Example.python/GXDLMSReader.py", line 142, in readDLMSPacket2
raise e
File "/home/pi/Gurux.DLMS.python/Gurux.DLMS.Client.Example.python/GXDLMSReader.py", line 134, in readDLMSPacket2
raise TimeoutException("Failed to receive reply from the device in given time.")
gurux_common.TimeoutException.TimeoutException: Failed to receive reply from the device in given time.
Ended. Press any key to continue.
Currently when I send '/?!\r\n' with python script, I get '/HXE5\2HXE12' as reply from the meter. what do i need to do next? or how can i get this library to work?
ok i have just tried it, and it connected. I looked up GXDLMSDirectorExample link to know what to fill for hex meters and it connected. after connecting, the data objects below the device i created, when i try to read em i get "no response" pop up. how to i read, or do i need to add data objects myself?
ok i will try that. how do i pass in the password, cause the password is 00 00 00 00 00 00 and it's not ascii. care to tell how to pass in the -P [password format]
You need to hardcore the password for now. We'll think how the user can give non-ascii password.
There are only few manufacturers that are not using the ASCII password.
I have been able to successfully read the Hex meter using GXDLMSDirectorExample, and i tried the obis codes from the hex meter documentation to read out certain parameters and it did. Now i'm trying to use a raspberry pi to read certain information from the meter via optics and I need a python sample for this meter.
thanks for your reply, I have been able to successfully read the Hex meter using GXDLMSDirectorExample, and i tried the obis codes from the hex meter documentation to read out certain parameters and it did. Now i'm trying to read certain information from the meter using the gurux python library via optics. below is the reading i got with the app and i would like to get it using python. what arguments do i need to pass to the main.py file based on the parameters inputed in the GXDLMSDirector app as shown in my previous reply.
Hi,
Hi,
Can you try to read your meter with GXDLMSDirector first? You receive a reply to IEC 62056-21 command.
BR,
Mikko
ok i have just tried it, and
ok i have just tried it, and it connected. I looked up GXDLMSDirectorExample link to know what to fill for hex meters and it connected. after connecting, the data objects below the device i created, when i try to read em i get "no response" pop up. how to i read, or do i need to add data objects myself?
device properties
device properties: with 300 baud, 7 bits, even parity, one stop bit.
Hi,
Hi,
First, you need to add -i parameter. Like this:
python3 main.py -S /dev/ttyUSB0 -i -t Verbose
It uses IEC 62056-21 as a start protocol.
Add that and try to read the meter. You can also try to change the authentication and client address if the connection fails.
BR,
Mikko
ok i will try that. how do i
ok i will try that. how do i pass in the password, cause the password is 00 00 00 00 00 00 and it's not ascii. care to tell how to pass in the -P [password format]
Hi,
Hi,
You need to hardcore the password for now. We'll think how the user can give non-ascii password.
There are only few manufacturers that are not using the ASCII password.
BR,
Mikko
Hello Kurumi,
Hello Kurumi,
I have been able to successfully read the Hex meter using GXDLMSDirectorExample, and i tried the obis codes from the hex meter documentation to read out certain parameters and it did. Now i'm trying to use a raspberry pi to read certain information from the meter via optics and I need a python sample for this meter.
Thanks
Hello Kurumi,
Hello Kurumi,
thanks for your reply, I have been able to successfully read the Hex meter using GXDLMSDirectorExample, and i tried the obis codes from the hex meter documentation to read out certain parameters and it did. Now i'm trying to read certain information from the meter using the gurux python library via optics. below is the reading i got with the app and i would like to get it using python. what arguments do i need to pass to the main.py file based on the parameters inputed in the GXDLMSDirector app as shown in my previous reply.
Thanks
Hi,
Hi,
I believe that you need to change the authentication level if the OBIS code that you want to read is not shown on the association view.
BR,
Mikko