FreeOpcUa / opcua-client-gui

OPC-UA GUI Client
GNU General Public License v3.0
501 stars 168 forks source link

Graph at opcua-client #39

Open racall79 opened 5 years ago

racall79 commented 5 years ago

Hello,

I am using simple server code at PI.

`from opcua import Server from opcua import ua from random import randint import datetime import time

server = Server()

url = "opc.tcp://192.168.1.119:4840" server.set_endpoint(url)

name = "OPCUA_SIMULATION_SERVER" addspace = server.register_namespace(name)

node = server.get_objects_node()

Param = node.add_object(addspace, "Parameters")

Temp = Param.add_variable(addspace, "Temperature", 0, ua.VariantType.Byte) Press = Param.add_variable(addspace, "Pressure", 0) Time = Param.add_variable(addspace, "Time", 0)

Temp.set_writable() Press.set_writable() Time.set_writable()

server.start() print("Server started at {}".format(url))

while True: Temperature = randint(10, 50) Pressure = randint(200,999) TIME = datetime.datetime.now()

print(Temperature,Pressure,TIME)

Temp.set_value(Temperature)
Press.set_value(Pressure)
Time.set_value(TIME)

time.sleep(2)`

At Linux Mint I am connecting to server via opcua-client. Everything works fine, but I am not able to get any variable to graph. There is always information that this type is not able to put in graph. I was trying also to define another data types. But without any success. Could you please help me where could be a problem?

TNX.

zerox1212 commented 5 years ago

You should inspect the object at your client. OPC UA uses many complex objects. If you want to put a number into a graph you probably are not accessing the actual value.

In OPC UA getting the value often looks likes this. my_val = node_datavalue.Value.Value