Skip to content
StefanCohen edited this page Oct 9, 2019 · 11 revisions

Everything that can be controlled by UI buttons on the enclosure tab can be controlled by a simple HTML API.

You need to enable API under octoprint settings, it should be under features for the main octoprint settings.

Copy the api key, I'll reference it by {APIKEY} from now on.

You need configure the output from the enclosure setting to be able to use it from the API.

  • Regular GPIO
http://**{URL}**/plugin/enclosure/setIO?status=**{STATUS}**&index_id=**{OUTPUT_ID}**&apikey=**{APIKEY}**

OUTPUT_ID is the automatic generated number id from octoprint-enclosure setting

STATUS is can be true to turn it on and false to turn the output off

You can request all current gpio status with

http://**{URL}**/plugin/enclosure/getOutputStatus?apikey=**{APIKEY}**
  • Temperature control
http://**{URL}**/plugin/enclosure/setEnclosureTempHum?set_temperature=**{SET_TEMP}**&index_id=**{OUTPUT_ID}**&apikey=**{APIKEY}**

SET_TEMP is the set temperature for that temperature control item

  • GCODE
http://**{URL}**/plugin/enclosure/sendGcodeCommand?index_id=**{OUTPUT_ID}**&apikey=**{APIKEY}**
  • PWM
http://**{URL}**/plugin/enclosure/setPWM?new_duty_cycle=**{PWM_VALUE}**&index_id=**{OUTPUT_ID}**&apikey=**{APIKEY}**

PWM_VALUE should be between 0 and 100

  • Neopixel
http://**{URL}**/plugin/enclosure/setNeopixel?red=**{RED_VALUE}**&green=**{GREEN_VALUE}**&blue=**{BLUE_VALUE}**&index_id=**{OUTPUT_ID}**&apikey=**{APIKEY}**

RED_VALUE, GREEN_VALUE and BLUE_VALUE should be a value between 0 and 255

Clone this wiki locally