Mine does pretty much the same thing just in php. I would be happy to put mine code out there. I have a github account I'll try to get it up on.
I just use a rule for mine. So my item looks like this
Switch FindJasonIphone "Find Jason's Iphone"
and then I have a rule setup
rule "Find Jason Phone"
Item FindJasonIphone changed from OFF to ON
logInfo("FindMyIPhone", "Request For Jason's Iphone")
I just send a get request and pass in the id for the phone I want to find. Then i turn the switch back off. So it's almost like the useless switch