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

Moderator: leecollings

steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

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

Post 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'
- Stefan
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

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

Post 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.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

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

Post 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.
- Stefan
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

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

Post 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.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

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

Post by steef84 »

Very interrested. Also for tracking my wife ... . Will you open a new topic for this function? Very curious about it
- Stefan
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

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

Post 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!
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest