@justus2342
There is a possibility that actualValue does not achieve the requestedValue which is why I chose that logic.
However @dc42 may have to confirm the details.

(job.file.fileName!=null) will be true if a print job is loaded.
This stops the code from executing if the machine isn't printing.
As I said, without that there is a possibility (depending on your code) that you could send the system into an endless loop after a print finished and the fans shut down thermostatically.
This is also why I tested temperature.