Find my iDevices!

Posted on
Mon Jan 28, 2013 4:36 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Find my iDevices!

puppycrack wrote:
Just thought I'd mention that the 1.6 version of plugin worked for me, albeit with the caveats I've previously mentioned, under Indigo 6b3. But when I upgraded to 1.71, it stopped working altogether.

In looking through the code, it seems that when a manual or trigger induced update occurs, you create a thread to handle the request. You pass a queue into the Thread, and the thread works off the queue (looks like a producer/consumer model).

The problem I'm seeing is that the queue is empty when it is passed to the thread. So the thread just sits and waits on the get() method of the queue.

Again, if I reload the plugin, an update occurs; but forced Manual updates and schedule induced updates, are not working for me.


I'm seeing the same behavior with my 1.71 FMID plugin on Indigo 6b5. Manual update requests either by menu or trigger are resulting in no actual device updates. FMID regular scheduled updates (and manual reloads of the plugin) work though.

Posted on
Mon Jan 28, 2013 7:51 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

nsheldon wrote:
puppycrack wrote:
Just thought I'd mention that the 1.6 version of plugin worked for me, albeit with the caveats I've previously mentioned, under Indigo 6b3. But when I upgraded to 1.71, it stopped working altogether.

In looking through the code, it seems that when a manual or trigger induced update occurs, you create a thread to handle the request. You pass a queue into the Thread, and the thread works off the queue (looks like a producer/consumer model).

The problem I'm seeing is that the queue is empty when it is passed to the thread. So the thread just sits and waits on the get() method of the queue.

Again, if I reload the plugin, an update occurs; but forced Manual updates and schedule induced updates, are not working for me.


I'm seeing the same behavior with my 1.71 FMID plugin on Indigo 6b5. Manual update requests either by menu or trigger are resulting in no actual device updates. FMID regular scheduled updates (and manual reloads of the plugin) work though.


I will be updating Find My idevices, and the majority of my plugins after either Indigo v6's release. Or after I finish on the iAutomate RFID plugin.

I can't give a schedule right now, because between work, our basement construction, and working on the RFID plugin, I just simply don't have time right now to commit to the other plugins.

The good news, is that the work on the RFID plugin has helped for design concepts of my plugins. There's quite a few techniques that I will be carrying back to my other plugins.

We are very close to the public beta of the RFID plugin, I am finishing a few small details, and then expect to see the public beta launch shortly.

- 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
Mon Jan 28, 2013 8:40 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Find my iDevices!

Thanks for the update Ben. I can't speak for everyone here, but I appreciate all the work you've already put into your free plugins. I look forward to seeing the updates when you do have time to implement them, but absolutely understand that all this stuff takes time, especially when you have a life. :-D

Posted on
Tue Feb 12, 2013 9:27 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

lamp wrote:
Hi Benjamin, thanks for the excellent plugin. I'm using the latest v1.7.1 plugin and have 2 iDevices (iPhone and iPad), at the Event Log, every 10 seconds I kept seeing the following (I restarted indigo Server, and it went quiet for a while before these messages coming back)

Traceback (most recent call last):
File "plugin.py", line 948, in runConcurrentThread
File "plugin.py", line 847, in run_search_for_idevices
File "plugin.py", line 701, in fetch_updated_MobileMe_Locations
File "plugin.py", line 776, in process_device
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''

