diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index cb74da3..05ad98d 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -101,15 +101,14 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, @octoprint.plugin.BlueprintPlugin.route("/getOutputStatus", methods=["GET"]) def getOutputStatus(self): getOutputStatusresult = '' - for rpi_output in self.rpi_outputs: pin = self.toInt(rpi_output['gpioPin']) if rpi_output['outputType']=='regular': val = GPIO.input(pin) if not rpi_output['activeLow'] else (not GPIO.input(pin)) - if not getOutputStatusresult: + if getOutputStatusresult: getOutputStatusresult = getOutputStatusresult + ', ' getOutputStatusresult = getOutputStatusresult + '"' + str(pin) + '":' + str(val) - return '{' + getOutputStatusresult + '}' + return flask.jsonify('{' + getOutputStatusresult + '}') @octoprint.plugin.BlueprintPlugin.route("/getTest", methods=["GET"])