Interfacing with Mariner via CLI? #393
-
Is it possible to pass commands to and read states from Mariner via commandline? I think that should allow me to interface it with Node-RED, meaning I can set up all kinds of automation. (Including 'when print finishes, take photo and email it'!) Node-RED's exec node allows you to execute commands at the command line level. I'm sure there's also a way to do that, then read the response. This would mean we wouldn't necessarily need a dedicated Mariner node (though it would certainly be slicker). All the best! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I don't use Node-RED myself, but you should be able to have Node-RED talk to mariner over the web API. The API is mostly meant to be used by the frontend, so there's no guarantees of backwards compatibility. But there's nothing preventing it. For example, if you want to check the print status, you can simply run a request like this: $ curl http://iot-mariner:5000/api/print_status
{
"progress": 0.0,
"selected_file": "spool-part1.ctb",
"state": "IDLE"
} If you want to pause the print, you can run: $ curl -X POST http://iot-mariner:5000/api/printer/command/pause_print You can check the module |
Beta Was this translation helpful? Give feedback.
I don't use Node-RED myself, but you should be able to have Node-RED talk to mariner over the web API. The API is mostly meant to be used by the frontend, so there's no guarantees of backwards compatibility. But there's nothing preventing it.
For example, if you want to check the print status, you can simply run a request like this:
If you want to pause the print, you can run:
You can check the module
mariner.server.api
to see all the API endpoints that are available.