Page 2 of 2

Re: TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Sunday 11 September 2016 15:32
by steef84
Nice find, thanks for sharing this. Want to try this with my iPhone 6s.
Can you help me troubleshoot it on Domoticz latest beta on my Synology DS213+

Running this script with only the following adapted.

Code: Select all

 -- Array of users to be checked
  users = {
            Person1 = {username = '[email protected]' ; password = 'xxxxxxxxxxx' ; devicename = 'iPhone Stefan'}
          }
  -- The latitude and longitude of your house (use Google Maps or similar to find this)
  homelongitude = x.xxxxxx
  homelatitude = xx.xxxxxx
Now my Domoticz logs returns nothing and my dummy iPhone Stefan is not switching.

I've copied the json.lua with wget to /usr/local/share/lua/5.2/, chmodded it 777. Also tried putting longitude and latitude between 'xx.xxx'

TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Sunday 11 September 2016 19:59
by mvzut
steef84 wrote:Nice find, thanks for sharing this. Want to try this with my iPhone 6s.
Can you help me troubleshoot it on Domoticz latest beta on my Synology DS213+

Running this script with only the following adapted.

Code: Select all

 -- Array of users to be checked
  users = {
            Person1 = {username = '[email protected]' ; password = 'xxxxxxxxxxx' ; devicename = 'iPhone Stefan'}
          }
  -- The latitude and longitude of your house (use Google Maps or similar to find this)
  homelongitude = x.xxxxxx
  homelatitude = xx.xxxxxx
Now my Domoticz logs returns nothing and my dummy iPhone Stefan is not switching.

I've copied the json.lua with wget to /usr/local/share/lua/5.2/, chmodded it 777. Also tried putting longitude and latitude between 'xx.xxx'
So you don't see anything in your logs? That probably means you're almost there, otherwise you would see remarks on not being able to find json.lua, or about concatenating variables which are empty (nil).

I noticed that I missed a space on two positions in the script after 'iPhone', e.g. in

Code: Select all

if otherdevices['iPhone ' .. user] == 'Off then
This probably happened during anonimizing my own script and translating it from Dutch to English. I have now corrected this in my previous post, please adapt your own script accordingly.
Secondly, I see that you didn't change the name "Person1". I assume your dummy switch is not called "iPhone Person1" but "iPhone Stefan", right? If so, please change Person1 into Stefan.

If you still have problems, here are a few other things you can try:
- Remove the comment signs (--) before the print commands. Does it print the raw output (the value of the "result" variable) in the log? And the longitude/latitude?
- If you do get the raw output but no position, check the raw output for the device name of your phone. Is it spelled exactly as you did in the script?

Hope this brings you a bit further. Let me know your results.

TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Sunday 11 September 2016 21:37
by steef84
Yay. Thanks for your prompt reply! The missing spaces did the trick for me! Now monitoring 4 iPhones in my house.
The Person1 is changed to Stefan ofcourse! Nice find. Hoping this is a reliable iPhone monitoring service.
Will report in some days about the possible battery influence.

Re: TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Sunday 11 September 2016 22:53
by mvzut
steef84 wrote:Yay. Thanks for your prompt reply! The missing spaces did the trick for me! Now monitoring 4 iPhones in my house.
The Person1 is changed to Stefan ofcourse! Nice find. Hoping this is a reliable iPhone monitoring service.
Will report in some days about the possible battery influence.
Great! I noticed that it sometimes gave false "away" notifications. I suggest to fill in your home location as accurate as possible, and play with the skew value to avoid this.

By the way, I got the reverse address lookup working. I now have a few text devices showing the address where my kids are, updated every 5 minutes. Creepy... ;-)

Including this functionality involves getting an API key at Google for being able to use the address lookup service. If someone is interested I'm willing to share my code and an explanation on how to get the API key.

Re: TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Monday 12 September 2016 13:57
by steef84
Very interrested. Also for tracking my wife ... . Will you open a new topic for this function? Very curious about it

Re: TUT > Let Domoticz know when you are home. (Cell Wi-Fi)

Posted: Monday 12 September 2016 16:20
by mvzut
steef84 wrote:Will you open a new topic for this function? Very curious about it
I just opened a separate topic about this script here.
By the way, I found a way to to the reverse address lookup without a Google API key, that makes setting it up much easier!