Am hoping someone can point me in the right direction, I am trying to run a shell command to turn off the printer PSU using a I2C controlled relay
(mLink 2ch relay from Hobbycomponents)
I have written scripts for on and off and tested them via SSH in CMD, both on and off work there.
I’ve enabled shell commands via KIAUH and linked the scripts in the shellcommand.cfg.
The issue occurs when I try run the gcode command relay0on in klipper I receive:
Unknown command:“RELAY0”
i assume my gcode phrasing is wrongsome where but after checking and double checking for quite a while I’m stumped. Any help greatly appreciated.
Thankyou
thanks, been scanning over shell command documents and missed that entirely.
i did have to add “python” to the begining of the file address in the command line as well, but all working perfectly now.
Glad that it works now.
FWIW, it seems strange to call a file .sh, which typically indicates a bash or shell script, but then run it with the Python interpreter. This suggests that the content is actually Python, and naming it with a .py extension might be clearer.
You can typically avoid adding the interpreter by setting the file as executable (chmod u+x <your_file_name>) and adding a shebang to it.
Cheers. changed file type and edited shebang (had used wrong one in script). All working and clear.
Looks like shell commands cant be used to power off the printer without triggering MCU error unless im mistaken?
Sorry, i think my query was poorly worded. the Rpi and Printer are on separate power sources, id like to turn off the printer mcu and leave the pi on, and still be able to access mainsail. It looks posible via [power printer] in moonraker using certain devices, but looks like shell_commands or i2c relay not supported. i did come accross Jaj0’s Http server work around
[moonraker-cli-switch-server] (GitHub - Jaj0/moonraker-cli-switch-server: How to control a arbitrary power switch using shell command through http for 3d printer using moonraker) which may work for my needs.
just wanted to know if there wwas an official was to go about this of if there was likley to be future support for such a method?