From e98f298f21bc71cd7f27374318aee7a011b3bc2b Mon Sep 17 00:00:00 2001 From: Dennis Eisold <de@itstall.de> Date: Mon, 27 Jan 2020 13:52:29 +0100 Subject: [PATCH] Update mqtt2influx.py --- mqtt2influx.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/mqtt2influx.py b/mqtt2influx.py index 2a875d9..0742d4a 100644 --- a/mqtt2influx.py +++ b/mqtt2influx.py @@ -22,27 +22,18 @@ config_set = "mqtt_to_influx" mqtt_server = config[config_set]['mqtt_setting'] influx_server = config[config_set]['influxdb_setting'] -def iterate(dictionary): - for key, value in dictionary.items(): - if isinstance(value, dict): - iterate(value) - continue - print('key {!r} -> value {!r}'.format(key, value)) - def on_connect(client, userdata, flags, rc): client.subscribe(config[mqtt_server]['subscribe']) def on_message(client, userdata, msg): - # Use utc as timestamp loaded_json = json.loads(msg.payload.decode("utf-8")) - isfloatValue=False if("wetterstation" in msg.topic and "SENSOR" in msg.topic): print("write to influxDB: wetterstation") print("Sensor: " + msg.topic.split("/wetterstation/")[1].split("/SENSOR")[0]) for key in loaded_json.keys(): - if("PressureUnit" not in key and "TempUnit" not in key and "Time" not in key): + if("Unit" not in key and "Time" not in key): print("Key: " + key) fields = {} -- GitLab