Indoors-vs-outdoors sensor
Light with wavelenght shorter than 300nm is scarce in the output of most types of lightbulbs and it is highly absorbed by typical window glass. On the other hand, it is relatively abundant in sunlight. Therefore a light sensor with a medium/far UV passing filter should do the job with a little bit of calibration. Open windows might confuse it.



References


Solar emission curve
Incandescent lamp emission curve
Fluorescent lamp emission curve
Float glass transmission curve
B270 glass transmission curve
Soda lime and borosilicate glass transmission curves