Ejemplo n.º 1
0
	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)
Ejemplo n.º 2
0
def authWithClearBlade():
    authCB = auth.Auth()
    userClient = Client.UserClient("c8bdc0f60ad0ddd88c8da2e7b6e701",
                                   "C8BDC0F60AE6A4EF9EA2CF8F8816",
                                   "*****@*****.**", "PASSWORD",
                                   "PLATFORM_URL")
    authCB.Authenticate(userClient)

    return userClient
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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()
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
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)