iPhone code for my home automation project