Skip to content

Instantly share code, notes, and snippets.

0432d5917f7f99e3acdc55a7a7d59b628dfd7558c23efc80dc157242f7e0031e59c0f7f96dd4654c9b64e48a6365a25be3e194bf0233b9829f7832af6820b925b2
@nhimf
nhimf / mqtt-to-influx.py
Created February 4, 2016 21:08
Very crude Python script to transfer data from mqtt to InfluxDB
import paho.mqtt.client as mqtt
from influxdb import InfluxDBClient
import datetime
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.