Google Latitude

Posted on
Mon Oct 18, 2010 10:04 pm
bjojade offline
Posts: 285
Joined: Aug 03, 2005
Location: Wausau, WI

Google Latitude

Has anyone thought of integrating Google Latitude in their automation system?

For those that don't know, Google Latitude is an app that you can add friends and allow tracking of individual locations. Scary, because I don't want my friends to ALWAYS know where I am, but if my automation system did, that would be awesome.

Imagine the functionality that you could add beyond just the regular triggers. My computer could track when I leave the office, and when I get within a couple miles of home, it could kick in the heat instead of going on a schedule, since I don't operate on a daily schedule.

If I'm more than 30 miles from home and a water sensor trips, it not only notifies me, but can be set to notify another backup contact, etc.

This would be a REALLY cool thing to have, wouldn't it?

Brian Jojade
HappyMac Digital Electronics
http://www.happymacshop.com

Posted on
Thu Nov 11, 2010 3:14 pm
manyrobots offline
Posts: 2
Joined: Jun 11, 2010

Re: Google Latitude

check out this for some leads on how to put this together

http://iamshadowlord.com/2010/09/automa ... ather.html

Posted on
Thu Dec 16, 2010 1:49 am
solaris72 offline
Posts: 2
Joined: Jan 28, 2008
Location: Las Vegas, NV

Re: Google Latitude

Now that Google Latitude is official for iOS, I was looking around for similar script. I found this over at another forum:

http://board.homeseer.com/showthread.php?t=143249

Could be a starting point for an AppleScript port?

Posted on
Fri Dec 17, 2010 7:05 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Google Latitude

solaris72 wrote:
Now that Google Latitude is official for iOS, I was looking around for similar script. I found this over at another forum:

http://board.homeseer.com/showthread.php?t=143249

Could be a starting point for an AppleScript port?


Not really, since I believe it's in Visual Basic... (Windows specific)....

But I already looked into this, and Latitude really doesn't need a script per sae. If you want to display your location, you can just embed a Latitude link into a web page.

If you want to calculate where you are, then I would have to examine that... But it can be done...

Overall, I am planning on taking a closer look at this... But with the work load at work right now, I don't have alot of free time... to explore this...

I suspect, personally that any major upgrades to my Indigo Plugins will be for Indigo 5...

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Fri Dec 17, 2010 2:07 pm
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

Re: Google Latitude

Actually pulling the correct URL from the VB was a good start. Note this requires you turn on Google Public Location Badge, not sure I want to do that. But I think as long as you don't make the userID public (like on a blog) you're OK. Any thoughts?

That being said here's an AppleScript to get your latitude location.
Code: Select all
set UserID to "1234567890123456789"

----
tell application "Finder" to set myFile to ((path to temporary items) as string) & "latitude.tmp"

set latitudeURL to " 'http://www.google.com/latitude/apps/badge/api?type=atom&user=" & UserID & "' "
do shell script "curl " & latitudeURL & "  -o " & POSIX path of myFile

tell application "System Events"
   set elem1 to XML element named "entry" of XML element named "feed" of XML file myFile
   set georss_point to value of XML elements of elem1 whose name is "georss:point"
end tell
georss_point

It returns {"40.XXXXXX -73.XXXXXX"}.

Posted on
Sat Dec 18, 2010 1:36 am
bobeast offline
User avatar
Posts: 400
Joined: Apr 16, 2003

Re: Google Latitude

CharlieParker wrote:
Actually pulling the correct URL from the VB was a good start. Note this requires you turn on Google Public Location Badge, not sure I want to do that. But I think as long as you don't make the userID public (like on a blog) you're OK. Any thoughts?


Thanks CharlieParker!

To take this a step further;

Code: Select all
set atTheRanch to false
set minLatForRanch to "38.242292"
set maxLatForRanch to "38.246607"
set minLonForRanch to "120.683742"
set maxLonForRanch to "120.690908"

set UserID to "1234567890123456789"

----
tell application "Finder" to set myFile to ((path to temporary items) as string) & "latitude.tmp"

set latitudeURL to " 'http://www.google.com/latitude/apps/badge/api?type=atom&user=" & UserID & "' "
do shell script "curl " & latitudeURL & "  -o " & POSIX path of myFile

tell application "System Events"
   set elem1 to XML element named "entry" of XML element named "feed" of XML file myFile
   set georss_point to value of XML elements of elem1 whose name is "georss:point"
end tell

set mywords to words of first item of georss_point
set lat to item 1 of mywords as real
set lon to item 2 of mywords as real

if lat is greater than minLatForRanch then
   if lat is less than maxLatForRanch then
      if lon is greater than minLonForRanch then
         if lon is less than maxLonForRanch then
            set atTheRanch to true
         end if
      end if
   end if
