strange enough...I thought about this.
I was trying to figure out occupancy...
The BEST way to do this would be put a laser type of sensor (not a laser as they wear out) one at the "hall" side and one at the "room" side of a door's door jam. Then you need a way of reading them in mS response. This works well for rooms, but it's a LOT of hardware and install...it does not work well for rooms with double doors (people can come and go at the same time.
Basically then each room would be able to maintain a "contains" number to be used in lighting logic (if contains is positive, allow light rules to work, otherwise turn lights off, unless some other logic triggered "room occupancy").
So...I gave up on that and have been trying to come up with better ways to do this (potentially a motion sensor on the ceiling just inside the room door and just outside looking down...so it only sees a small area... the problem with this is extra logic is necessary to determine if it's someone walking down the hall, or someone walking into a room.
--Dan