I like your solution, quite clever! But in my instance I actually want it to turn off once the print is over. I don’t remember the details but I think it’s set up so it will turn off after the hot end has cooled down for a few minutes, it’s controlled by a plug-in for Octoprint.
I couldn’t figure out what that was, but this comment reminded me of Dr Who. So thank you for jogging my memory! Was a fairly creepy episode.