I currently dont have access to the plc that would be implemented and am unable to find much on the internet that covers reading discrete inputs. What im aiming for is something that will detect when a prox switch is turned on which could =true or 1 then to execute a file that runs an automated entry for a workorder. Also for it to perpetually scan and read the status what would be implemented to do so? I'm essentailly brand new to python and managed to figure out selenium but without having a plc to play with its difficult to just figure it out. Thanks in advance!
from pymodbus.client.sync import ModbusTcpClient
import os
host = '100.100.110.104'
port = 502
client = ModbusTcpClient(host, port)
while True:
client.connect()
rr = client.read_discrete_inputs(1000,1,unit=1)
data= rr.bits[0]
if data = 1
os.system('python AUTOMATED.pyw')
time.sleep(5)