I´ve searched the web for an answer but can´t find anything really relevant.
I have connected a fan to a relay which is controlled by a GPIO pin on my raspberry. With the enclosure plugin I can turn on and turn off this fan with a button in the webinterface.
However I would like to start the fan based on print progress, i.e. at ~2% print. And turn it off when cancelled or finished print.
Is there any simple way to achieve this functionality. I know that the progress can be reached through event hooks and REST API, but is this the correct way to go? And what is the best way to do this then?