View unanswered posts | View active topics It is currently Thu May 23, 2013 6:58 am



Reply to topic  [ 21 posts ]  Go to page: 1, 2  Next
 Google Latitude 
Author Message

Joined: Aug 03, 2005
Posts: 285
Location: Wausau, WI
Post 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


Mon Oct 18, 2010 10:04 pm
Profile WWW

Joined: Jun 11, 2010
Posts: 2
Post Re: Google Latitude
check out this for some leads on how to put this together

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


Thu Nov 11, 2010 3:14 pm
Profile

Joined: Jan 28, 2008
Posts: 2
Location: Las Vegas, NV
Post 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?


Thu Dec 16, 2010 1:49 am
Profile YIM

Joined: Oct 17, 2004
Posts: 1114
Location: Rochester, Ny
Post 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


Fri Dec 17, 2010 7:05 am
Profile WWW
User avatar

Joined: Apr 10, 2006
Posts: 236
Location: Lower Hudson Valley
Post 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"}.


Fri Dec 17, 2010 2:07 pm
Profile
User avatar

Joined: Apr 16, 2003
Posts: 392
Post 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.


Sat Dec 18, 2010 1:36 am
Profile WWW

Joined: May 24, 2012
Posts: 1
Post 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.


Thu May 24, 2012 9:47 pm
Profile

Joined: Aug 05, 2011
Posts: 230
Post 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.


Fri May 25, 2012 6:00 am
Profile

Joined: Oct 17, 2004
Posts: 1114
Location: Rochester, Ny
Post 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


Fri May 25, 2012 3:29 pm
Profile WWW

Joined: Dec 20, 2010
Posts: 394
Post 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.


Fri May 25, 2012 6:49 pm
Profile WWW

Joined: Oct 17, 2004
Posts: 1114
Location: Rochester, Ny
Post 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


Sat May 26, 2012 4:49 am
Profile WWW

Joined: Dec 20, 2010
Posts: 394
Post 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)


Sat May 26, 2012 4:55 am
Profile WWW

Joined: Oct 17, 2004
Posts: 1114
Location: Rochester, Ny
Post 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


Sat May 26, 2012 7:37 am
Profile WWW

Joined: Dec 20, 2010
Posts: 394
Post Re: Google Latitude
Awesome. It will make the plugin more efficient for me. I can get rid of that trigger. Thanks so much!


Sat May 26, 2012 7:46 am
Profile WWW

Joined: Oct 17, 2004
Posts: 1114
Location: Rochester, Ny
Post 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


Wed May 30, 2012 11:58 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page: 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.