Find my iDevices!

Posted on
Tue Mar 26, 2013 12:40 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

McJohn wrote:
Hello Ben,
Thanks for the quick answer. Sorry for the inconvenience, I thought it was my fault.
Relax, family first :-)


Before I officially release it.

Here's a link, please give it a try and let me know if you run into any issues.

https://dl.dropbox.com/u/241415/Find%20 ... v1.711.zip

------
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
Tue Mar 26, 2013 1:56 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Find my iDevices!

bschollnick2 wrote:
Before I officially release it.

Here's a link, please give it a try and let me know if you run into any issues.

https://dl.dropbox.com/u/241415/Find%20 ... v1.711.zip



Error message that I see from my event log:

Find My IDevices Error Error in plugin execution InitializeMain:

Traceback (most recent call last):
File "plugin.py", line 30, in <module>
<type 'exceptions.TypeError'>: return_python_iws_path() takes exactly 1 argument (0 given)

Posted on
Tue Mar 26, 2013 2:01 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Find my iDevices!

Same error here...

Enabling plugin "Find My IDevices 1.711"
Starting plugin "Find My IDevices 1.711" (pid 18798)
Find My IDevices Error Error in plugin execution InitializeMain:

Traceback (most recent call last):
File "plugin.py", line 30, in <module>
<type 'exceptions.TypeError'>: return_python_iws_path() takes exactly 1 argument (0 given)

Stopping plugin "Find My IDevices 1.711" (pid 18798)
Stopped plugin "Find My IDevices 1.711"

Posted on
Wed Mar 27, 2013 6:12 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

nsheldon wrote:
Same error here...

Enabling plugin "Find My IDevices 1.711"
Starting plugin "Find My IDevices 1.711" (pid 18798)
Find My IDevices Error Error in plugin execution InitializeMain:

Traceback (most recent call last):
File "plugin.py", line 30, in <module>
<type 'exceptions.TypeError'>: return_python_iws_path() takes exactly 1 argument (0 given)

Stopping plugin "Find My IDevices 1.711" (pid 18798)
Stopped plugin "Find My IDevices 1.711"


A small mistake on my part.

I repackaged it, here:

https://dl.dropbox.com/u/241415/Find%20 ... v1.711.zip

------
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
Wed Mar 27, 2013 9:52 am
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Find my iDevices!

Thanks Ben.

That fixed the error. However, I'm noticing that the Find My iDevice iWS web page no longer shows any iDevices (see attached image). I'm using Indigo 6b7. The iWS "Find-My-iDevice" plugin folder is installed in the /Library/Application Support/Perceptive Automation/Indigo 6/IndigoWebServer/plugins directory. The Find My iDevice Indigo plugin (the 1.711 version you just posted) is installed. I stopped then started the Indigo server. I verified that the 2 iOS devices I'm tracking both show current location information in the Indigo Cocoa client. Have I missed something?

EDIT: I also verified that the "Create a Location WebPage" check box in the Find My iDevice plugin configuration is checked before restarting the Indigo server.

Screen Shot 2013-03-27 at 8.45.05 AM.png
Find My iDevice page with no devices listed
Screen Shot 2013-03-27 at 8.45.05 AM.png (105.42 KiB) Viewed 9084 times

Posted on
Fri Mar 29, 2013 10:07 am
swbhenderson offline
Posts: 1
Joined: Mar 29, 2013

Re: Find my iDevices!

alang_94526 wrote:
A sledgehammer indeed ;-)
While it works, it doesn't actually solve the latency issue. Having run it, I still see it reporting location[n-1] instead of the current location.
I'm still hacking away to see if I can figure out why.


I think I may have found the cause of the location[n-1] problem (after much hacking). It appears to be due to the Indigo plugin architecture.

From the Server plugin.py:
Screen Shot 2013-03-29 at 11.43.01 AM.png
Screen Shot 2013-03-29 at 11.43.01 AM.png (138.88 KiB) Viewed 9051 times


Triggered actions run in their own command space with a copy of referenced devices (if I understand correctly - this is my first foray into python). I need to trigger from any change in DistanceAway which isn't an available trigger offered by FMID so I trigger off of the device state. This leads to the n-1 problem.

If I reverse the order of server state update in the plugin (closestAddress before DistanceAway) the problem disappears.

Posted on
Fri Mar 29, 2013 11:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Find my iDevices!

Having not read this entire 23 page thread, I can't be sure I know exactly what the problem is.

However, if you have a python script that's firing when the "DistanceAway" state is updated that gets the device object, and that object doesn't yet have the update to the "ClosestAddress" state, then it's likely that something is delaying the update to the "ClosestAddress" state. I don't know what self.fetch_geoaddress_from_lat_long() does - if that method is making a query out to the net then it could be multiple seconds before it gets the data and thus the update to "ClosestAddress" would be delayed thus causing the out-of sync.