end if

if atTheRanch is true then
   display alert ("At the ranch!")
else
   display alert ("NOT at the ranch!")
end if


The idea is to draw a box around the area you are interested in using absolute values and seeing if the location is inside the box. There's probably a more elegant way to do this, but its late and I'm tired :)

To get the coordinates for the box, take a look at;

http://itouchmap.com/latlong.html

Choose to chance the rapids.
Dare to dance the tide.

Posted on
Thu May 24, 2012 9:47 pm
mikieOm84 offline
Posts: 1
Joined: May 24, 2012

Re: Google Latitude

I know this is a year old, sorry, but how would you make the script check your position, say, every two minutes? This is an interesting concept. Would love to know more.

Posted on
Fri May 25, 2012 6:00 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Google Latitude

I didn't know this existed; I may have to investigate it a bit, since it is basically "Find My IDevices" for Android. But you might want to follow some of those threads for the pluses and minuses of using an "always know where I am" philosophy to change the house state rather than the "know when I am home" philosophy used by something like smartphone radar that simply senses if a particular WIFI device is attached to the home network.

Posted on
Fri May 25, 2012 3:29 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Google Latitude

johnpolasek wrote:
I didn't know this existed; I may have to investigate it a bit, since it is basically "Find My IDevices" for Android. But you might want to follow some of those threads for the pluses and minuses of using an "always know where I am" philosophy to change the house state rather than the "know when I am home" philosophy used by something like smartphone radar that simply senses if a particular WIFI device is attached to the home network.


I've tested Google Latitude, and at least with the Google Latitude application on the iPhone.... It's highly erratic...

It insisted that every night around 1am, that my iPhone would get up and in less than two minute's, would travel over 6-7 miles away... And spend the next 3-4 hours, traveling around that new epicenter seeing the sights for the next 2 hours...

Practically every night for the week or so that I was testing this....

I have considered adding Google Latitude support to Find My iDevice.... But, I am finding it a little hard to justify... Especially with the erratic results....

If there's enough interested, then I would seriously look into this....

- Ben

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Fri May 25, 2012 6:49 pm
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Google Latitude

I wrote a simple script that levers Google Latitude to relate the Find My Devices coordinates with an address. It triggers each time there's a coordinate change and has been working pretty well.

Posted on
Sat May 26, 2012 4:49 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Google Latitude

nlagaros wrote:
I wrote a simple script that levers Google Latitude to relate the Find My Devices coordinates with an address. It triggers each time there's a coordinate change and has been working pretty well.


That's a great idea...

Could you send me a copy of the script? I'd like to see how it works, and if you don't mind, maybe add it into FMiD?

- Ben

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Sat May 26, 2012 4:55 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Google Latitude

Not much to it:

Code: Select all
import urllib2
from xml.etree import ElementTree as ET

dev = indigo.devices["iPhone - Nick"]
latitude = str(dev.states["Latitude"])
longitude = str(dev.states["Longitude"])

theUrl = u"http://maps.googleapis.com/maps/api/geocode/xml?latlng=" + latitude+ "," + longitude + "&sensor=false"


f = urllib2.urlopen(theUrl)
theXML = f.read()

GEO = ET.parse(urllib2.urlopen(theUrl))
GEO_results = GEO.find('result')
FA = GEO_results.findtext('formatted_address')

indigo.variable.updateValue("iPhone_Nick", FA)

Posted on
Sat May 26, 2012 7:37 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Google Latitude

nlagaros wrote:
Not much to it:
<snip>


Assuming you have no issues with it, I have added a new state to the iDevice Records...

<State id="ClosestAddress">
<ValueType>String</ValueType>
<TriggerLabel>Closest GeoLocated Street Address</TriggerLabel>
<ControlPageLabel>Closest GeoLocated Street Address</ControlPageLabel>
</State>

And assuming there are no issues, in v1.50, it will automatically do a look up when located the devices and assign the state with the results from Google.

I will make sure to make a note to attribute that Feature to your suggestion, and code sample...

- Benjamin

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Sat May 26, 2012 7:46 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Google Latitude

Awesome. It will make the plugin more efficient for me. I can get rid of that trigger. Thanks so much!

Posted on
Wed May 30, 2012 11:58 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Google Latitude

Matt, and Jay,

I just finished with the v1.50 of FMID, and I'm attempting to use the Geolocated address code above, and realized that there is no trigger for Contains.

So for example, I can't set a pseudo-trigger for if Ben's car is on Crockett Dr, turn on house lights...

This seems like a big omission... Any chance a contains trigger can be added?

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Who is online

Users browsing this forum: No registered users and 5 guests