I will have to see if I can dig it up. That project was some time ago. To be honest though, I don’t see why your code wont work.
Can you give a little detail as to what it is doing currently? Is the reed switch still working? Does the relay click when you push the app button?