Presence sensors can't just tell when you're in the room; some can tell where in the room you're located. The problem is that presence sensors don't always give a completely reliable location, which can break your automations. When one of my presence-based automations kept failing, I used Python to solve the problem.