예제 #1
0
    def _on_message(self, client, userdata, msg):
        #print "[Debug] %s\t%s" % (msg.topic, msg.payload)

        if msg.topic in MQTT_TOPICS.keys():
            data = mqtt_parse_message(MQTT_TOPICS[msg.topic], msg.topic, msg.payload)
            if data != None:
                self._dbmanager.insert_message(data['time'], msg.topic, data['value'])
예제 #2
0
    def _on_message(self, client, userdata, msg):
        #print "[Debug] %s\t%s" % (msg.topic, msg.payload)

        if msg.topic in MQTT_TOPICS.keys():
            data = mqtt_parse_message(MQTT_TOPICS[msg.topic], msg.topic, msg.payload)
            if data != None:
                timestamp = js_timestamp(data['time'])
                self._socketio.emit("mqtt_message", {'topic' : msg.topic, 'time': timestamp, 'value': data['value']})
예제 #3
0
    def start(self, threadded = True):
        for topic in MQTT_TOPICS.keys():
            self._dbmanager.insert_topic(topic)

        super(MQTTDatabaseRunner, self).start(threadded)
예제 #4
0
 def _on_connect(self, client, userdata, flags, rc):
     for topic in MQTT_TOPICS.keys():
         print "[Info] Subscribing to %s" % topic
         client.subscribe(topic)