Keep in mind:
Make sure you either use a lengthy delay time for turning off the light or some sort of logic. If someone decides to do some light reading, or if there is a shower / tub in this bathroom, the light going off when someone is in there will get you into trouble for sure..... trust me on this one
The logic can be a real pain to get working the way you want, as it pretty much needs to be rock solid and work correctly every single time. If it works perfectly 50 times, you will be sure to hear about the one single time the light went out when someone was in there! It just depends on your setup, and how you want it to work.
I overcame this by having a motion sensor hidden under the vanity cabinet on the baseboard, that is aimed so it see's the entrance. When motion is detected, it sends the signal directly to the module to turn the light on. This is faster than sending the signal to a computer, and then sending the on signal back to the switch. (I have the motion sensor set to the maximum delay time for turning the light off).
To handle the turning the light off, I have a DS10 window/door switch on the bathroom door. This is where the logic comes in. When the door is opened, Home Seer watches for 60 seconds to see if any motion is detected, If no motion is detected in that time, then it turns out the light. If Motion is detected with the door closed, it resets to leaving it on all over again (Covers opening the door to tell someone to get you a towel ect

)
The reason for all of this is because of all the variables. If you are in the tub, then the light will never go out due to no motion detected, as the door has remained closed. It is the door opening that triggers the checking to see if it's OK to turn off the light. I also do not rely on the DS10 to turn it off, as there are times you will leave the bathroom, and possibly want to close the door behind you

If this is the case, no motion will be detected and the light will still be turned off. If you open the door to yell down the hall for something, and then close the door again, the logic resets and the light will not be turned off.
I know this all seems so very complicated for a single fracking light

But trust me, you want to make it as absolutely fool proof as you can, that the light never goes out when someone is in there. It is better to have the light fail to turn off, then to have it go off when occupied. Automating lights is a tricky business based just on motion, and I have tweaked and tested over and over. The only rooms I have automatic lights in are the bathrooms and the laundry room. (Laundry room is easy with just a motion sensor, as there will be easily detectable motion) I have tried the living room and kitchen, and standing at the stove at times, or reading a book just doesn't cut it with motion sensors. It would take a
real occupancy sensor ($$$$) to be able to do it rock solid, and even then, it will not work if you have pets.