def pluginRequest(): Functions.log("DBG", "Start plugin request", "CORE") singleton = Singleton() for plugin in singleton.plugins: plugin.runPlugin() influxData = plugin.influxData() Functions.timeoutF(sendToInflux(influxData), 2) Functions.timeoutF(sendToMqtt(influxData), 2)
def poolingRequest(): Functions.log("DBG", "Start pooling request", "CORE") singleton = Singleton() singleton.QPIGS = Functions.command("QPIGS", "") json_body = [{ "measurement": "pimpMySuperWatt", "tags": { "hostname": singleton.hostName, "version": singleton.version, "qpi": singleton.QPI, "qid": singleton.QID, "qfw": singleton.QVFW, "qfw2": singleton.QVFW2, "url": "http://" + singleton.ip + ":" + str(singleton.parameters["httpPort"]), "instance": singleton.parameters["instance"] }, "fields": singleton.QPIGS }] json_body_parameters = [{ "measurement": "pimpMySuperWatt_Parameters", "tags": { "hostname": singleton.hostName, "version": singleton.version, }, "fields": { "qpi": singleton.QPI, "qid": singleton.QID, "qfw": singleton.QVFW, "qfw2": singleton.QVFW2, "url": "http://" + singleton.ip + ":" + str(singleton.parameters["httpPort"]), "instance": singleton.parameters["instance"], "debug": singleton.parameters["debug"], "communicationClass": singleton.parameters["communicationClass"], "portPath": singleton.parameters["portPath"], "webserver": singleton.parameters["webserver"], "webserverDebug": singleton.parameters["webserverDebug"], "webClass": singleton.parameters["webClass"], "httpBind": singleton.parameters["httpBind"], "queryPoolingInterval": singleton.parameters["queryPoolingInterval"] } }] try: Functions.timeoutF(sendToInflux(json_body), 2) except Exception as err: Functions.log("ERR", "Error when sending json_body to influxdb " + str(err), "CORE") try: Functions.timeoutF(sendToInflux(json_body_parameters), 2) except Exception as err: Functions.log( "ERR", "Error when sending json_body_parameters to influxdb " + str(err), "CORE") try: Functions.timeoutF(sendToMqtt(json_body), 2) except Exception as err: Functions.log("ERR", "Error when sending json_body to mqtt " + str(err), "CORE") try: Functions.timeoutF(sendToMqtt(json_body_parameters), 2) except Exception as err: Functions.log( "ERR", "Error when sending json_body_parameters to mqtt " + str(err), "CORE")