Hello i have a problem when i implement de exception to my connection with the device using the protocol pymodbus tcp v3.4.
I need that when the device is not connected, the program shows me that the device is not connected and that it waits to be connected.
this is my code for python:
# ciclo para la conexion con la pantalla HMI
def conexion(self):
while(True):
try:
clientCon= self.client.connect()
except ConnectionException:
print("conexion fallida")
pass
else:
self.client.write_coil(address=0, value=clientCon, unit=self.UNIT)
return clientCon
question from:
https://stackoverflow.com/questions/65904865/how-to-write-an-exception-for-the-pymodbus-via-tcp-connection-protocol-where-it 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…