def __init__(self, topics, client_id='mqtt-client', clean_session=True, qos=0, queue=None):
    info('mqtt', 'init')
    self.connected = False
    self.qos = qos
    self.queue = queue
    self.subscribe = (queue != None)
    if isinstance(topics, basestring):
        topics = topics.split(',')
    self.topics = topics
    client_id = ((client_id + '-') + str(random.randint(1000, 9999)))
    self.client = mqtt.Client(client_id=client_id, clean_session=clean_session)
    self.client.on_connect = self.on_connect
    self.client.on_disconnect = self.on_disconnect
    self.client.on_message = self.on_message
    self.client.on_publish = self.on_publish
    self.client.on_subscribe = self.on_subscribe
def __init__(self, topics, client_id='mqtt-client', clean_session=True, qos=0, queue=None):
    info('mqtt', 'init')
    self.connected = False
    self.qos = qos
    self.queue = queue
    self.subscribe = (queue != None)
    if isinstance(topics, basestring):
        topics = topics.split(',')
    self.topics = topics
    client_id = ((client_id + '-') + str(random.randint(1000, 9999)))
    self.client = mqtt.Client(client_id=client_id, clean_session=clean_session)
    self.client.on_connect = self.on_connect
    self.client.on_disconnect = self.on_disconnect
    self.client.on_message = self.on_message
    self.client.on_publish = self.on_publish
    self.client.on_subscribe = self.on_subscribe