I am having the similar issue. I am testing Gurux DLMS Client Example in python in raspberry PI as well as in windows 11. The code is working when using raspberry pi but getting timeout response when using windows. I have my doubt on GXSerial as in raspberry pi it shows available ports but in wondows it does not show COM ports
Windows COM ports are used all the time.
The handle is invalid error means that you try to open serial port that doesn't exist.
Check that you use the correct serial port.
I think the USB to RS232 converter is working fine. As I am able to read the meter using DLMS Director from same PC and same converter. But when I try to use the Python Library on the same PC to read the meter then the Client Example is not able to read it. I get broken response at the end of timeout exception.
In Windows available serial ports are read from the registry. I can't understand why your serial port is shown as "LADA0".
Can you run this and let me know the python version:
python --version
What language your Windows 11 is using? If you can share this, we can install the same Windows localization and test this.
The connection fails because your device settings are different than the meter expects. When you select the meter in GXDLMSDirector, you can see the correct command-line arguments that you must use.
The python version is 3.12.3. The screen shot is attached. I don't get your point about the windows language.
When I used raspberry Pi to read meter using RS232 then it was reading some responses by proving only one resource that is COM Port. I have also tried with setting used in DLMS Director, but it did not work.
I have also tried in separate PC having windows 11 and python version 3.12.3. There I was getting port names but the response for SNRM Packet was not coming. And after three retry count I receive some response bytes in RX buffer as per the attachment.
PS C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python> py main.py -S COM10
gurux_dlms version: 1.0.150
gurux_net version: 1.0.19
gurux_serial version: 1.0.20
Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x1
Standard: 0
error code= 0
Data send failed. Try to resend 1/3
error code= 0
Data send failed. Try to resend 2/3
error code= 0
RX: 14:29:33
DisconnectRequest
Traceback (most recent call last):
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\main.py", line 113, in main
reader.readAll(settings.outputFile)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 554, in readAll
self.initializeConnection()
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 317, in initializeConnection
self.readDLMSPacket(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 119, in readDLMSPacket
self.readDLMSPacket2(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 172, in readDLMSPacket2
raise e
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 165, 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.
PS C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python> py main.py -S COM11
gurux_dlms version: 1.0.150
gurux_net version: 1.0.19
gurux_serial version: 1.0.20
Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x1
Standard: 0
error code= 0
Data send failed. Try to resend 1/3
error code= 0
Data send failed. Try to resend 2/3
error code= 0
RX: 14:30:35 7E A0 20 21 03 73 73 98 81 80 14 05 02 02 00 06 02 02
DisconnectRequest
Traceback (most recent call last):
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\main.py", line 113, in main
reader.readAll(settings.outputFile)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 554, in readAll
self.initializeConnection()
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 317, in initializeConnection
self.readDLMSPacket(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 119, in readDLMSPacket
self.readDLMSPacket2(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 172, in readDLMSPacket2
raise e
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 165, 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.
Hi,
I checked this from the source code and noticed that it expects that Windows is using Unicode format.
Can you start Windows PowerShell.
Then run this command and add the results here.
Get-InstalledLanguage
This affects only how available serial ports are shown. You can use the client application if you set the correct settings that GXDLMSDirector shows.
This looks strange. It looks like the meter is sending the beginning of the data and the end is missing. It is even strange if you can read this with GXDLMSDirector.
Are you running python and GXDLMSDirector on the same PC? What USB to the serial port converter you are using?
I am having the similar…
I am having the similar issue. I am testing Gurux DLMS Client Example in python in raspberry PI as well as in windows 11. The code is working when using raspberry pi but getting timeout response when using windows. I have my doubt on GXSerial as in raspberry pi it shows available ports but in wondows it does not show COM ports
When I put the COM Port in…
When I put the COM Port in source setting the response is attached below
Hi, Windows COM ports are…
Hi,
Windows COM ports are used all the time.
The handle is invalid error means that you try to open serial port that doesn't exist.
Check that you use the correct serial port.
BR,
Mikko
Hi holmium_user, Check your…
Hi holmium_user,
Check your serial port from Windows Device Manager and update drivers if needed.
If you don't see any serial ports you haven't any on your Windows.
Note! Several USB to RS-232 converters don't work in Windows 11. They are only working on Windows 10 and Windows 8.
BR,
Mikko
Hi Kurumi, I think the USB…
Hi Kurumi,
I think the USB to RS232 converter is working fine. As I am able to read the meter using DLMS Director from same PC and same converter. But when I try to use the Python Library on the same PC to read the meter then the Client Example is not able to read it. I get broken response at the end of timeout exception.
Hi, In Windows available…
Hi,
In Windows available serial ports are read from the registry. I can't understand why your serial port is shown as "LADA0".
Can you run this and let me know the python version:
python --version
What language your Windows 11 is using? If you can share this, we can install the same Windows localization and test this.
The connection fails because your device settings are different than the meter expects. When you select the meter in GXDLMSDirector, you can see the correct command-line arguments that you must use.
BR,
Mikko
Hi, The python version is 3…
Hi,
The python version is 3.12.3. The screen shot is attached. I don't get your point about the windows language.
When I used raspberry Pi to read meter using RS232 then it was reading some responses by proving only one resource that is COM Port. I have also tried with setting used in DLMS Director, but it did not work.
I have also tried in separate PC having windows 11 and python version 3.12.3. There I was getting port names but the response for SNRM Packet was not coming. And after three retry count I receive some response bytes in RX buffer as per the attachment.
PS C:\Users\Holmi\Gurux.DLMS…
PS C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python> py main.py -S COM10
gurux_dlms version: 1.0.150
gurux_net version: 1.0.19
gurux_serial version: 1.0.20
Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x1
Standard: 0
error code= 0
Data send failed. Try to resend 1/3
error code= 0
Data send failed. Try to resend 2/3
error code= 0
RX: 14:29:33
DisconnectRequest
Traceback (most recent call last):
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\main.py", line 113, in main
reader.readAll(settings.outputFile)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 554, in readAll
self.initializeConnection()
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 317, in initializeConnection
self.readDLMSPacket(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 119, in readDLMSPacket
self.readDLMSPacket2(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 172, in readDLMSPacket2
raise e
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 165, 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.
PS C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python> py main.py -S COM11
gurux_dlms version: 1.0.150
gurux_net version: 1.0.19
gurux_serial version: 1.0.20
Authentication: 0
ClientAddress: 0x10
ServerAddress: 0x1
Standard: 0
error code= 0
Data send failed. Try to resend 1/3
error code= 0
Data send failed. Try to resend 2/3
error code= 0
RX: 14:30:35 7E A0 20 21 03 73 73 98 81 80 14 05 02 02 00 06 02 02
DisconnectRequest
Traceback (most recent call last):
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\main.py", line 113, in main
reader.readAll(settings.outputFile)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 554, in readAll
self.initializeConnection()
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 317, in initializeConnection
self.readDLMSPacket(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 119, in readDLMSPacket
self.readDLMSPacket2(data, reply)
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 172, in readDLMSPacket2
raise e
File "C:\Users\Holmi\Gurux.DLMS.Python\Gurux.DLMS.Client.Example.python\GXDLMSReader.py", line 165, 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.
Hi, I checked this from the…
Hi,
I checked this from the source code and noticed that it expects that Windows is using Unicode format.
Can you start Windows PowerShell.
Then run this command and add the results here.
Get-InstalledLanguage
This affects only how available serial ports are shown. You can use the client application if you set the correct settings that GXDLMSDirector shows.
BR,
Mikko
Hi, Can you add this to get…
Hi,
Can you add this to get a better trace:
-t Verbose
I can see that the meter is using a different server address. What server address are you using in GXDLMSDirector?
BR,
Mikko
Hi, Check the response for…
Hi,
Check the response for installed Language
Response after adding -t…
Response after adding -t Verbose and using the correct details as used in DLMS Director.
Hi, Can you add the hex…
Hi,
Can you add the hex trace from GXDLMSDictor log? The first row is enough.
Please, don't add pictures. The hex string is hard to read from the pic.
BR,
Mikko
13:43:28 Send SNRM request…
13:43:28 Send SNRM request.
TX: 7E A0 07 03 41 93 5A 64 7E
13:43:28
RX: 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 02 00 06 02 02 00 07 04 00 00 00 01 08 04 00 00 00 01 6F EF 7E
13:43:28 Send AARQ request.
TX: 7E A0 44 03 41 10 B3 E1 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 41 42 43 44 30 30 30 31 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF 6B 70 7E
13:43:28
RX: 7E A0 37 41 03 30 21 79 E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 10 14 02 00 00 07 BC 85 7E
Hi, This looks strange. It…
Hi,
This looks strange. It looks like the meter is sending the beginning of the data and the end is missing. It is even strange if you can read this with GXDLMSDirector.
Are you running python and GXDLMSDirector on the same PC? What USB to the serial port converter you are using?
BR,
Mikko
Hi Sir, i also have the same…
Hi Sir,
i also have the same problem. i cant read the data from the meter. im using Visual Studio .NET 6.0.
how i can change the com…
how i can change the com port on my code?
Dear shaaa, Please, create a…
Dear shaaa,
Please, create a new topic if you have a new question.
serial.PortName = "YOUR_COM";
BR,
Mikko