Enclosure Plugin GPIO Impuls

Hi. Is it possible to control a GPIO pin in such a way, that it only makes a short pulse? At the start up of Octoprint and finally at shutdown. I want to controle a smart home device (Homematic). Maybe with a script or another plugin/program

Thank you