def __init__(self, userClient, bindAddress): self.userClient = userClient self.bindAddress = bindAddress self.auth = auth.Auth() self.auth.Authenticate(self.userClient) self.message = Messaging.Messaging(self.userClient) self.status = self.message.InitializeMQTT() self.zmqSub(self.message, self.bindAddress)
def authWithClearBlade(): authCB = auth.Auth() userClient = Client.UserClient("c8bdc0f60ad0ddd88c8da2e7b6e701", "C8BDC0F60AE6A4EF9EA2CF8F8816", "*****@*****.**", "PASSWORD", "PLATFORM_URL") authCB.Authenticate(userClient) return userClient
def Connect(self): cbAuth = auth.Auth() #Authenticate using device auth device = Client.DevClient(self.systemKey, self.systemSecret, self.username, self.password, self.platformURL) cbAuth.Authenticate(device) messagingClient = Messaging.Messaging(device) messagingClient.InitializeMQTT() return messagingClient
def _init_cb(self): # first authenticate to CB using device auth cb_auth = auth.Auth() if self.cb_device_client is None: self.cb_device_client = Client.DeviceClient(self.credentials['systemKey'], self.credentials['systemSecret'], self.credentials['deviceName'], self.credentials['activeKey'], self.credentials['platformURL']) cb_auth.Authenticate(self.cb_device_client) # init cb mqtt # if self.mqtt is None: # self.mqtt = MQTT(self.credentials) # init bacnet devices (comes from cb collection) if self.bacnet_devices is None: self.bacnet_devices = BACnetDevices(self.cb_device_client, self) # init bacnet sensors (comes from cb devices table) if self.bacnet_sensors is None: self.bacnet_sensors = BACnetSensors()
def __init__(self, userClient, bindAddress): self.userClient = userClient self.bindAddress = bindAddress self.auth = auth.Auth() self.auth.Authenticate(self.userClient) self.message = Messaging.Messaging(self.userClient) self.message.printValue() self.status = self.message.InitializeMQTT(keep_alive=60) context = zmq.Context() # Define the socket using the "Context" self.sock = context.socket(zmq.PUB) print "Bind Address is " + bindAddress self.sock.bind(bindAddress) self.mqttSub(self.message, self.sock)
import OpenOPC import socket import clearblade from clearblade import auth from clearblade import Client from clearblade import Messaging from time import sleep gateway = "127.0.0.1" opcHost = "127.0.0.1" auth = auth.Auth() userClient = Client.UserClient("acc19f800bd2d69febc2c6869309", "ACC19F800BC4FAAFECEDF1EAAB4F", "*****@*****.**", "clearblade", "http://192.168.0.82:9000") auth.Authenticate(userClient) message = Messaging.Messaging(userClient) message.printValue() message.InitializeMQTT() opcServer = 'Matrikon.OPC.Simulation' taglist = ['Triangle Waves.UInt2'] print "Connecting to OPC gateway" opcConnect = OpenOPC.open_client(gateway) opcConnect.connect(opcServer, opcHost)