def on_connect(self, client, userdata, flags, rc):
    info('mqtt', ('on_connect ' + str(rc)))
    if (rc == MQTT_ERR_SUCCESS):
        self.connected = True
    if self.subscribe:
        subs = []
        for topic in self.topics:
            info('mqtt', ((('subscribe: channels/' + topic) + '/messages, qos: ') + str(self.qos)))
            subs.append(((('channels/' + topic) + '/messages'), self.qos))
        info('mqtt', ('subscriptions: ' + str(subs)))
        self.client.subscribe(subs)
def on_connect(self, client, userdata, flags, rc):
    info('mqtt', ('on_connect ' + str(rc)))
    if (rc == MQTT_ERR_SUCCESS):
        self.connected = True
    if self.subscribe:
        subs = []
        for topic in self.topics:
            info('mqtt', ((('subscribe: channels/' + topic) + '/messages, qos: ') + str(self.qos)))
            subs.append(((('channels/' + topic) + '/messages'), self.qos))
        info('mqtt', ('subscriptions: ' + str(subs)))
        self.client.subscribe(subs)