Have a look here:
This will get you a presence sensor for the MIL Then you can create rules etc to respond to that
Andy