Best way to tell if a lid is open.

Certainly using the micro switch/leaver switch is the simplest way. In case if you don't want to use mechanical approach, you can do this with IR proximity sensor as well.