Find My IDevices Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Find My IDevices Retrieving location data
Find My IDevices Locating - FMiD Peter iPad 2, (Peter's iPad 2)
Find My IDevices running with (2, 300) and None
Find My IDevices location: {'latitude': 37.41333492559167, 'timestamp': datetime.datetime(2012, 10, 31, 0, 49, 48), 'longitude': -122.0986865959683, 'accuracy': 65.0}
Find My IDevices Done locating - FMiD Peter iPad 2
Find My IDevices Locating - FMiD Peter iPhone 4, (Peter Lams iPhone 4)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': 37.413478572093453, 'timestamp': datetime.datetime(2012, 10, 31, 0, 49, 6), 'longitude': -122.09870452387359, 'accuracy': 10.0}
Find My IDevices testing
Find My IDevices Error Error in plugin execution runConcurrentThread:


I just took a look, and line 776/777 is the code where FMID reads the Latitude and Longitude from the FMID preferences....
Can you please check your FMID preferences, and make sure there is a valid Latitude and Longitude set? If possible, let me know what you have typed into the fields?

- Ben


I had this same problem and looked into what might be happening to cause it. I found an old trigger that was an FMiD "Distance from Map Location" trigger with no defined "Map Location" device.
I added a new Map Location device, modified the offending trigger to trigger on the distance from that map location and it all works nicely without even having to restart the plugin or server.

So, to fix this particular problem, simply make sure you have a Map Location set if you're triggering on a Distance from Map Location.

Posted on
Fri Feb 15, 2013 9:00 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

alang_94526 wrote:
lamp wrote:
Hi Benjamin, thanks for the excellent plugin. I'm using the latest v1.7.1 plugin and have 2 iDevices (iPhone and iPad), at the Event Log, every 10 seconds I kept seeing the following (I restarted indigo Server, and it went quiet for a while before these messages coming back)

Traceback (most recent call last):
File "plugin.py", line 948, in runConcurrentThread
File "plugin.py", line 847, in run_search_for_idevices
File "plugin.py", line 701, in fetch_updated_MobileMe_Locations
File "plugin.py", line 776, in process_device
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: ''

Find My IDevices Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Find My IDevices Retrieving location data
Find My IDevices Locating - FMiD Peter iPad 2, (Peter's iPad 2)
Find My IDevices running with (2, 300) and None
Find My IDevices location: {'latitude': 37.41333492559167, 'timestamp': datetime.datetime(2012, 10, 31, 0, 49, 48), 'longitude': -122.0986865959683, 'accuracy': 65.0}
Find My IDevices Done locating - FMiD Peter iPad 2
Find My IDevices Locating - FMiD Peter iPhone 4, (Peter Lams iPhone 4)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': 37.413478572093453, 'timestamp': datetime.datetime(2012, 10, 31, 0, 49, 6), 'longitude': -122.09870452387359, 'accuracy': 10.0}
Find My IDevices testing
Find My IDevices Error Error in plugin execution runConcurrentThread:


I just took a look, and line 776/777 is the code where FMID reads the Latitude and Longitude from the FMID preferences....
Can you please check your FMID preferences, and make sure there is a valid Latitude and Longitude set? If possible, let me know what you have typed into the fields?

- Ben


I had this same problem and looked into what might be happening to cause it. I found an old trigger that was an FMiD "Distance from Map Location" trigger with no defined "Map Location" device.
I added a new Map Location device, modified the offending trigger to trigger on the distance from that map location and it all works nicely without even having to restart the plugin or server.

So, to fix this particular problem, simply make sure you have a Map Location set if you're triggering on a Distance from Map Location.


The other thing I see people observing with 1.71 is that manual (menu) get status and Action-based get status doesn't work.
I made the following changes to plugin.py that seems to work albeit a bit of a sledgehammer approach if anyone is in need.

Line 815 to 835 change to:
Code: Select all
   def manualDeviceUpdate (self, action):
   #
   #   Update requested via Trigger Action
   #
      indigo.server.log ("Manual iDevice Update Requested (from Trigger)")
   #   new_thread = self.threaded_add_device ( inQ = self.inQue, outQ = self.outQue, in_indigo = indigo,
   #                              in_server = indigo.server, in_plugin = self,
   #                              target_function = self.run_search_for_idevices )
   #   new_thread.start()
      self.run_search_for_idevices ()

   def manualDeviceUpdate_menutrigger (self):
   #
   #   Update requested via Menu item
   #
   #   indigo.server.log ("Manual iDevice Update Requested (from Menu)")
   #   new_thread = self.threaded_add_device ( inQ = self.inQue, outQ = self.outQue, in_indigo = indigo,
   #                              in_server = indigo.server, in_plugin = self,
   #                              target_function = self.run_search_for_idevices )
   #   new_thread.start()
      self.run_search_for_idevices ()


Maybe Ben can comment on how safe this change is. It's his code and my changes based on reading the code for 30 minutes and are provided to be used at the reader's own risk ;-)

Posted on
Sat Feb 16, 2013 7:13 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

I am getting a hang when using the FindMyiDevices plugin not that I suspect the plugin, but I have a bunch of triggers that convert DeviceState to Variables, then a bunch of triggers that trigger on those variables to do a bunch of fun and interesting things.

If I disable the variable triggers but leave the DeviceState triggers enabled it works fine.
If I enable the variable triggers as well, then it will hang up.

I will systematically figure out which one of my 40 variable triggers is causing the problem but I'm attaching this hang log file to see if it points to a problem that might need fixin'

(Actually, it's too big so I had to break it into 2 parts, Part A (first) and Part B.

Thanks
Alan
Attachments
Part B.txt
(258.38 KiB) Downloaded 344 times
Part A.txt
(257.67 KiB) Downloaded 378 times

Posted on
Mon Feb 18, 2013 7:54 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

Figured out 1 thing and that was the reason Indigo hung was because a variable, FMiDDistanceAway, (which is generated by an ActionCollection DeviceState->Variable copying an FMiD device state (Distance Away)) has a non numeric value sometimes.
In this case, 2013-02-18 17:18:01.881201 (which is obviously the date and time). This data is used in some AppleScript and I presume it just chokes something downstream somewhere to cause the hang.

If I look at the device in the Devices window, the Distance Away for the specific device is correctly reported. Somehow, the action collection process is messing it up.
I also notice that other FMiD variables are intermittently getting the same date and time value instead of their intended state.

I'll keep digging but just wanted to update

Posted on
Mon Feb 18, 2013 9:21 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

It was my bad (no surprise). I had an erroneous trigger setting the that variable to a timestamp value - duh.

Posted on
Tue Feb 19, 2013 8:52 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

alang_94526 wrote:
Maybe Ben can comment on how safe this change is. It's his code and my changes based on reading the code for 30 minutes and are provided to be used at the reader's own risk ;-)


I'll take another look at that, once I get back to FMID.

But it appears that you removed the thread being created. It'll work, but the reason for that thread is that if you open a editing window when that function is called, it can cause an error to be given by Indigo. It's a non-critical error, but having that in a secondary thread prevents that from happening.

It's not a answer I particularly like, and I am going to refactor FMID again, to try to work around this requirement.

The main problem is that I can't tell how long I will be waiting for the reply from Apple. So it does make FMID the most challenging plugin to design and work with.

- 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 Feb 19, 2013 10:14 am
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

Thanks Ben. That's what I figured (which is why I referred to the workaround as a sledgehammer ;-) )
Did something happen to Google Maps over the past 24 hours? It stopped converting the lat/long to a geo address?

Posted on
Tue Feb 19, 2013 11:26 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Find my iDevices!

alang_94526 wrote:
Thanks Ben. That's what I figured (which is why I referred to the workaround as a sledgehammer ;-) )
Did something happen to Google Maps over the past 24 hours? It stopped converting the lat/long to a geo address?


Not that I know of.

Are you having any issues with the Reverse lookup?

- 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
Tue Feb 19, 2013 11:41 am
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

I think all my hacking around, debugging made me hit the daily usage limit ;-)
I'll see if it clears up tomorrow.
The Closest Address Device State stays blank. If I type in the URL manually it returns OVER_QUERY_LIMIT

