diff --git a/devices/clients/opcua_connection.py b/devices/clients/opcua_connection.py index c5fa45507afc60dedb21c2d972861acedee827de..cfd8d003bd511c432a97ace3474868c8e2defb50 100644 --- a/devices/clients/opcua_connection.py +++ b/devices/clients/opcua_connection.py @@ -97,7 +97,10 @@ class OPCUAConnection(CommClient): ping the client to make sure the connection with the client is still functional. """ try: - self.client.send_hello() + if self.connected is True: + self.client.send_hello() + else: + self.streams.debug_stream("Will not ping OPC-UA server {} because the connection is inactive.".format(self._servername())) except Exception as e: raise Exception("Lost connection to server {}.".format(self._servername())) from e