Hi Mikko!
Please help me with the following question.
I am using the standard example from the Gurux.DLMS.Client.Example.python library.
To simplify the example, I added only the reading of the serial number of the meter. And everything works fine.
Next, I enclose the code in the endless loop, so that after each successful connection and reading of the serial number, the script does not terminate, but prompts the user to press the ENTER button to repeat the operation.
And in this case, everything goes well too.
But! If after the first (second, third) successful reading I remove the optical head from the counter, the connection fails (and this is correct). If after this I run it again, it crashes. In this case, it does not matter whether the optical head is installed on the counter or not.
Apparently, some critical exception (interruption) occurs.
I would like the infinite loop not to terminate even in this case, but just prompt the user to press the ENTER button and repeat the operation.
I even formatted the part of code in the TRY-EXCEPT construction, but for some reason this exception is not caught and the program terminates.
Here is a code with endless loop:
class sampleclient(): …
I suppose the reason should…
I suppose the reason should be looked for somewhere in the module "GXDLMSReader.py".
Terminal output when connection is successful:
Terminal output when connection is fail:
Hi, The old connection is…
Hi,
The old connection is still open. You need to wait until the inactivity time has expired before you can re-read the meter. The meter doesn't reply as long as the old connection is active.
https://gurux.fi/Gurux.DLMS.Objects.GXDLMSIecHdlcSetup
BR,
Mikko