Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Node
  3. Inhemeter

Inhemeter

By Frank G , 7 October, 2026
Forums
DLMSDirector

Hi Mikko,
I am having a connection issue with this meter (Identification: IHM5\2Inhe Meder). The SNRM frame (03 03) is correct and works fine in other software.
The communication log reveals the exact problem during the IEC Mode E handshake:
1. Gurux sends the baud rate change command: 06 32 35 32 0D 0A
2. Gurux closes and reopens the COM port to change settings from 7E1 to 8N1 (takes ~110ms).
3. The Bug: After reopening the port, Gurux waits exactly 1000ms before sending the SNRM request:
• Log: 13:40:35.502 Info Open
• Log: 13:40:36.510 Sent 7E A0 07 03 03 93 8C 11 7E
4. This 1-second delay is too long for the meter. It times out and returns to sleep mode.
InactivityTimeout and FrameDelay are already set to 0.
Is there a hidden parameter or a way to eliminate this hardcoded 1000ms delay after the port reopen, so the SNRM can be sent immediately?
Best regards,
Frank
here the Log:
13:40:31 01:40:31.378 Info Opening
13:40:31 01:40:31.378 Info Einstellungen für die serielle Schnittstelle: Portname: COM19 Baudrate: 300 Daten Bits: 7 Parität: Even Stopp-Bits: One Ablaufsteuerung: None Eop: None
13:40:31 01:40:31.388 Info Open
13:40:32 01:40:32.399 Sent 2F 3F 21 0D 0A
13:40:32 01:40:32.736 Received 2F
13:40:32 01:40:32.784 Received 2F
13:40:32 01:40:32.816 Received 49
13:40:32 01:40:32.848 Received 48
13:40:32 01:40:32.880 Received 4D
13:40:32 01:40:32.912 Received 35
13:40:32 01:40:32.944 Received 5C
13:40:32 01:40:32.976 Received 32
13:40:33 01:40:33.008 Received 49
13:40:33 01:40:33.041 Received 6E
13:40:33 01:40:33.072 Received 68
13:40:33 01:40:33.105 Received 65
13:40:33 01:40:33.137 Received 20
13:40:33 01:40:33.184 Received 4D
13:40:33 01:40:33.216 Received 65
13:40:33 01:40:33.248 Received 74
13:40:33 01:40:33.280 Received 65
13:40:33 01:40:33.312 Received 72
13:40:33 01:40:33.344 Received 0D
13:40:33 01:40:33.344 Sent 06 32 35 32 0D 0A
13:40:35 01:40:35.358 Info Closing
13:40:35 01:40:35.486 Info Closed
13:40:35 01:40:35.486 Info Opening
13:40:35 01:40:35.486 Info Einstellungen für die serielle Schnittstelle: Portname: COM19 Baudrate: 9600 Daten Bits: 8 Parität: None Stopp-Bits: One Ablaufsteuerung: None Eop: None
13:40:35 01:40:35.502 Info Open
13:40:36 Send SNRM request.
TX: 7E A0 07 03 03 93 8C 11 7E
13:40:36 01:40:36.510 Sent 7E A0 07 03 03 93 8C 11 7E
13:40:41 Failed to receive reply from the device in given time.
13:40:41 Send Disconnect request.
TX: 7E A0 07 03 03 53 80 D7 7E
13:40:41 01:40:41.519 Sent 7E A0 07 03 03 53 80 D7 7E
13:40:46 Failed to receive reply from the device in given time.
13:40:46 01:40:46.531 Sent 01 42 30 03 0D 0A

Profile picture for user Kurumi

Kurumi

1 month 2 weeks ago

Hi, This one second works…

Hi,

This one second works with most meters, and it's not currently configurable. The new version is under construction, but it's essentially a new product, so I can't say exactly when it will be released.

In the meantime, you can change this in the source code.

Regards,
Mikko

Frank G

1 month 1 week ago

Hi Mikko, Thank you for your…

