#!/usr/bin/env python3 import pyads def main(): # # 192.168.999.999 # Port: 851 (TC3) # plc = pyads.Connection( '192.168.999.999.1.1', 851) # TC3 Port 851 plc.open() for elm in [ "MAIN.temp_water_read", "MAIN.temp_water_set", "MAIN.message", "MAIN.flow_water", "MAIN.motor_status", "MAIN.motor_switch", ]: ret = plc.read_by_name( elm) print( "%s -> %s" % ( elm, repr( ret))) ret = plc.write_by_name( "MAIN.temp_water_set", 123) ret = plc.write_by_name( "MAIN.motor_switch", False) for elm in [ "MAIN.temp_water_read", "MAIN.temp_water_set", "MAIN.message", "MAIN.flow_water", "MAIN.motor_status", "MAIN.motor_switch", ]: ret = plc.read_by_name( elm) print( "%s -> %s" % ( elm, repr( ret))) ret = plc.write_by_name( "MAIN.temp_water_set", 234) ret = plc.write_by_name( "MAIN.motor_switch", True) plc.close() return if __name__ == "__main__": main()