Some home automation code I am playing with