What is the problem?
The Fan Speed Mirror plugin monitors the .gcode for M106 and M107 commands. For each command, a script is executed via:
self._logger.debug("Executing (" + cmd_line + ")")
try:
r = subprocess.call([self.M106command, str(fanPwm)])
if r < 0:
self._logger.error("Error executing command %s: %s" % (cmd_line, r))
except OSError as e:
self._logger.exception("Exception executing command %s: %s" (cmd_line, e))
The hardware I am using, Adafruit DC and Stepper Motor HAT for Raspberry Pi now requires that the libraries be installed in a venv.
When the command passed to the subprocess.call
attempts to use the venv, it fails on OctoPi 1.1.0 (bookworm) but succeeds on OctoPi 1.0.0 (bullseye). The failure is that the command is not executed but there is no error returned.
The command works when executed from the (SSH) command line (see below).
What did you already try to solve it?
With significant assistance from @jneilliii, numerous options were tried including changes to the plugin code.
After many iterations, I was able to create test scripts that demonstrate the problem without any hardware or physical printer (i.e. it fails using the virtual printer).
Have you tried running in safe mode?
The plugin is required to initiate the problem so safe mode is not an option.
Did running in safe mode solve the problem?
See above.
Systeminfo Bundle
octoprint-systeminfo-20250618075910.zip (351.2 KB)
Additional information about your setup
OctoPrint 1.11.2, OctoPi 1.1.0 (bookworm), RPi 3B, Python 3.11.2, printer: LulzBot TAZ 6, FIRMWARE_NAME:Marlin FIRMWARE_VERSION:2.0.9.0.13, browser: Chrome 137.0.7151.104 (Official Build) (64-bit), operating system: Windows 11
The bullseye testing was done with:
OctoPrint 1.11.2, OctoPi 1.0.0 (bullseye), RPi 4B, Python 3.9.2, printer: Virtual, firmware: N/A, browser: Chrome, operating system: Windows 11
The files necessary to reproduce this issue are included in the .zip file below.
The assumption is that the files are in /home/pi
. After extracting, execute chmod +x cp*.py
. The *2.py
files require the hardware and the venv built with the libraries so they are just included for reference.
The *4.py
files use the system Python and the *5.py
files use a venv built with python3 -m venv stock
(the difference is in the #!
first line).
Logging for the Fan Speed Mirror plugin is set to DEBUG. If successful, the scripts will output the time, the fan value received, and the venv used. The time can be used to correlate with the debug output in octoprint.log.
Note that these scripts can be executed from an SSH command line. For example:
./cpfan4.py 254
or cpfan5.py 255
.
fanspeedmirror.zip (3.2 KB)