Usage Limits

Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API for Business may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked.

Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.


Posted on
Tue Feb 19, 2013 3:15 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

It's back working again

Posted on
Wed Feb 20, 2013 3:00 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

Ben,
I'm seeing long latencies between requesting device position and actually receiving it.
The delay can be up to several minutes.
If you look at the log below, you can see the Eventlog timestamp is 12:53, but the FMiD location time stamps range from 12:49 to 12:51.
Is this an artifact of the iCloud site access time or something in the FMiD plugin.


Feb 20, 2013 12:53:09 PM
Find My IDevices location: {'latitude': XX, 'timestamp': datetime.datetime(2013, 2, 20, 12, 53, 7), 'longitude': -XX, 'accuracy': 81.392050304954765}
Trigger FMiD DeviceState->Variable DistanceAway Becky
Find My IDevices Done locating - iPhone - Becky
Script Becky's not Home
Script Becky's Not Near Home
Find My IDevices Locating - iPhone - Mat, (Mat's iPhone)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': XX, 'timestamp': datetime.datetime(2013, 2, 20, 12, 49, 12), 'longitude': -XX, 'accuracy': 10.0}
Trigger FMiD DeviceState->Variable DistanceAway Mat
Trigger FMiD DeviceState->Variable CurrentAddress Mat
Find My IDevices Done locating - iPhone - Mat
Find My IDevices Locating - iPhone - Ross, (Ross's iPhone)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': XX, 'timestamp': datetime.datetime(2013, 2, 20, 12, 49, 39), 'longitude': -XX, 'accuracy': 10.0}
Trigger FMiD DeviceState->Variable DistanceAway Ross
Find My IDevices Done locating - iPhone - Ross
Script Mat's not Home
Find My IDevices Locating - iPhone - Yvonne, (Yvonnes iPhone)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': XX, 'timestamp': datetime.datetime(2013, 2, 20, 12, 51, 12), 'longitude': -XX, 'accuracy': 30.0}
Trigger FMiD DeviceState->Variable DistanceAway Yvonne
Find My IDevices Done locating - iPhone - Yvonne
Find My IDevices Done Locating all iDevices
Find My IDevices Manual iDevice Update Requested (from Trigger)
Find My IDevices Retrieving location data
Script Ross's not Home
Find My IDevices Locating - iPhone - Alan, (Alan's 5)
Find My IDevices running with (1, 300) and None
Find My IDevices location: {'latitude': XX, 'timestamp': datetime.datetime(2013, 2, 20, 12, 49, 17), 'longitude': -XX, 'accuracy': 10.0}
Trigger FMiD DeviceState->Variable DistanceAway Alan
Script Yvonne's Home
Find My IDevices Done locating - iPhone - Alan
Find My IDevices Locating - iPhone - Becky, (Beckys iPhone)
Find My IDevices running with (2, 300) and None
Script Alan's not Home

Posted on
Wed Feb 20, 2013 7:02 pm
alang_94526 offline
Posts: 250
Joined: Apr 13, 2009

Re: Find my iDevices!

I removed one of the triggers (a Security Spy camera that was triggering too often erroneously) and cut down the sampling to reading once every 30 minutes.
It seems to be taking the location from that last sample (i.e. 30 minutes previously in this case).

2013-02-20 16:00:01 Find My IDevices location: {'latitude': XXX, 'timestamp': datetime.datetime(2013, 2, 20, 15, 32, 3), 'longitude': -XXX, 'accuracy': 65.0}

Who is online

Users browsing this forum: No registered users and 2 guests