PIR sensor sets pin value, but event listeners don't work