I created a simple Server in Python using FreeOPC Library . UaExpert can connect to the server and read the parameter just fine but the Datatype is incorrect. The server code just writes a simple random integer into a temperature variable but UA is interpreting it as Datetime. I know that my code is generating the data as an 'int' , ive pasted it below just for reference, is there anyway to specify for change the data type in UaExpert?
Code: Select all
from site import addsitepackages
from opcua import Server
from random import randint
import datetime
import time
server = Server()
#Define ip address and port number [xxx.xxx.x.xxx : xxxx]
# [ip address:port]
url = "opc.tcp://170.168.215.37:4840"
server.set_endpoint(url)
#Set name and assign to address space
name = "OPCUA_Simulation_Server"
addspace = server.register_namespace(name)
#Root Node as defined in address space
node = server.get_objects_node()
#Store parameters in node, these are the values that the client will look at
param = node.add_object(addspace, "Parameters")
#Identify parameter or variable
Temp = param.add_variable (addspace, "Temperature", 0)
#Making the Variables Writeable
Temp.set_writable()
Press.set_writable()
Time.set_writable()
#Start the server
server.start()
print("Server Started at {}".format(url))
#Assign Random Values to Variables While True
while True:
Temperature = randint(10,95)
Temp.set_value(int(Temperature))
print("Temperatue is:" , type(Temperature), Temperature)
time.sleep(2)