rPi code for garage sensor application