from opcua import Server from random import randint import time import datatime server = Server() url = "opc.tcp://192.168.0.10:4840" server.set_endpoint(url) name = "OPCUA_sERVER" addspace = server.register_namespace(name) node = server.register_namespace(name) Param = node.add_object(addspace, "Parameters") Temp = Param.add_variable(addspace,"Temperatura",0) Press = Param.add_variable(addspace,"PresiĆ³n",0) Time = Param.add_variable(addspace,"Tiempo",0) Tem.set_writable() Press.set_writable() Time.set_writable() server.start() print("Server started at {}".format(url)) while True: Temperatura = randint(12,48) Presion = randint(200,999) Tiempo = datatime.datatime.now() print(Temperatura,Presion, Tiempo) Tem.set_value(Temperatura) Press.set_value(Pressure) Time.set_value(Time) time.sleep(2)