Skip to content

Instantly share code, notes, and snippets.

View Shaw007134's full-sized avatar

Shaw Zhang Shaw007134

View GitHub Profile
@Shaw007134
Shaw007134 / mqtt-to-influx.py
Created February 18, 2021 07:46 — forked from nhimf/mqtt-to-influx.py
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.