If you are looking for some code to disable the monitor or if you want the use an infrared sensor to detect when someone is in front of the mirror and only then turn it on, you can check my module https://github.com/thobach/MMM-Gestures.