-
-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support: system commands #84
Comments
I'm planning on adding an user-defined command that can trigger custom scripts from UI. This feature is also mentioned in #75. Please stay tuned for further updates. |
good to hear that it's in the pipeline.... |
This feature is added in 95698eb, and later it will be published in 1.8.10 release. An example configuration (i.e. {
"state": {
"checkForUpdates": true
},
"commands": [
{
"text": "Reboot",
"command": "/sbin/reboot"
},
{
"text": "Shutdown",
"command": "/sbin/shutdown"
}
],
"macros": [],
"users": []
} |
great. is there a way to update to non release versions (live on the edge) ? |
If you're willing to use the latest changes in the master branch, you can git clone this project on RPi, and run I will publish a new release within two days. Please stay tuned for further updates. |
I did that, but got a bunch of errors... I'll just be patient and wait until you do a release :D |
Just to let you know for security considerations, I didn't provide a page to add a shell command directly from the web interface, or hackers might be able to execute arbitratry commands or scripts on the server. You have to manually update ~/.cncrc file to add or remove commands for the time being. |
that's perfectly fine. |
@cheton It would be nice to have feedback / console output in CNC gui. Also, here are my commands (includes CNC & System update)
|
I'm also thinking about opening a new browser window (or notifications) to receive stdout output, might try to add it in a later release. In addition to WebSockets, SSE (Server-Sent Events) might be an alternative solution to it, browsers can receive server-sent event notifications automatically. Some discussions on stackoverflow: |
SSE or websockets would be nice if you want to see it while it's happening, but just hosting the log as a text file when it ends might be very vey useful, with little effort. Also, you might not want to see the output by default, just success/failure, with an option to check the output. I feel like this is related, but maybe it's not, what about starting stopping commands based on the states of the CNC machine? I'd like to make a timelapse, while cutting, and I could do that if I could call a script when the gcode starts, finishes, or errors. I hope I'm not hyjacking this issue, or if I just haven't read enough docs to find the way you already provide to do this. I have used something similar with octoprint, they have a very good set of events that I use to turn lights on and off, or send a notification, or whatever I want. |
OctoPrint Events |
I just made a reference to OctoPrint's events. How about adding some events to the ~/.cncrc file which might look like the following? You can send certain gcode lines or run a script once an event triggered. {
"events": [
{ // Load
"event": "command:load",
"trigger": "gcode",
"command": "G21 ; use millimeters\n$H",
},
{ // Unload
"event": "command:unload",
"trigger": "gcode",
"command": [ // array
"M5" // spindle stop
]
},
{ // Start
"event": "command:start",
"trigger": "system",
"command": "/path/to/script"
},
{ // Stop
"event": "command:stop",
"trigger": "system",
"command": "/path/to/script"
},
{ // Pause
"event": "command:pause",
"trigger": "system",
"command": "/path/to/script"
},
{ // Resume
"event": "command:resume",
"trigger": "system",
"command": "/path/to/script"
}
]
} |
That looks very useful. Some thoughts: |
Thank you for your input. From my original thoughts, events management should be done on the UI, not from a text editor. This can help avoid confusion. The trigger type (i.e. "system" or "gcode") can be used to differentiate between gcode and system calls, both of them can be a multi-line text input control separated by a line break. For examples:
The gcode trigger can also be used to support M6 tool change command (#118) that's similar to the use case you mentioned above. |
In the next few days, I'm going to add preliminary support for event trigger, which includes the following events: gcode:load Did you find anything useful but missing in above list? |
Sorry I didn't respond sooner, I've had a lot on my plate. These look like they are enough for my needs. I'm planning on starting a timelapse when gcode:start and then stopping it on gcode:stop. That happens when the gcode finishes not just when I stop it, right? I might also add a pushbullet or slack notification on gcode:stop as well. If I stretch my head, I could see an event when the cnc.js starts as being useful. An event for specific gcode, like M6 might be good too. I could have it send me a notification when it needs a tool change. I haven't done a tool change yet, but that seems useful. I'll see if I can pull these changes onto my CNC today or tomorrow. Thanks. |
This feature is available in 1.9.0-alpha.3, but the management UI is not implemented yet. I will add this part in 1.9.0-beta or the final 1.9.0 release. |
The Event Trigger configuration UI was added in v1.9.0-alpha.4. I will publish a new alpha release to NPM later. |
Commands and events configuration UI are now available in 1.9.0-alpha.5. |
Is there any way to add custom command that can be somehow called via the web UI ?
I have a RPi GPIO that turns on/off power for the cnc. I would like to have a way to switch that via the (so awesome) cnc ui
The text was updated successfully, but these errors were encountered: