Skip to content
jneilliii edited this page May 5, 2020 · 3 revisions

OctoPrint-TPLinkSmartplug uses the OctoPrint SimpleAPIPlugin mixin for API.

Available API Commands

turnOn (POST)

Turn the smartplug device on. Requires additional parameter ip.

turnOff (POST)

Turn the smartplug device off. Requires additional parameter ip.

checkStatus (POST or GET)

Check the status of smartplug. Requires additional parameter ip.

enableAutomaticShutdown (POST)

Enables automatic power off option.

disableAutomaticShutdown (POST)

Disables automatic power off option.

abortAutomaticShutdown (POST)

Aborts an automatic power off once automatic power off timer has started.

cURL Examples

curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"turnOn", "ip":"<ip of smartplug in settings>" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"turnOff", "ip":"<ip of smartplug in settings>" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"checkStatus", "ip":"<ip of smartplug in settings>" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X GET -d '{ "checkStatus":"<ip of smartplug in settings>" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"enableAutomaticShutdown" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"disableAutomaticShutdown" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"abortAutomaticShutdown" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/tplinksmartplug
Clone this wiki locally