예제 #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']})