Hi Mikko,
Thank you for your quick reply!
Since I am modifying the source code of the GXDLMSCommunicator anyway, I did a deep dive into the timing behavior and found the root cause of why this hardcoded delay fails with InheMeter devices and USB-to-RS232 adapters.
To verify this, I even tested the setup on a Raspberry Pi 5 running Linux using socat and a custom Python bridge. Under Linux, the port re-initialization takes less than 5ms compared to Windows, which proved that the entire issue is a race condition between the serial driver lag and the hardcoded delays in Gurux.
There are two major issues in the current Windows source code implementation of InitializeIEC() that prevent a successful connection:
1. The .Close() / .Open() Flush Race Condition
At 300 baud, sending the 6-byte ACK packet (06 32 35 32 0D 0A) takes exactly 200ms (6 bytes × 33.3ms/byte). In the original source code, Gurux immediately calls this.media.Close() after media.Send(array2, null). Under Windows, calling .Close() instantly purges the hardware transmit buffers.
Because of this, the final bytes (like 0A) are cut off before physically leaving the optocoupler's LED. The meter receives an incomplete ACK, refuses to switch to 9600 baud, and remains at 300 baud.
2. The Hardcoded 1000ms Delay vs. Serial Driver Lag
When using an external USB-to-RS232 adapter under Windows, the OS driver can take up to 300ms–700ms just to release and re-initialize the COM port registers during the Close() / Open() cycle.
If we add the hardcoded 1000ms delay on top of that driver lag, the total elapsed time between the ACK and the SNRM request approaches 1.5 to 1.8 seconds. InheMeter firmware enforces a strict 300ms–500ms inactivity timeout after a Mode E handshake. By the time Gurux finally fires the SNRM frame, the meter has already gone back to sleep.
How I fixed it in the source code:
I successfully resolved the issue by making the following adjustments inside the lock(obj) block of InitializeIEC():
csharp
// 1. Give the 300-baud ACK packet enough time to fully transmit physically
Thread.Sleep(300);

if (gxserial != null)
{
this.media.Close();
gxserial.BaudRate = num2;
gxserial.DataBits = 8;
gxserial.Parity = System.IO.Ports.Parity.None;
gxserial.StopBits = System.IO.Ports.StopBits.One;
this.media.Open();

// Force DTR/RTS to keep the optocoupler powered after reopening
gxserial.DtrEnable = true;
gxserial.RtsEnable = true;

gxserial.DiscardInBuffer();
gxserial.DiscardOutBuffer();
}

// 2. Reduce the wakeup/settling delay from 1000ms to 100ms
Thread.Sleep(100);
Verwende Code mit Vorsicht.
With a 300ms delay before closing (ensuring complete ACK transmission) and a 100ms delay after opening (giving the transceiver time to settle at 9600 baud), the connection with the InheMeter works instantly and flawlessly under Windows!
Please consider making this post-open delay configurable or reducing it in the upcoming version, as modern meters are becoming increasingly strict regarding Mode E timeout windows.
Best regards,
Frank

Profile picture for user Kurumi

Kurumi

1 month ago

Hi Frank, 1. The wait time…

Hi Frank,

1. The wait time is 2 seconds. Receive waits until the meter has sent the reply.

2. IEC standard says that the time window is 200-1500 ms. In that time the meter must send the reply. This is actually the main problem. There are a lot of different USB drivers, and some of them are poorly implemented, and it might take a long time to open and close the connection.

This combination works with a wide range of meters and USB converters, and for that reason there is a one-second delay by default.

DtrEnable and RtsEnable are set to true when the connection is open by the GXSerial component.

One thing that caught my attention in your example is that IEC specifies the default serial port settings as 300 baud, 7 data bits, even parity, and 1 stop bit (300 7E1).

Check those.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 11/19/2026 - 10:57
    Gurux.DLMS.Python 1.0.204
  • Thu, 11/19/2026 - 10:12
    gurux.dlms.c 9.0.2611.1901
  • Tue, 10/13/2026 - 12:00
    gurux.dlms.java 4.0.97
  • Tue, 09/22/2026 - 14:02
    Gurux.DLMS.Net 9.0.2609.2201
  • Mon, 09/21/2026 - 10:18
    Gurux.DLMS.Net 9.0.2609.2101

New forum topics

  • Sumo Balls Pro Billiards | WA 083148835648
  • Dobilliard | WA 083148835648
  • AvengingXen Pool at Zeus Billiard & Cafe Alam Sutera | WA 083148835648
  • JIMMY JUSMAN | WA 083148835648
  • MAXX CUES (SERVIC STICK BILLIARD) | WA 083148835648
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin