OctoPrint 1.8.1
Python 3.9.0
Windows 10 21H2
Problem
I am using an android device as a webcam, my goal is through the octoprint server I can turn on, turn off the device's camera, control the led light, and activate the autofocus, this through some commands sent in adb, I have tested all these features through individual scripts and they work perfectly, the problem is in the integration with octoprint
Options I have tried
I have consulted 3 different ways that I found to be able to execute system commands in octoprint
Custom control editor
One of them is through the "Custom Control Editor" plugin, adding an option based on script, where I added the script for example to turn on the camera on the device I added .py file in C:\Users\User\AppData\Roaming\OctoPrint\scripts\turn_on.py
, and i add the script in custom control editor as "turn_on.py", but this doesnt works, i saw that this type of system commands is not possible to run from control button section
GCodeSystemCommands
In this second way i tried adding custom G-CODE "OCTO901" to run the file with the following command "C:\Users\User\AppData\Roaming\OctoPrint\scripts\turn_on.py", but when i run this code im getting the following error image
I tried using "start "" C:\Users\User\AppData\Roaming\OctoPrint\scripts\turn_on.py
" same error
And finally using "start "" "C:\Users\User\AppData\Local\Programs\Python\Python39\python.exe" "C:\Users\User\AppData\Roaming\OctoPrint\scripts\turn_on.py"
, not error, but doesnt run the script
system commands
In the config.yaml the System Buttons I confiured the script and it works perfectly, so the problem is implementing this GCodeSystemCommands for using as custom button in Control Tab