I believe an improvement would be to wait to do any updateStateOnServer calls until you actually have all the data needed for the update, then do them in sequence with nothing else between. It may not stop the problem I describe above completely, but it will definitely reduce the chances of it happening. We don't have a single atomic method to update multiple states all at the same time (it's on the list for future consideration), but it wouldn't help in this case since it looks like there's extra stuff going on between state updates.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Apr 02, 2013 9:35 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

nsheldon wrote:
Thanks Ben.

That fixed the error. However, I'm noticing that the Find My iDevice iWS web page no longer shows any iDevices (see attached image). I'm using Indigo 6b7. The iWS "Find-My-iDevice" plugin folder is installed in the /Library/Application Support/Perceptive Automation/Indigo 6/IndigoWebServer/plugins directory. The Find My iDevice Indigo plugin (the 1.711 version you just posted) is installed. I stopped then started the Indigo server. I verified that the 2 iOS devices I'm tracking both show current location information in the Indigo Cocoa client. Have I missed something?

EDIT: I also verified that the "Create a Location WebPage" check box in the Find My iDevice plugin configuration is checked before restarting the Indigo server.

Screen Shot 2013-03-27 at 8.45.05 AM.png


Okay, fixed.

https://dl.dropbox.com/u/241415/Find%20 ... v1.712.zip

The IWS portion was still looking at the old location.

- 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
Tue Apr 02, 2013 9:38 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

jay (support) wrote:
Having not read this entire 23 page thread, I can't be sure I know exactly what the problem is.

However, if you have a python script that's firing when the "DistanceAway" state is updated that gets the device object, and that object doesn't yet have the update to the "ClosestAddress" state, then it's likely that something is delaying the update to the "ClosestAddress" state. I don't know what self.fetch_geoaddress_from_lat_long() does - if that method is making a query out to the net then it could be multiple seconds before it gets the data and thus the update to "ClosestAddress" would be delayed thus causing the out-of sync.

I believe an improvement would be to wait to do any updateStateOnServer calls until you actually have all the data needed for the update, then do them in sequence with nothing else between. It may not stop the problem I describe above completely, but it will definitely reduce the chances of it happening. We don't have a single atomic method to update multiple states all at the same time (it's on the list for future consideration), but it wouldn't help in this case since it looks like there's extra stuff going on between state updates.


Jay probably has it. Since the Geolocation data is fetched from Google, I have no way to tell when the update will finish. So it's possible that the server is waiting on that request.

I will place this in my update queue for updating FMID.

------
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
Tue Apr 02, 2013 10:23 am
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Find my iDevices!

bschollnick2 wrote:
Okay, fixed.

https://dl.dropbox.com/u/241415/Find%20 ... v1.712.zip

The IWS portion was still looking at the old location.

- Benjamin


Thanks Benjamin.

Um... Maybe that zip file wasn't the right one or something, because even though the zip file has v1.712 in the filename, the Indigo plugin version is still 1.711 and when replacing the Find-My-iDevice folder in the IWS plugins folder and restarting the Indigo server, there is no change. The map and data still don't show up in the FMID generated page. Using Safari to inspect the page, it shows an error of "Reference Issue: Can't find variable: initialize" in the <body> statement of the HTML.

Posted on
Tue Apr 02, 2013 11:48 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

nsheldon wrote:
bschollnick2 wrote:
Okay, fixed.

https://dl.dropbox.com/u/241415/Find%20 ... v1.712.zip

The IWS portion was still looking at the old location.

- Benjamin


Thanks Benjamin.

Um... Maybe that zip file wasn't the right one or something, because even though the zip file has v1.712 in the filename, the Indigo plugin version is still 1.711 and when replacing the Find-My-iDevice folder in the IWS plugins folder and restarting the Indigo server, there is no change. The map and data still don't show up in the FMID generated page. Using Safari to inspect the page, it shows an error of "Reference Issue: Can't find variable: initialize" in the <body> statement of the HTML.


I'll have to take a further look at it then. I'll try to take a look at it later tonight.

The IWS issue was clear, but it's sounding like there maybe an Javascript issue that I didn't see.

------
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
Wed Apr 03, 2013 1:01 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

Okay, I located the issue(s).

There were multiples. But basically the change I made for the data file wasn't correct, but it was fairly subtle.

https://dl.dropbox.com/u/241415/Find%20 ... v1.713.zip

Should fix this, and I have changed the order of updating the Latitude, Longitude and DistanceAway values. The Geolocated address will be updated first, and then Lat, Long, and DistanceAway. This is to attempt to minimize the issue that was found earlier with the "n-1" location issue.

- 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

Who is online

Users browsing this forum: No registered users and 4 guests