Hello!
I want to use this package for OPCUA Client and Server and I don't know how to use this module for getting value from sensor and publish this in the cloud platform.
could you please help me?
this is my server python code. "X" is the part for MQ2 module and I have to complete this.
from opcua import Server
import time
from gas_detection import GasDetection
X = MQ2
server = Server()
url = "opc.tcp://xxx.xxx.x.xxx:4840"
server.set_endpoint(url)
name = "OPCUA server"
addSpace = server.register_namespace(name)
node = server.get_objects_node()
param = node.add_object(addSpace, "Parameters")
var = param.add_variable(addSpace, "Variable", X)
var.set_writable()
server.start()
try:
while True:
v = var.get_value()
print("Variable =" .format(v))
time.sleep(0.25)
except KeyboardInterrupt:
print('\nAborted by user!')
Hello!
I want to use this package for OPCUA Client and Server and I don't know how to use this module for getting value from sensor and publish this in the cloud platform.
could you please help me?
this is my server python code. "X" is the part for MQ2 module and I have to complete this.
from opcua import Server
import time
from gas_detection import GasDetection
X = MQ2
server = Server()
url = "opc.tcp://xxx.xxx.x.xxx:4840"
server.set_endpoint(url)
name = "OPCUA server"
addSpace = server.register_namespace(name)
node = server.get_objects_node()
param = node.add_object(addSpace, "Parameters")
var = param.add_variable(addSpace, "Variable", X)
var.set_writable()
server.start()
try:
while True:
except KeyboardInterrupt:
print('\nAborted by user!')