OctoPrint API Access


#1

First off, I love Astroprint. I am working on using my RPI to turn my printer on and off automatically. This requires API access to monitor the current state at certain intervals. Is it possible to access the OctoPrint API via Astroprint? I have tried adding api: enabled: true and api: apikey: xxxx (using a self-made key) to /etc/astrobox/config.yaml and it indicates it is an invalid key if I try using it. Any suggestions?


#2

@Austin we’ll look into this. We haven’t yet used the Octoprint API outside of the AstroBox webapp itself.


#3

I actually got it working by copying an existing API key from another OctoPrint instance. So I guess this more boils down to the absence of a way to generate that key from AstroPrint.


#4

Hello Austin, would you be so kind as to point me in the right direction so as to be able to power on/off my printer with the relay and API?
Thank you.


#5

I would like to bump this topic as this has become an area of interest for me lately.
I have an AXIOM from Airwolf which makes use of Astroprint - everything is set up by them from the factory, including the Astroprint install, so I will have to dig in and see how I can access it (if it is even possible) for me to tweak.
I am looking to enable Octoprint’s API as well since I had a few tricks done there with my previous 3D printer that I would love to have with the AXIOM as well.
If Astroprint supported generating an API key and enabling Octoprint’s API access, along with Astroprint’s own API, I can only see a winning combination all around.

Is there any progress to report regarding these areas?

Before you read the following, I hope that your sense of high power electronics is up to par, I don’t want you to electrocute yourself while doing any of this!

I have something like this on a Makerfarm Prusa i3v 12" - for this to work properly, you need to enable this in your Marlin firmware (for the 3D printer) - though I believe it will depend a lot on your printer electronics (if you have a RAMBo 1.2+ then you are golden).
Basically, you will be sending M80 for power on, M81 for power off (you need to add M80 to your start G-code if your firmware does not do this for you automatically) - from there, if you have your pins set up properly in your firmware, you can attach a relay to the corresponding pin on your electronics board and it will activate/deactivate according to the G-code commands mentioned earlier (M80/M81).
Do note that you will still need to be supplying 5v to the logic side of your electronics for this to work!
It sounds like a lot, but once you see this working, it is awesome and will save you power if your power supply is not efficient, along with no fan noise if your power supply runs a fan every-so-often.
I’ll try and attach a few pictures (or a video) of this working a bit later - along with a few wiring diagrams.

Edit:
I’ll be working on those pictures/video and diagrams sometime today, had a few things to take care of first.


#6

Cant wait for the write up/vid!


#7

Been a bit busy and all with holiday prep, but yes, as soon as I can I’ll get that put together.


#8

No rush! I won’t be doing much till after the season as well, but I must say this is the only feature I have been real excited for Noob or not I must get it woking lol