Merge pull request #77 from brbjr1/master
Added REST method to get regular outputs statuses
This commit was merged in pull request #77.
This commit is contained in:
@@ -98,6 +98,19 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin,
|
||||
self.updateOutputUI()
|
||||
return flask.make_response("Ok.", 200)
|
||||
|
||||
@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 getOutputStatusresult:
|
||||
getOutputStatusresult = getOutputStatusresult + ', '
|
||||
getOutputStatusresult = getOutputStatusresult + '"' + str(pin) + '": ' + str(val).lower()
|
||||
return '{' + getOutputStatusresult + '}'
|
||||
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/getEnclosureTemperature", methods=["GET"])
|
||||
def getEnclosureTemperature(self):
|
||||
return str(self.enclosureCurrentTemperature)
|
||||
|
||||
Reference in New Issue
Block a user