Vera - Smarter Home Control Forum

Advanced => Plugins & Plugin Development => Programming => IPhone Locator => Topic started by: amg0 on October 06, 2013, 04:52:35 pm

Title: Plugin - IPhone Locator
Post by: amg0 on October 06, 2013, 04:52:35 pm
From working going on the thread http://forum.micasaverde.com/index.php/topic,15565.0.html I created a plugin to report apple device position from the iCloud service.

Official version can be installed from the App Store.
Beta versions from here:
http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions)

I summarized herebelow the information and features for this plugin.
New: You will find a step by step UI5 installation document here: http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf

For those who really like it and feel like it, you can donate what you want here on Paypal. It will not buy you more support not any garantee that this can be maintained or evolve in the future but if you want to show you are happy and like my kids to transform some of the time I steal from them into some 'concrete' returns, please feel very free ( and absolutely not forced to ) to donate whatever you want.  thank you ! : https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=Z5KFCB3VH6MCQ&lc=FR&item_name=amg0&item_number=IPhoneLocator&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted (https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=Z5KFCB3VH6MCQ&lc=FR&item_name=amg0&item_number=IPhoneLocator&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).

Version Change Log
http://forum.micasaverde.com/index.php/topic,29732.msg210672.html#msg210672

Latest Version : 2.42
Features

Variables

Notifications


uPNP Actions

More information about auto polling mode
ModeDistanceSpeedEtaPolling
Directcalculated from gps coordinate from the last and previous positionscalculated from ratio distance/polling. if speed is less than MIN_SPEED it is considered null.calculated from distance/speed. if speed is null, it assumes a default speed (NOMOVE_SPEED) to make sure polling does not get too infrequentWith polling map: it uses the polling map, based on device distance.
Without polling map, it takes the ETA, remove from it a default LATENCY parameter to compensate for lateness of iCloud compared to reality, divide the eta by the PollingDivider set by the user.  Then the result is normalized to allways be between a MIN_PERIOD and MAX_PERIOD.
Driving, Bicycling, WalkingReceived from Google Matrix APIsame as above.ETA is not calculated, it is simply received from the google matrix API and therefore is subject to google calculation and estimation what your speed is based on the mode you selected.same as above.

Code: [Select]
local MIN_PERIOD = 10        -- poll cannot be less than this in sec
local MAX_PERIOD = 3600   -- poll cannot be more than this in sec
local ETA_LATENCY = 30      -- ETA Latency, removes this from ETA to compensate for iCloud latency
local MIN_SPEED = 5/3600   -- 5km/h (in km/s)
local NOMOVE_SPEED = 60/3600  - in km/s, when speed is null or <Min

Considerations for multiple devices in a single iCloud account

Considerations for UI7 HouseModes
Enjoy...
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 06, 2013, 05:03:48 pm
If you are looking for beta
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 06, 2013, 05:21:13 pm
Privacy mode is by setting "0" to AddrFormat. I could think of a helper in the Settings tab for sure
Quote
AddrFormat:
- it is either empty ( in which case it takes the json_obj.results[1].formatted_address from google API result and behaves like today )
- or it is "0" in which case this is the Privacy mode, only Present or Away status is shown but no other information like distance or address
- or it is a comma seperated list of values from 1 up to 7 to take the individual elements of json_obj.results[1].address_components array from the google API result. for instance you can have "AddrFormat" = "3,5".  the Order does matter.

Child devices are only installed if there is more than one device to report on in the iCloud account *AND* if the IPhoneName parameter enables selection of more than one. For instance putting ".*" in IPhoneName will report ALL your iCloud account devices
Quote
IPhoneName: a COMMA (',') separated list of Apple Device name associated to iCloud account and for which you want a device in VERA. NOTE the names are LUA pattern matching so something like "iPhone.*" is valid and will take ALL devices whose name is starting with "iPhone".  a name of ".*" will take ALL the devices declared in your iCloud. another example is to use the real names of several devices like device1name,device2name that will work to select only these 2 devices from iCloud
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 06, 2013, 05:32:35 pm
Works really well the childs!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 06, 2013, 05:34:29 pm
Works really well the childs!
good ! have fun, try the mute button on a child to see what happens
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 06, 2013, 05:39:21 pm
One remark, the child does not inherit the home long and lat. Location from the parent.
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 06, 2013, 05:48:58 pm
Thanks amg0!  ;)
Title: Re: Plugin - IPhone Locator
Post by: doon386 on October 06, 2013, 05:54:21 pm
Just installed the plugin for tracking my daughters iPhone. Seems to work just fine.

One nit, however. Being in the US we use miles (mi) rather than kilometers (km) for distance. Would it be possible to select/change the units between km & mi?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 06, 2013, 06:34:37 pm
Just installed the plugin for tracking my daughters iPhone. Seems to work just fine.

One nit, however. Being in the US we use miles (mi) rather than kilometers (km) for distance. Would it be possible to select/change the units between km & mi?

ok, added it in next version roll out.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 06, 2013, 06:36:26 pm
One remark, the child does not inherit the home long and lat. Location from the parent.

Added it too in future v1.30, also inheriting the "unit" now
Title: Re: Plugin - IPhone Locator
Post by: doon386 on October 06, 2013, 07:42:49 pm
Wow! You're quick. Thanks!
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 06, 2013, 09:06:33 pm
This is so fantastic work. Thank you, @amg0 ... especially for 'my' Mute/Unmute buttons  ::).

V1.30Beta could be installed without any problems from the link mentioned. The previously entered parameters were adopted.
I have only one iPhone configured and cannot report on child features.

A few remarks though:
- the privacy mode cannot be set in the settings tab. Entering a 0 is not possible !!!
- Privacy mode works though when entering the 0 directly in the Advanced Tab.

- the description fix for
Quote
fix of the East/West text that was wrong
seems to have gotten lost.

- the PollingMap cannot be set through the Settings Tab as there is no field and has to be entered in the Advanced Tab. Maybe this was your intention in the first place. Would be nice though to have this field in the Settings Tab with everything else.

- what does the (*) in front of my iPhone name in the device title represent (I have only a single iPhone defined)?


Thank you
MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 07, 2013, 03:28:25 am
This is so fantastic work. Thank you, @amg0 ... especially for 'my' Mute/Unmute buttons  ::).

V1.30Beta could be installed without any problems from the link mentioned. The previously entered parameters were adopted.
I have only one iPhone configured and cannot report on child features.

A few remarks though:
- the privacy mode cannot be set in the settings tab. Entering a 0 is not possible !!!
- Privacy mode works though when entering the 0 directly in the Advanced Tab.

- the description fix for
Quote
fix of the East/West text that was wrong
seems to have gotten lost.

- the PollingMap cannot be set through the Settings Tab as there is no field and has to be entered in the Advanced Tab. Maybe this was your intention in the first place. Would be nice though to have this field in the Settings Tab with everything else.

- what does the (*) in front of my iPhone name in the device title represent (I have only a single iPhone defined)?


Thank you
MJ

@emtschei,  have you done/forced  a browser cache refresh ( ctrl F5 or Shift F5 ) ?

It is needed sometime after upgrading a plugin files before the new *.JS pages ( like settings tab) and dashboard Json files are taken into account. It seems several problem you report should not be there and are not on my system. Specifically, I verified I can enter "0" in addrFormat from the Settings tab with out any problem. the text for longitude is also correct, it is >0 for East location.

The dynamic polling map is available in the Settings tab too. just in the line with Dynamic Polling, you should see a checkbox followed by a text field which is the dynamic polling map

the (*) in front of title, means this device is the parent device , the one who owns the iCloud crendential and doing the polling loop. if you had child devices, you would see that these do not have a (*) in their title
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 07, 2013, 03:36:58 am
I can also enter the 0 and also very smart to hide the KM away in the text  ;D
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 07, 2013, 06:27:09 am
I am trying to install the latest beta, but when i try to install from the app store i get an error message unable to check installation status. And on vera the mute und unmute buttons have disappeared, and in advanced settings i have version 1.24. Is this the way i should upgrade to 1.30 ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 07, 2013, 07:09:38 am
I am trying to install the latest beta, but when i try to install from the app store i get an error message unable to check installation status. And on vera the mute und unmute buttons have disappeared, and in advanced settings i have version 1.24. Is this the way i should upgrade to 1.30 ?

Strange. if this is not too much trouble I suggest you follow this method

Then it should be clean. if that does not work, I ll send you a package with the files.

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 07, 2013, 08:00:12 am
OK i will try that tomorrow evening as i am out tonight and cannot try today. I come to think it might be a browser issue. If it isnt i'll be in touch again, thanks
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 07, 2013, 10:18:42 am
@emtschei,  have you done/forced  a browser cache refresh ( ctrl F5 or Shift F5 ) ?

It is needed sometime after upgrading a plugin files before the new *.JS pages ( like settings tab) and dashboard Json files are taken into account. It seems several problem you report should not be there and are not on my system. Specifically, I verified I can enter "0" in addrFormat from the Settings tab with out any problem. the text for longitude is also correct, it is >0 for East location.

The dynamic polling map is available in the Settings tab too. just in the line with Dynamic Polling, you should see a checkbox followed by a text field which is the dynamic polling map

the (*) in front of title, means this device is the parent device , the one who owns the iCloud crendential and doing the polling loop. if you had child devices, you would see that these do not have a (*) in their title

Apologies, @amg0. My bad. Yes, after browser refresh, everything works/looks as specified.
Gotta make a mental note to refresh the browser before shouting out loud  ::).

Thanks
MJ
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 07, 2013, 11:14:34 am
Is it possible (or will it be possible) to use the distance in PLEG ? I just checked and on my (old 1.24) version at least i can only use away or present as triggers
Title: Re: Plugin - IPhone Locator
Post by: RichardTSchaefer on October 07, 2013, 11:51:21 am
@Mike123

If they have a distance Variable in the Advanced Tab of the plugin ... If you bind this to a variable in PLEG it will get triggered when ever the value changes.

PLEG/PLTS are not limited to just Triggers defined by a device!

Then you can have a conditions like:

NEAR     Distance < 10
Far        Distance > 10
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 07, 2013, 01:59:22 pm
I just made an private release on the app store : 1.30 beta2
it includes the few fixes and the Unit selection (N K or M for nautical, Kilometer, or statute miles).
you can install from http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions)

EDIT: I had a fix  a bug with pattern matching which was sometime creating wrong names for devices. it was bad enough that I decided to make an immediate fix on the app store : 1.30 beta3
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 07, 2013, 02:38:54 pm
Is there a way to change which parent device is taken? I want my own iPhone to be the parent, but it always takes my wife's one.
Otherwise I need to redo all my triggers etc
Title: Re: Plugin - IPhone Locator
Post by: clippermiami on October 07, 2013, 05:40:12 pm
I've installed the iPhoneLocator plugin for my daughter's iPhone (she's the only one in the house that uses Apple). Is there a comparable capability for Android phones? Everything I've cobbled up with Tasker, Ping Sensor, et al is crude and unreliable  by comparison.
Title: Re: Plugin - IPhone Locator
Post by: Schuffelen on October 08, 2013, 05:04:32 am
I installed the iPhone locator version 1.23, and created with PLEG and a virtual switch a logic, that if I press the switch meaning I am coming home, and the distance is lower than 5km the gate of my house will open (and if dark the lights will go on), the PLEG functions well, however it was abit of a dissapointment that the gate was closed when I arrived at home. Seems the iphone locator was not updating the position (poll is at 60 seconds). When I opend the GUI i noticed the position was still old and after pressing the refresh button the right position came in. After that I see positions updated every 60 seconds, but am I overlooking something does it stop after a certain time polling the position? In other words what do I need to do to get regular position updates.
Should I fire a time pulse every minute which activates the refresh button just to be sure.

I noticed the version 1.3 has mute an unmute buttons, so I can add to the logic it will only poll when I have pressed the Coming Home Button, which automatically resets when the Pleg starts to open the gate.


Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on October 08, 2013, 09:13:17 am
Hello,

Two problems I am trying to figure out on both v1.21 & v1.30 beta3 (Vera3 1.5.622)

I'm testing 3 iDevices with three separate Apple IDs. During testing, I've tried to delete individual devices, ex. delete "Dad's iPhone" but leave "Mom's iPhone" remaining. It seems that if you try to delete one device, it won't delete. Even after reload's & browser refreshes. You must uninstall the plugin completely, reinstall & start over. Is this the intended behavior or am I doing something wrong?

Second question: Has anyone gotten this to work with an iPad (3rd Generation)? I've tried multiple ways, first from scratch (remove & reinstall plugin), the plugin creates the default device (iPhoneLocator). Modify the settings as required for "Dog's iPad" with the proper id, password, & device name on iCloud.

The iPad has never displayed location, it is always "none". Advanced tab shows Location:none & LastUpdate:0.

I then tried another method. (Uninstall & reinstall plugin 1.30 beta3)
Add "Dad's iPhone" modify plugin settings = Working OK
Add "Mom's iPhone" modify plugin settings = Working OK
Add "Dog's iPad" modify plugin settings = NOT working.

I've tried to press the "Refresh" button. Sometimes the locator shows up on the iPad (which could be coincidence), most times not. Either way, the device does not update. I've read both threads and do not remember seeing anything related to the iPad. Browsing to the iCloud link is the same "https://www.icloud.com/#find" for both iPhone & iPad.

Is there a way to test iPad?

Anyway, thanks for creating this plugin amg0.

Regards,

Chris

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 08, 2013, 09:49:55 am
I have upgraded to 1.30 beta3.
Few little problems
My wifes iphone device works fine, changed adre format to 7, and units to miles, all ok.
I have more than one device on my icould, my iphone being the main one and only one i want to use, and that was the only one i created before updating the plugin. I now have my ipad as the master device with (*)in the device name. Also the adr format change does not work, nor does the change of units (have saved and reloaded). Units are still being displayed as km although changed to m, and full addeess being displayed with 7 in adr format. Also if i mute/unmute my phone that mutes/unmutes all my other devices
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on October 08, 2013, 11:12:22 am
plugin is perfect , been trying it since 1.2 , i love it . just tried dynamic polling and it's working great .

any idea how to change the icons ?

thanks for the great effort .

Rami
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 08, 2013, 11:24:16 am
any idea how to change the icons ?

You'll find the icons here:
Code: [Select]
./overlay/www/cmh/skins/default/icons/iconIPhone_0.png
./overlay/www/cmh/skins/default/icons/iconIPhone_100.png
./overlay/www/cmh/skins/default/icons/iconIPhone_25.png
./overlay/www/cmh/skins/default/icons/iconIPhone_50.png
./overlay/www/cmh/skins/default/icons/iconIPhone_75.png

Note they are getting overwritten with a plugin update.

MJ
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on October 08, 2013, 11:26:14 am
Thanks a lot. But I didn't mean this. There is a variable in the advanced tab for the icons , right ? This is how I can change them ? Cause I only see one icon displayed


Sent from my iPhone using Tapatalk - now Free (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 08, 2013, 11:32:08 am
Not sure what you want to achieve. You always see only one icon at a time.
The variable in the advanced tab represents the currently displayed icon. The number correlates with the filenames mentioned previously.
If the icon changes (Away/Present, Mute/Unmute) the number in this field is updated too.
You can of course change this field manually (and do a reload of Luup) but it gets changed again at the next refresh.

Does this somehow answer your question?
MJ
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on October 08, 2013, 11:39:38 am
Thanks for your help

for some weird reason i only see one icon only , even if the device is away or present , mute or unmute status , it doesn't change the icon .

see attached image

Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 08, 2013, 12:05:21 pm
Ah, I see.
Have you refreshed your browser?
[CTRL]-[F5] usually does the trick or closing all browser windows or rebooting the PC ...

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 08, 2013, 02:00:38 pm
I have upgraded to 1.30 beta3.
Few little problems
My wifes iphone device works fine, changed adre format to 7, and units to miles, all ok.
I have more than one device on my icould, my iphone being the main one and only one i want to use, and that was the only one i created before updating the plugin. I now have my ipad as the master device with (*)in the device name. Also the adr format change does not work, nor does the change of units (have saved and reloaded). Units are still being displayed as km although changed to m, and full addeess being displayed with 7 in adr format. Also if i mute/unmute my phone that mutes/unmutes all my other devices


hope this helps
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 08, 2013, 02:14:07 pm
Hello,

Two problems I am trying to figure out on both v1.21 & v1.30 beta3 (Vera3 1.5.622)

I'm testing 3 iDevices with three separate Apple IDs. During testing, I've tried to delete individual devices, ex. delete "Dad's iPhone" but leave "Mom's iPhone" remaining. It seems that if you try to delete one device, it won't delete. Even after reload's & browser refreshes. You must uninstall the plugin completely, reinstall & start over. Is this the intended behavior or am I doing something wrong?

Second question: Has anyone gotten this to work with an iPad (3rd Generation)? I've tried multiple ways, first from scratch (remove & reinstall plugin), the plugin creates the default device (iPhoneLocator). Modify the settings as required for "Dog's iPad" with the proper id, password, & device name on iCloud.

The iPad has never displayed location, it is always "none". Advanced tab shows Location:none & LastUpdate:0.

I then tried another method. (Uninstall & reinstall plugin 1.30 beta3)
Add "Dad's iPhone" modify plugin settings = Working OK
Add "Mom's iPhone" modify plugin settings = Working OK
Add "Dog's iPad" modify plugin settings = NOT working.

I've tried to press the "Refresh" button. Sometimes the locator shows up on the iPad (which could be coincidence), most times not. Either way, the device does not update. I've read both threads and do not remember seeing anything related to the iPad. Browsing to the iCloud link is the same "https://www.icloud.com/#find" for both iPhone & iPad.

Is there a way to test iPad?

Anyway, thanks for creating this plugin amg0.

Regards,

Chris

on version > v1.30, devices are created automatically based on the content of iPhoneName parent device parameter. this is a string which controls which device you want. it does not matter if you delete them, they will be recreated again at the next time the luup engine is restarted. The iPhoneName parameter should be a comma seperated list of names you want to have.

useful patterns:

I have a iPad2 and it works perfectly. from the plugin standpoint, there is really no difference between iPads and iPhones, maybe check that this iPad is really enabled for location reporting in the IOS settings. one way to be sure is to use v1.30 and put '.*' in iPhoneName. it will fetch and create a device for every single iDevice associated to your iCloud account which is enabled for location tracking

Hope this helps

Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on October 08, 2013, 03:13:14 pm
amg0,
Thanks for your time,


 . . . this is a string which controls which device you want. it does not matter if you delete them, they will be recreated again at the next time the luup engine is restarted. The iPhoneName parameter should be a comma seperated list of names you want to have. . . .

I don't see a comma separated list on my 3 devices since they are all individual separate Apple IDs. Each device has it's own iCloud account. But I want to remove only one of the devices without removing all of the devices by uninstalling the main plugin. Is my understanding in error?

I have a iPad2 and it works perfectly. from the plugin standpoint, there is really no difference between iPads and iPhones, maybe check that this iPad is really enabled for location reporting in the IOS settings. one way to be sure is to use v1.30 and put '.*' in iPhoneName. it will fetch and create a device for every single iDevice associated to your iCloud account which is enabled for location tracking

Well using '.*' in iPhoneName absolutely worked. ;D
'Dog's iPad' does not, but who cares, your workaround works.  :D :D Maybe it has something to do with the problem mikee1234 was having earlier with the apostrophe ' character.

Thanks again for your help

Chris

Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 08, 2013, 07:02:02 pm
Just a quick information for the community , I have posted v1.40 for official submission to be approved so it becomes official. it includes some fixes like the Unit selection etc... should be a quick matter for MCV to approve it


Now, for the most adventurous, who do not fear to face some bugs, you could also have a look at the new beta version on the store ( v1.41 ) which is doing something quite interesting... integration with google map... check out the new MAP tab on the device to see what I am talking about.
Beta version Install : http://apps.mios.com/test-plugin.php?id=4686&show=versions
Title: Re: Plugin - IPhone Locator
Post by: Piwtorak on October 08, 2013, 07:14:23 pm
to see the map what must be entered ? what means dd:pp ?

thanks...I am with 1.41 installed and  testing.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 08, 2013, 08:54:34 pm
dd:pp is the PollingMap entry you specify in the Dynamic Polling field in the settings tab.
dd stands for distance, pp stands for the polling interval in seconds.
Please see the very first post in this thread as it is all explained there and in various other posts.
Remember to also place a check mark before the Dynamic Polling field if you want these entries to be used for interval calculation.

MJ

http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221 (http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221)
Quote
PollingMap: Enables a polling duration based on the Distance reported. The Distance considered is the minimal of all distances between all devices and their base location for all the devices managed from this same iCloud account. if empty, dynamic polling follows a simple algorythm: if (Distance>100) the period is 10 times the based period, if Distance>10 the period is 3 times the based period.  if it is filled in, then its format is a COMMA (',') separated list of pairs like dist:polling. Number of pairs/steps is not fixed, up to you. for instance 0:600,1:60,10:300,100:1800 which would mean, if the distance is less than 1, polling will be 600s, if it is between 1 and 10, polling will be 60s, if it is between 10 and 100, polling will be 300s, if it is above 100, polling will be 1800s

http://forum.micasaverde.com/index.php/topic,15565.msg129969.html#msg129969 (http://forum.micasaverde.com/index.php/topic,15565.msg129969.html#msg129969)
Title: Re: Plugin - IPhone Locator
Post by: bucko on October 08, 2013, 09:02:04 pm
First of all you did a great job with this plugin amg0. Thank you for all the time and effort you put into this.

I am using datamine to record the distance variable. It is doing fine, except the timestamp shows GMT, I guess of the icloud server. I need to sync the time to my local time (+8) of GMT. How can I do this?

Thanks
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 08, 2013, 09:10:42 pm
I am using datamine to record the distance variable. It is doing fine, except the timestamp shows GMT, I guess of the icloud server. I need to sync the time to my local time (+8) of GMT. How can I do this?

Bucko, just curious ...
Are these different timestamps than the ones in the LuaUPnP.log log file. In this log mine are local time.
Does DataMine maybe record in UTC? Or it might be that @amg0 adjusts the time to local time before logging/displaying.

Code: [Select]
06      10/08/13 21:26:06.752   Device_Variable::m_szValue_set device: 42 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: MsgText was: 3.28 km @ Tue Oct  8 21:25:05 2013 now: 0.04 km @ Tue Oct  8 21:26:06 2013 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0
MJ
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 09, 2013, 04:37:22 am

  • What are your various device names and what do you have in the iPhoneName parameter of the parent device ( the one with the (*) in the title  ?  let me know and I ll suggest some more troubleshooting steps
  • Units values are N M K in upper case. I plan to change that to make it more user friendly in the final release
  • Mute/Unmute: perfectly normal. one parent device manages the call to iCloud for all its child device. if you mute one child device, you in fact mute the parent device ( mute means : no call to iCloud ) and therefore I show the mute icon to all devices impacted by the mute action

hope this helps

for the parent device, i have  (*)Mike's iPad with IPhoneName = Mike
child  Mike  which is my iphone which is called Mike
child  Mike?s iPad Mini
child  Mike?s iPhone  this should not be there, i only have 1 iphone
child  Mike?s iPod

unit name i have selected from the drop down box in the parent, and it is capital M everywhere
that is displaying km in the (*)Mike's iPad  but correct as miles on Mike. The others are displaying km, but i only have location services enabled on my iphone (Mike) so that could explain it
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 07:21:32 am
child  Mike?s iPhone  this should not be there, i only have 1 iphone

Mike, have you checked the iCloud account for your device names?
I noticed when one changes the name of an iDevice, the old name is still visible in iCloud and needs to be deleted manually.
Also, have you enabled the location services on your other iDevices for testing to see if the units are correctly displayed then?

MJ
Title: Re: Plugin - IPhone Locator
Post by: mikewooduk on October 09, 2013, 07:40:40 am
Hi,

First of all great application and I like it.

One thing that I cant get working is the location, the location is stating from Vera is over 800km away when I know its only about 20 miles away.

I have entered the Lat and Lon settings in the app, and my Vera 2 is set up to show the correct town in the uk.

Any suggestions?

Many thanks,

Mike
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 09, 2013, 07:41:20 am
I did change my iphone name in icloud and on the phone as i had a problem with the apostrophe. Will have a look in icloud to see if and how i can delete the obsolete iphone name
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 08:46:41 am
One thing that I cant get working is the location, the location is stating from Vera is over 800km away when I know its only about 20 miles away.

Just to make sure ... using the 'Find my iPhone' app on the phone does this show your device to be at the right location?
Also, did you enter the correct Lat/Lon in the settings field of the 'iPhone Locator' plugin? Your home location is specified there and has nothing to do with the setting of the Vera unit (Setup/Location).

Edit: and do a browser refresh [ctrl]-[F5]
Edit: remember to use decimal format (see posts below)

MJ
Title: Re: Plugin - IPhone Locator
Post by: betabob on October 09, 2013, 09:56:14 am
Great Plugin!

Is it possible to get a little more precision in the Lat/Long. I live in St. Croix USVI and the islands only 82sq miles. Find My iPhone can place me within 20 feet, however the plugin shows me 28 miles off the coast  :o Deep water :)

I did figure out you can use a - to get a west long ie: -64.77 so I went from 8000+ miles to 28 but I really need to be able to add the locations as -64.77xxxx and 17.72xxxx

I just realized the measurment is decimal degrees  :P
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 10:09:26 am
Yep ... East or West makes a difference  :).
You have to convert your coordinates to decimal format (17.43xxx/-64.46xxx).
My Home location displayed on the plugin is usually within 20 feet.

Convert here: http://boulter.com/gps/ (http://boulter.com/gps/)
or here: http://twcc.free.fr/ (http://twcc.free.fr/)
or google for "Coordinate converter".

MJ
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 09, 2013, 10:10:06 am
Great Plugin!

Is it possible to get a little more precision in the Lat/Long. I live in St. Croix USVI and the islands only 82sq miles. Find My iPhone can place me within 20 feet, however the plugin shows me 28 miles off the coast  :o Deep water :)

I did figure out you can use a - to get a west long ie: -64.46 so I went from 8000+ miles to 28 but I really need to be able to add the locations as -64.46.xxxx and 17.43.xxxx

I had this problem at first as well thinking it would only accept dd.dd not the full dd.dddddddd that is in my specification. I tried afterward, and was able to successfully use the full number. try it out and you should see similar results.

One thing I have noticed amg0, is when I first setup the plugin (I removed at one point to re-install fresh and test out a new version) upon the first save, my information always gets wiped out. So essentially you have to install, wait for refresh, type in info, then save, then re-enter information. Not sure if anyone else has experienced the same. It's also partially why I had the same problem at betabob here the first time around.

amg0 --> I'll say it again, awesome job on the plugin!! This is becoming quite an awesome function to have in my system.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 10:27:11 am
One thing I have noticed amg0, is when I first setup the plugin (I removed at one point to re-install fresh and test out a new version) upon the first save, my information always gets wiped out. So essentially you have to install, wait for refresh, type in info, then save, then re-enter information. Not sure if anyone else has experienced the same. It's also partially why I had the same problem at betabob here the first time around.

I think your are right,  @shmixx, if I recall correctly I had the same experience but it didn't bother me anymore when everything was working  :). Good point, though.

MJ
Title: Re: Plugin - IPhone Locator
Post by: betabob on October 09, 2013, 10:34:38 am
Just realized the issue and yes, it does accept the decimal setting all the way. What a great plugin!

I am having a issue with Parent/child. Even though I have the phones in the right order, Find My iPhone seems to be overriding the first entry in the parent field to what FMi thinks is the first.

Otherwise all is well.

Thanks!
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 09, 2013, 11:50:24 am
Is there a problem with the app store ? Trying to upgrade to the 1.41 beta, but when i try to log in i get login failed. try again. And this has been for a few hours now
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 11:58:53 am
Is there a problem with the app store ? Trying to upgrade to the 1.41 beta, but when i try to log in i get login failed. try again. And this has been for a few hours now

Nop, I can log-in without problems.

MJ
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 12:08:57 pm
I did figure out you can use a - to get a west long ie: -64.77 so I went from 8000+ miles to 28 but I really need to be able to add the locations as -64.77xxxx and 17.72xxxx

@amg0
You might want to improve the description of Lat/Lon on the settings tab a bit.
(99.8888888888 >0 for North / <0 for South (decimal))
(99.8888888888 >0 for East  / <0 for West  (decimal))

or similar.
These fields resulted in a few discussions for first-timers.

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 01:04:06 pm
to see the map what must be entered ? what means dd:pp ?
thanks...I am with 1.41 installed and  testing.
I meant google map: see attached pic

Different "map" than the "dynamic polling map" , I know , poor choice of words and confusing.
Dynamic polling map is a comma separated list of pairs distance:period. example
0:600,1:60,10:300,100:1800
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 01:13:45 pm

  • What are your various device names and what do you have in the iPhoneName parameter of the parent device ( the one with the (*) in the title  ?  let me know and I ll suggest some more troubleshooting steps
  • Units values are N M K in upper case. I plan to change that to make it more user friendly in the final release
  • Mute/Unmute: perfectly normal. one parent device manages the call to iCloud for all its child device. if you mute one child device, you in fact mute the parent device ( mute means : no call to iCloud ) and therefore I show the mute icon to all devices impacted by the mute action

hope this helps

for the parent device, i have  (*)Mike's iPad with IPhoneName = Mike
child  Mike  which is my iphone which is called Mike
child  Mike?s iPad Mini
child  Mike?s iPhone  this should not be there, i only have 1 iphone
child  Mike?s iPod

unit name i have selected from the drop down box in the parent, and it is capital M everywhere
that is displaying km in the (*)Mike's iPad  but correct as miles on Mike. The others are displaying km, but i only have location services enabled on my iphone (Mike) so that could explain it

yes, I think I had a bug. v1.40 v1.41 should not have that issue any more. also when using pattern matching ( meaning not having the full phone name in the IPhoneName variable ) for your phone called "Mike" I recommend to use the ^ character to mark the begin of the line and $ to mark the end so IPhoneName can be "^Mike$" if you want only that particular phone

Also maybe check what devices you have in your iCloud account by browsing the page https://www.icloud.com/#find which lists all devices in your account. you will see the exact names know. sometime legacy old phone names are still arround.  that https://www.icloud.com/#find page enables you to delete a device if needed
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 01:17:14 pm
Great Plugin!

Is it possible to get a little more precision in the Lat/Long. I live in St. Croix USVI and the islands only 82sq miles. Find My iPhone can place me within 20 feet, however the plugin shows me 28 miles off the coast  :o Deep water :)

I did figure out you can use a - to get a west long ie: -64.46 so I went from 8000+ miles to 28 but I really need to be able to add the locations as -64.46.xxxx and 17.43.xxxx

I had this problem at first as well thinking it would only accept dd.dd not the full dd.dddddddd that is in my specification. I tried afterward, and was able to successfully use the full number. try it out and you should see similar results.

One thing I have noticed amg0, is when I first setup the plugin (I removed at one point to re-install fresh and test out a new version) upon the first save, my information always gets wiped out. So essentially you have to install, wait for refresh, type in info, then save, then re-enter information. Not sure if anyone else has experienced the same. It's also partially why I had the same problem at betabob here the first time around.

amg0 --> I'll say it again, awesome job on the plugin!! This is becoming quite an awesome function to have in my system.

I experience the same sometime, not sure why at this point yet. after a new install I allways force a LUA reload ( top right button in VERA ) , then a browser clear cache refresh ( Ctrl+ F5 ) , then it usually works. I know this is a bit of a pain.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 01:22:29 pm
I did figure out you can use a - to get a west long ie: -64.77 so I went from 8000+ miles to 28 but I really need to be able to add the locations as -64.77xxxx and 17.72xxxx

@amg0
You might want to improve the description of Lat/Lon on the settings tab a bit.
(99.8888888888 >0 for North / <0 for South (decimal))
(99.8888888888 >0 for East  / <0 for West  (decimal))

or similar.
These fields resulted in a few discussions for first-timers.

MJ

agreed. I ll add something similar to that
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 09, 2013, 01:58:52 pm

I experience the same sometime, not sure why at this point yet. after a new install I allways force a LUA reload ( top right button in VERA ) , then a browser clear cache refresh ( Ctrl+ F5 ) , then it usually works. I know this is a bit of a pain.

amg0 glad to hear I'm not the only one!  :P

Nothing major, but figured it's worth illustrating as you rapidly update the plugin. Kudos on the speed at the revisions too. Question about 1.41 though, I saw the map. Nice little add-in. Is the purpose meant to just illustrate the lat/lon being entered? Or are there future plans to do something like show the dynamic polling ranges on this map along with our entered "home" location? I think that would be pretty cool to see as an enhancement.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 02:10:17 pm
@amg0

+1 for the Kudos.
You really do a splendid job with this plugin in terms of functionality but also speed of releases and new features and foremost with your patient support of your work.
Thank you

MJ
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 02:15:37 pm
@amg0

Didn't want the previous post messed up with more nagging  :D.

But here's something else I noticed.
This might of course be as per your design but I cannot enter decimals for distance in the PollingMap; eg: I'd like to enter
0:600,0.5:60,10:300,100:1800
       ^
       |

500 meters:60 seconds
as for my purposes 1km is to far off.

I am (still) using v.1.30Beta. Maybe this post is moot in the meantime.

MJ
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 09, 2013, 02:20:39 pm
@amg0

I have upgraded to 1.41, and used ^Mike$ for my device. Now all of the (unwanted) child devices have gone, even the 'old' duplicate iphone. And my distance is now displayed in miles, as i wanted.

Perfect.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 02:52:45 pm

I experience the same sometime, not sure why at this point yet. after a new install I allways force a LUA reload ( top right button in VERA ) , then a browser clear cache refresh ( Ctrl+ F5 ) , then it usually works. I know this is a bit of a pain.

amg0 glad to hear I'm not the only one!  :P

Nothing major, but figured it's worth illustrating as you rapidly update the plugin. Kudos on the speed at the revisions too. Question about 1.41 though, I saw the map. Nice little add-in. Is the purpose meant to just illustrate the lat/lon being entered? Or are there future plans to do something like show the dynamic polling ranges on this map along with our entered "home" location? I think that would be pretty cool to see as an enhancement.

Good idea, I do not know yet. for now the map shows 2 markers, one for the home location and one for the actual phone location.  all google map features are there so you can switch the background to satelitte or hybrid view, zoom in or out as you want, and even zoom down to street view level,  all inside UI5 device window.  Pretty  fun ...
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 09, 2013, 03:08:00 pm
Good idea, I do not know yet. for now the map shows 2 markers, one for the home location and one for the actual phone location.  all google map features are there so you can switch the background to satelitte or hybrid view, zoom in or out as you want, and even zoom down to street view level,  all inside UI5 device window.  Pretty  fun ...

amg0, I would have to agree, that is useful to be able to score that intel when testing, working with the system etc. Wish that was there when I first tried it out! :P

+1 to the decimal concept indicated by emtschei, I would like to do this as well as the first item in my dynamic polling map.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 09, 2013, 05:03:59 pm
+1 to the decimal concept indicated by emtschei, I would like to do this as well as the first item in my dynamic polling map.

attached is a v1.42 ( alpha ! ) with ability to put a float for the distance parameters in the polling map string. let me know
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 09, 2013, 09:00:06 pm
amg0 - sorry for my confusion, what is meant by a "float"? Are you indicating a decimal can work here?
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 09:33:17 pm
amg0 - sorry for my confusion, what is meant by a "float"? Are you indicating a decimal can work here?
Yes, that's what it means :).
Title: Re: Plugin - IPhone Locator
Post by: bucko on October 09, 2013, 09:49:27 pm
I am using datamine to record the distance variable. It is doing fine, except the timestamp shows GMT, I guess of the icloud server. I need to sync the time to my local time (+8) of GMT. How can I do this?

Bucko, just curious ...
Are these different timestamps than the ones in the LuaUPnP.log log file. In this log mine are local time.
Does DataMine maybe record in UTC? Or it might be that @amg0 adjusts the time to local time before logging/displaying.

Code: [Select]
06      10/08/13 21:26:06.752   Device_Variable::m_szValue_set device: 42 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: MsgText was: 3.28 km @ Tue Oct  8 21:25:05 2013 now: 0.04 km @ Tue Oct  8 21:26:06 2013 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0
MJ
What I did was to reinstall the plugin (to 1.41), and now the time/distance output in datamine is correct. I have no idea what happened, but it's working.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 09, 2013, 10:21:52 pm
Quote
What I did was to reinstall the plugin (to 1.41), and now the time/distance output in datamine is correct. I have no idea what happened, but it's working.

Oki. Great it works. Sometimes problems just solve themselves :D.
Title: Re: Plugin - IPhone Locator
Post by: brettow on October 10, 2013, 05:01:34 am
Has anyone had the issue where the IPhone Name wont take after saving in the settings tab?

Everything else seems to save its just that field that seems to be a problem.

Btw fantastic work on this app. Lights off when everyone leaves the house is simple now.

Edit: had the quotes in the field...  ;D
Title: Re: Plugin - IPhone Locator
Post by: Weeves on October 10, 2013, 05:06:00 am
@amg - great work!

I may have an unusual use case, but is there a way to have two children with the same idevice but a different "home location".
I'd like to have "Joe at Home" and "Joe at Work"
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 10, 2013, 07:23:09 am
Strange problem with refresh. When i press refresh on my wifes iphone, it updates the location within a few seconds. I do the same on mine, nothing happens. I am on 1.41. My wifes iphone is on mute, mine isnt. Mine has not updated location since 06.15, it is now 12.20.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 10, 2013, 08:27:07 am
I may have an unusual use case, but is there a way to have two children with the same idevice but a different "home location".
I'd like to have "Joe at Home" and "Joe at Work"

You can install two instances (devices) of the plugin and configure them individually. These devices are independent from each other and should behave properly even when you have the same AppleId for both.
Goto [Apps] - click the iPhone Locator plugin - and click [Create another]

Hope this is what you were looking for.
MJ
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 10, 2013, 09:39:34 am
Quote
What I did was to reinstall the plugin (to 1.41), and now the time/distance output in datamine is correct. I have no idea what happened, but it's working.

Oki. Great it works. Sometimes problems just solve themselves :D.

I love when that happens!! :D

Now I can experiment with the decimals as this will help for my area. I tend to go out for short trips in the area (market, coffee, etc) and they are so close I still am OK keeping the poll in a different interval to make sure I get a true update when I leave/arrive. Now I just need to sort out the trouble I'm having with vera restarts after setting this and PLEG up to mute/unmute. I seem to be locking up my vera and suddenly iLocator stops locating me until I get the vera restart message and all resumes as normal again. I'll update the thread once I've narrowed it down and can see what's going wrong.
Title: Re: Plugin - IPhone Locator
Post by: Mic on October 10, 2013, 10:20:15 am
Great plugin, seems to work good, only install it yesterday. Thanks for your hard work.
Title: Re: Plugin - IPhone Locator
Post by: captainigloo on October 10, 2013, 11:28:19 am
Hello
For me version 1.40 and 1.41 release does not work, while 1.21 works fine. Why ???
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 10, 2013, 11:55:38 am
Hello
For me version 1.40 and 1.41 release does not work, while 1.21 works fine. Why ???

Bonjour Capitaine Igloo

Did you try to reboot your Vera system, refresh your browser [CTRL]-[F5] or reboot PC.
What does not work, what does the log say: http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP (http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP)?
We need a bit more info as to what is wrong (log extracts/screenshots/error messages, etc.).

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 01:37:52 pm
@amg - great work!

I may have an unusual use case, but is there a way to have two children with the same idevice but a different "home location".
I'd like to have "Joe at Home" and "Joe at Work"

Hello Weeves, not yet. but the workaround of @emtschei is good. Your use case is definitely something that is new & interesting. at this point it would mean some complexity as the unicity of children now would not just be idevice name but idevice name + location with some interesting questions on how to name the device so that VERA does not delete/recreate it each time you change the location...  food for thoughts

However you could reduce the number of calls to iCloud even with the workaround suggested with 2 root devices since you could have some PLEG or scene logic that puts one device in Mute while the other device tells you the iPhone is at Home. after all an iPhone cannot be both in 2 places and maybe you can play with this to only enable polling if none of the devices tells you the device is close to the "base" location
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 10, 2013, 02:41:02 pm
Strange problem with refresh. When i press refresh on my wifes iphone, it updates the location within a few seconds. I do the same on mine, nothing happens. I am on 1.41. My wifes iphone is on mute, mine isnt. Mine has not updated location since 06.15, it is now 12.20.

I have just come home (18.45) and location of my iphone still had not changed since 6.15 this morning. I have Polling period: 720, and Dynamic Polling: map ticked and this 0:900,1:90,5:450,15:900,100:2800 in the field next to it. I guess that there is something wrong ?
Title: Re: Plugin - IPhone Locator
Post by: Piwtorak on October 10, 2013, 02:42:24 pm
with me happens the same but after 1 or 2 days comes back to work...
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 10, 2013, 03:07:55 pm
Modifying this post as I'm all over on a different issue I'm having. The plugin seems to be operating normal according to logs, but I need to do some extra work to resolve some conflict being had on my Vera.

Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 03:51:30 pm
Strange problem with refresh. When i press refresh on my wifes iphone, it updates the location within a few seconds. I do the same on mine, nothing happens. I am on 1.41. My wifes iphone is on mute, mine isnt. Mine has not updated location since 06.15, it is now 12.20.

I have just come home (18.45) and location of my iphone still had not changed since 6.15 this morning. I have Polling period: 720, and Dynamic Polling: map ticked and this 0:900,1:90,5:450,15:900,100:2800 in the field next to it. I guess that there is something wrong ?

I have been seeing something peculiar like this and tried to track it down. It seems my Vera Lite was getting loaded and was crashing due to the logs being generated. I seem to have been able to grab the offending logs I believe to help amg0 troubleshoot the problem (as he knows from my PM)  ;)

This time my device hasn't restarted (assuming from a buildup of logs) and I was able to pull live logs. It may require more verbose logs, but I do see something that doesn't look proper. Down to the offending logs:

08   10/10/13 14:55:40.468   JobHandler_LuaUPnP::HandleActionRequest device: 53 service: urn:micasaverde-com:serviceId:HaDevice1 action: Poll <0x2e2f1680>
08   10/10/13 14:55:40.468   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=53 <0x2e2f1680>
08   10/10/13 14:55:40.468   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HaDevice1 <0x2e2f1680>
08   10/10/13 14:55:40.468   JobHandler_LuaUPnP::HandleActionRequest argument action=Poll <0x2e2f1680>
02   10/10/13 14:55:40.469   Device_LuaUPnP::HandleActionRequest 53 none of the 1 implementations handled it <0x2e2f1680>
02   10/10/13 14:55:40.469   JobHandler_LuaUPnP::RunAction device 53 action urn:micasaverde-com:serviceId:HaDevice1/Poll failed with 501/No implementation <0x2e2f1680>
02   10/10/13 14:55:50.102   ZZZ-POLLING H1,C1,H2,C2,/1/1 <0x2c4f1680>

I'll add in that DeviceNum 53 is my iPhoneLocator not sure why the name here for serviceId doesn't reflect as such. Using v1.41 and the polling map is listed as such: 0:60,5:120,10:300,30:900

Hello shmixx, no I am sorry but that log does not tell me a lot. . this "Poll" action is probably something  internal to Vera and I have no idea what that could be or why this could be failing.   The best bet is to enable DEBUG mode like explained and get a complete LuaPNP.log file.  you could also run a command like tail -f luaPNP.log | grep iPhoneLocator in a ptty terminal and it will show us exactly all the debug lines generated by the IPhone plugin

NOTE to ALL users: I did pinpoint a potential bug, make sure PollingBase has a numeric value in it , whatever mode you use the polling ( dynamic or not ). no value could cause the plug in to crash and the symptom is no periodic refresh any more
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 04:12:40 pm
Strange problem with refresh. When i press refresh on my wifes iphone, it updates the location within a few seconds. I do the same on mine, nothing happens. I am on 1.41. My wifes iphone is on mute, mine isnt. Mine has not updated location since 06.15, it is now 12.20.

I have just come home (18.45) and location of my iphone still had not changed since 6.15 this morning. I have Polling period: 720, and Dynamic Polling: map ticked and this 0:900,1:90,5:450,15:900,100:2800 in the field next to it. I guess that there is something wrong ?

I have a potential bug in v<1.43 where empty PollingBase or PollingAuto could crash the plugin and prevent future refreshes. so my advise is upgrade to v >= 1.43 , or make sure these 2 variables are not left empty. hope it helps
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 10, 2013, 04:38:44 pm
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D

Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 10, 2013, 04:50:40 pm
Nice work amg0!

I borrowed from your work (before you went and made it a plugin) and have been playing around with your code.

The purpose of the "fork" was to support different devices and location services. Since I don't have Android or Windows Phone(s) to play with, I merely built a crude framework to base it all on. May be an idea to consider merging?

My "stuff" is published publicly on GitHub https://github.com/snappygeek/Vera-GeoFence (https://github.com/snappygeek/Vera-GeoFence)

PS: I'm a horrible coder.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 10, 2013, 05:27:32 pm
@amg0

You are too quick with your updates ! I thought i was on the newest version 1.41... now its already 1.43  This is fantastic to see this great plugin developing further and further. Going to get the newest update now. By the time I log into the app store it might be 1.45 already...  ;D
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 05:44:23 pm
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D

you have variables curLat and curLong for latest detected position and prevLat, prevLong for previous detected position. this is how I determine if the phone is going away or moving closer  ( that logic is already built in the plugin and is how I chose what ICON to show ).
Code: [Select]
-- save position
debug(string.format("saving lat:%f long:%f",lat,long))
local curlatitude = luup.variable_get(service,"CurLat", lul_device)
local curlongitude = luup.variable_get(service,"CurLong", lul_device)
debug(string.format("old values lat:%f long:%f",curlatitude,curlongitude))
luup.variable_set(service, "PrevLat", curlatitude, lul_device)
luup.variable_set(service, "PrevLong", curlongitude, lul_device)
luup.variable_set(service, "CurLat", lat, lul_device)
luup.variable_set(service, "CurLong", long, lul_device)
using the function distanceBetween(lat1, lon1, lat2, lon2, distance_unit)  in the code you can compare distance with home, or even distance between the 2 points.  at some point I had some thinking about predicting arrival at home by calculating distance between last and prev position,  dividing by period between 2 poll and have an average speed... but I did not code that yet.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 05:49:49 pm
@amg0

You are too quick with your updates ! I thought i was on the newest version 1.41... now its already 1.43  This is fantastic to see this great plugin developing further and further. Going to get the newest update now. By the time I log into the app store it might be 1.45 already...  ;D

yes agile programing  :)  in fact I just release a private version of v1.44 and I would like feedbacks on the Google Map and the Center Buttons.  does it work for you ? do you see the map ?  I am a bit confused by google map API and whether or not I need to register a developper API key. on my machine it works without it, but what about yours ?   thx for your inputs
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 10, 2013, 05:55:38 pm
I just upgraded to 1.43, i did not see 1.44  (I have the newer 1.43)  Happy to try though, but i might not be able to give you feedback until Saturday
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 10, 2013, 06:05:01 pm
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo
Title: Re: Plugin - IPhone Locator
Post by: Welchap on October 10, 2013, 06:14:38 pm
Hi,

this  is a great plugin - but do others find it drains your phone battery? - seems pinging FindMyIphone constantly (or every few minutes as I have it set) really draws down the battery.  This leads to a bit of a dilemma - how to set the polling frequency often enough to be useful but minimise battery drain.

Also, we have a couple of Iphones on the same iCloud account but I only up the locator to look for mine - however, my wife is complaining her battery is draining quicker too.  Does iCloud ping all devices even if the plugin is only monitoring one of them ?

I will have to play with the polling interval and the Dynamic Polling settings to see if I can find optimal settings.  Anyone else found a sweet spot ?

Thanks


Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 10, 2013, 06:37:27 pm
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo

@amg0
Maybe it would also make sense to inject another new variable in the Advanced Tab where you just give the status of your calculations like: to/from/steady/home or going/coming/steady/home or such ... which then can be fetched by Lua code.
This would free potential users to figure out how to code these result (eg. @nutcracker).
Just a thought ...

MJ
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 10, 2013, 07:15:01 pm
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo

@amg0
Maybe it would also make sense to inject another new variable in the Advanced Tab where you just give the status of your calculations like: to/from/steady/home or going/coming/steady/home or such ... which then can be fetched by Lua code.
This would free potential users to figure out how to code these result (eg. @nutcracker).
Just a thought ...

MJ

+1!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 11, 2013, 02:00:06 am
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo

@amg0
Maybe it would also make sense to inject another new variable in the Advanced Tab where you just give the status of your calculations like: to/from/steady/home or going/coming/steady/home or such ... which then can be fetched by Lua code.
This would free potential users to figure out how to code these result (eg. @nutcracker).
Just a thought ...

MJ

+1!

I agree but do not you already have it ? if you fetch IconCode plugin variable, it returns a number:
0: means away
25: means out and going away
50: means muted
75: means away but coming home
100: means home

so another variable would be more user friendly but would have exactly the same values/semantic, hence I am not sure if it is really necessary.  what are the thoughts ?
Title: Re: Plugin - IPhone Locator
Post by: captainigloo on October 11, 2013, 02:03:10 am
No match device :
50   10/11/13 7:58:21.091   luup_log:118: IPhoneLocator: forceRefresh action is called on behalf of device:118 <0x30504680>
50   10/11/13 7:58:22.584   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPhone4S-Sebastien pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.586   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad2-Sebastien pattern:iPhone4S-Sebastien <0x30504680>

Hello
For me version 1.40 and 1.41 release does not work, while 1.21 works fine. Why ???

Bonjour Capitaine Igloo

Did you try to reboot your Vera system, refresh your browser [CTRL]-[F5] or reboot PC.
What does not work, what does the log say: http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP (http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP)?
We need a bit more info as to what is wrong (log extracts/screenshots/error messages, etc.).

MJ
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 11, 2013, 02:19:38 am
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo

Thank you. As per your other post, I'll take a look at IconCode.

Btw, the support for _ didn't work when I upgraded recently - using the advanced tab work around in the meantime.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 11, 2013, 05:02:23 am
Hi amg0, would it be possible to add PrevDistance as a device variable so that it would be possible to work out if a device is moving towards or away from 'home'? (ok, so this could potentially be worked out by comparing the longitude and latitude figures against their previous values - but a little messy  :P).


Thanks, a great plugin!!  ;D
Should be easy. Will add to my todo

@amg0
Maybe it would also make sense to inject another new variable in the Advanced Tab where you just give the status of your calculations like: to/from/steady/home or going/coming/steady/home or such ... which then can be fetched by Lua code.
This would free potential users to figure out how to code these result (eg. @nutcracker).
Just a thought ...

MJ

The following is what I've used (in the past and currently) for plugins I've created for event triggers which PLEG could then use to ascertain direction.

For instance, a PLEG "Condition" could be (may be syntactically off): PhoneGoingAway = IsHome ; Five_Away ; Ten_Away < 00:30:00

And, of course, PLEG is capable of triggering scenes, etc.

This would avoid code outside of the plugin(s).

In D_*.json:

Code: [Select]
        {
            "id": 1,
            "label": {
                "lang_tag": "current_distance_greater",
                "text": "Distance to 'Home' is MORE than"
            },
            "serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
            "norepeat": "1",
            "argumentList": [
                {
                    "id": 1,
                    "prefix": {
                        "lang_tag": "hft_distance_tag",
                        "text": "Distance:"
                    },
                    "dataType": "i4",
                    "name": "CurrentDistance",
                    "comparisson": ">",
                    "suffix": {
                        "lang_tag": "hft_km_or_miles",
                        "text": "km or miles"
                    },
                    "HumanFriendlyText": {
                        "lang_tag": "hft_outside_radius",
                        "text": "_DEVICE_NAME_ is located OUTSIDE a radius of _ARGUMENT_VALUE_  KM/Miles/NM"
                    }

                }
            ]
        },
        {
            "id": 2,
            "label": {
                "lang_tag": "current_distance_less",
                "text": "Distance to 'Home' is LESS than"
            },
            "serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
            "norepeat": "1",
            "argumentList": [
                {
                    "id": 1,
                    "prefix": {
                        "lang_tag": "hft_distance_tag",
                        "text": "Distance:"
                    },
                    "dataType": "i4",
                    "name": "CurrentDistance",
                    "comparisson": "<",
                    "suffix": {
                        "lang_tag": "hft_km_or_miles",
                        "text": "km or miles"
                    },
                    "HumanFriendlyText": {
                        "lang_tag": "hft_inside_distance",
                        "text": "_DEVICE_NAME_ is located INSIDE a radius of _ARGUMENT_VALUE_ KM/Miles/NM"
                    }
                }
            ]
        },

In the S_*.xml file:
Code: [Select]
        <stateVariable>
            <sendEvents>yes</sendEvents>
            <name>CurrentDistance</name>
            <dataType>float</dataType>
            <defaultValue>0</defaultValue>
        </stateVariable>
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 11, 2013, 05:10:56 am
Looks as if the update to 1.43 did not do a lot to updating my postition on my iphone. It is stuck again not updating (settings:  I have Polling period: 720, and Dynamic Polling: map ticked and this 0:900,1:90,5:450,15:900,100:2800 in the field next to it. ) as per my previous post on this thread. Manual refresh still does not work, except when i am on my local LAN, then everything works fine, automatic updates and manual ones.
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 11, 2013, 08:09:27 am
@amg0 - sorry I can't PM (not permissioned?) - email format is aaaaaaaa_@aaa.com
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 11, 2013, 08:56:54 am
I agree but do not you already have it ? if you fetch IconCode plugin variable, it returns a number:
0: means away
25: means out and going away
50: means muted
75: means away but coming home
100: means home

so another variable would be more user friendly but would have exactly the same values/semantic, hence I am not sure if it is really necessary.  what are the thoughts ?

amg0 - I think from my perspective, I didn't realize those had different numerical values (my ignorance there), and the overall thought was to do similar to what you had mentioned before - build off logic to calculate distance changes over time and have a more accurate way to modify the polling period. I think we'll all be better suited to relax until you get farther into the code for that as it will probably be more optimal to have the calculation done in the plugin, vs trying to bolt it on. So I think I may retract my +1.  ;D

Meanwhile, I need to get out and test 1.44 and see if my polling gets stuck again and hopefully grab some logs of the issue. I'll get back to you when I'm able to test. Hopefully later today or into the evening when I step out.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 11, 2013, 01:31:15 pm
I agree but do not you already have it ? if you fetch IconCode plugin variable, it returns a number:
0: means away
25: means out and going away
50: means muted
75: means away but coming home
100: means home

so another variable would be more user friendly but would have exactly the same values/semantic, hence I am not sure if it is really necessary.  what are the thoughts ?

That of course make sense, @amg0, as the status is already there and I think one can work with this.
Thanks for the insight.

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 11, 2013, 01:36:23 pm
@amg0 - sorry I can't PM (not permissioned?) - email format is aaaaaaaa_@aaa.com

ah ok :(  no '.' in the middle ? I ll fix that
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 11, 2013, 03:49:32 pm
Great enhancement this Map feature.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 11, 2013, 05:00:58 pm
Hello everybody
I have nailed down a potential bug with auto polling when there are several devices. Stupid me but my algorythm was just wrong. here is the story:

As you now know, when an iCloud account had several devices, I was creating a root device and as many child devices as needed. Only the root device was controlling the poll to iCloud and therefore was having the polling map for notification. That polling map is enabling to select a polling duration from a given distance and the distance I was considering was the smallest of all distance of all devices under that root. But that is the error, it was assuming the closest the device is, the fastest poll frequency is needed.  In fact that is wrong when people use a map like 0:600,1:60,10:300 which essentially says less polling when the device is at home, lots of polling when it is close and less polling when it is far.

The right way is to calculate the polling period according to the map, for every single devices and simply select the minimal period required. so I made this fix.

Also in v1.45: I added a notification trigger on Distance variable and I relaxed a little bit the email regular expression pattern to enable the special format for @nutcracker. Center button for the google Map to center on either the phone or the base point, +  fix for the marker to move on the map as the phone moves.

Install:
http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions)

Doc updated in first post:
http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221 (http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221)
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 11, 2013, 05:36:51 pm
Thanks amg0!
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 11, 2013, 06:28:36 pm
You are an amazing fellow, @amg0.
So much improvement, so many new features ... in so little time.
Thanks a heap!
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 11, 2013, 06:55:10 pm
Is there a source control (SVN/Github/anything) repository somewhere for this plugin?

I've got a couple of things I think could be of use and it would be good to create a patch for you to consider.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 12, 2013, 07:35:27 am
v1.46 in the apps store.

Adds:
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 12, 2013, 07:39:59 am
Is there a source control (SVN/Github/anything) repository somewhere for this plugin?

I've got a couple of things I think could be of use and it would be good to create a patch for you to consider.

I use this http://code.mios.com/svn_public/mios_iphone-detector/ but I get more fun writing than reviewing other's :) I am open anyhow to any improvement , good ideas...  thanks a lot
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 12, 2013, 07:43:59 am
@amg0

I have upgraded to 1.45, see how the polling goes. If there are still problems i will enable the debug mode and send you the log file by email.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 12, 2013, 12:36:44 pm
v1.46 in the apps store.

Adds:
  • checkboxes on the google map to show the home base range,  and/or the polling map
  • Add a "PrevDistance" variable

This is so great. The visible polling map makes it much easier to see the various distances. It helps to determine what range you mostly are from home; like neighbors, post office run, trip to town, etc, and fine tune the distances accordingly to your specific needs. Thank you, @amg0.

MJ
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 12, 2013, 12:51:03 pm
No match device :
50   10/11/13 7:58:21.091   luup_log:118: IPhoneLocator: forceRefresh action is called on behalf of device:118 <0x30504680>
50   10/11/13 7:58:22.584   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPhone4S-Sebastien pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.586   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad2-Sebastien pattern:iPhone4S-Sebastien <0x30504680>

Hi Sebastien

Did you get it to work meanwhile?
Do you have blanks in the IPhone Name field in the settings tab?
Have you tried to rename your iPhone to something simpler and shorter and without special characters?

MJ
Title: Re: Plugin - IPhone Locator
Post by: pentium on October 12, 2013, 03:20:59 pm
I had an iphone name with an ' in it, like Mary's iphone.   removed the ' and it started working.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 12, 2013, 06:11:17 pm
amg0 - LOVING the new map in 1.46!! That is exactly what I had envisioned. That's perfect. It really helps to make it easy to visualize and tune appropriately. One thing I did notice, it only seems to have 3 or 4 rings, despite my having 5 polls listed. Is there a maximum here for this?

Keep the good stuff coming!!
Title: Re: Plugin - IPhone Locator
Post by: nutcracker on October 12, 2013, 06:51:31 pm
v1.46 in the apps store.

Adds:
  • checkboxes on the google map to show the home base range,  and/or the polling map
  • Add a "PrevDistance" variable

Thanks - PrevDistance working well!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 05:02:28 am
amg0 - LOVING the new map in 1.46!! That is exactly what I had envisioned. That's perfect. It really helps to make it easy to visualize and tune appropriately. One thing I did notice, it only seems to have 3 or 4 rings, despite my having 5 polls listed. Is there a maximum here for this?

Keep the good stuff coming!!
No limits to the number of rings. Maybe one is very close to your base that you have to zoom a lot to see it. Or maybe the color is not well visible, I uses gradual shift from red circles to green circles as the distance of the rings increases. ... Or maybe I have bug, I will double check
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 13, 2013, 05:38:51 am
@amg0

I am on 1.46 now. The polling seems to work a lot better now, but still not 100% sure its working 100%. Yesterday polling was very much where I would have expected it to be, my wife was out and i was watching her distance and polling, but it still did not seem as frequent as it should have been. Question is, could the device reporting (showing the last poll time on the device) be delayed ?
Also i have a schedule now muting both iphones over night, from 1:15 to 5:45. So both phones have been unmuted at 5:45, which is reflected in the device status. But the last poll shown on both phones is 1:09 (it is now 10:37 and still no update. I have been out this morning as well, and have a virtual switch being triggered when i am away, that has not been triggered, so i think my phone is not being polled at the moment. On the device, both pohones have a red dot but show present.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 08:25:38 am
@amg0

I am on 1.46 now. The polling seems to work a lot better now, but still not 100% sure its working 100%. Yesterday polling was very much where I would have expected it to be, my wife was out and i was watching her distance and polling, but it still did not seem as frequent as it should have been. Question is, could the device reporting (showing the last poll time on the device) be delayed ?
Also i have a schedule now muting both iphones over night, from 1:15 to 5:45. So both phones have been unmuted at 5:45, which is reflected in the device status. But the last poll shown on both phones is 1:09 (it is now 10:37 and still no update. I have been out this morning as well, and have a virtual switch being triggered when i am away, that has not been triggered, so i think my phone is not being polled at the moment. On the device, both pohones have a red dot but show present.

mike123
I am working on @shmixx's issue and thanks to his log, found a case where the plugin could crash and stop polling. What are you using in AddrFormat field right now ? do you observe polling stops if you leave AddrFormat empty ?

in fact, when moving around, the google reverse geocoding response could be quite vague and potentially AddrFormat tries to display information which does no exist in the google response. that explains why polling stop working when people are moving around, in low density areas...
I ll soon post a new version of lua fix but I am not sure this is fully enough. in fact type of information from google is not always at the same position. maybe we need a different mecanisms for AddrFormat since official google types (these: https://developers.google.com/maps/documentation/geocoding/?hl=fr#Types) are not garanteed to be allways present in the response or even in the same order...
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 13, 2013, 08:37:31 am
I had an iphone name with an ' in it, like Mary's iphone.   removed the ' and it started working.

Lua has requires quote/apostrophe characters to be escaped. I had the same problem and applied a version of the following patch (change). It resolved the issue for me w/o requiring people to rename their phones (doing so rubs my "ease of use" bone the wrong way ;-))

Updated findDeviceInAppleMap() function:
Code: [Select]
function findDeviceInAppleMap(device,map)
for key,value in pairs(map) do
if (escapeQuotes(value.name) == escapeQuotes(device)) then
return value
end
end
log("Did NOT find device "..device.." in map "..json.encode(map))
return nil
end

Added the escapeQuotes() function
Code: [Select]
------------------------------------------------
-- Escape quote characters (for string comp)
------------------------------------------------
function escapeQuotes( str )
if ( not string.match("\\", str) ) then
return str:gsub("\'", "\\'"):gsub("\?", '\\?'):gsub('\"','\\"') -- escape quote characters
else
return str
end
end
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 13, 2013, 08:39:28 am
I have polling period 720 (I believe it is not relevant what i have here with my setup ?)
Dynamic Polling: Map is ticked and in the field i have this: 0:1200,1:90,5:450,15:900,100:2800
If it would help you i would be more than happy to try to give you a log or anything to help you develop this further ?
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 13, 2013, 08:46:52 am
What are you using in AddrFormat field right now ? do you observe polling stops if you leave AddrFormat empty ?

@amg0
I have an empty AddrFormat and have noticed just now (after going through yesterday's log when seeing @mikee123 findings) that indeed I did not see any auto refresh during the time I was gone.
I think though I did not see any problems on the 1.41 version. When checking the logs then I saw constant updates on the Google location.

It should be easy though to validate the response from Google and fill non existing fields with dummy text or something ...

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 08:54:11 am
I have polling period 720 (I believe it is not relevant what i have here with my setup ?)
Dynamic Polling: Map is ticked and in the field i have this: 0:1200,1:90,5:450,15:900,100:2800
If it would help you i would be more than happy to try to give you a log or anything to help you develop this further ?

@Mikee123, I need to know what are you using in AddrFormatfield right now.
For creating a log file, please use this attached L_IPhone.lua file, it is in debug mode and includes the small fix I have done for @shmixx's issue


Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 09:23:27 am
No match device :
50   10/11/13 7:58:21.091   luup_log:118: IPhoneLocator: forceRefresh action is called on behalf of device:118 <0x30504680>
50   10/11/13 7:58:22.584   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPhone4S-Sebastien pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.585   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad de 3l33t pattern:iPhone4S-Sebastien <0x30504680>
50   10/11/13 7:58:22.586   luup_log:118: IPhoneLocator: iCloud device ignored, name:iPad2-Sebastien pattern:iPhone4S-Sebastien <0x30504680>

Hello
For me version 1.40 and 1.41 release does not work, while 1.21 works fine. Why ???

Bonjour Capitaine Igloo

Did you try to reboot your Vera system, refresh your browser [CTRL]-[F5] or reboot PC.
What does not work, what does the log say: http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP (http://<VeraIP>/cgi-bin/cmh/log.sh?Device=LuaUPnP)?
We need a bit more info as to what is wrong (log extracts/screenshots/error messages, etc.).

MJ

Remplacing "iPhone4S-Sebastien" by "^iPhone4S%-Sebastien$" should fix the problem. - is a magic caracter in lua patterns so it needs to be escaped by a % to be taken as a litteral value
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 09:40:23 am
I had an iphone name with an ' in it, like Mary's iphone.   removed the ' and it started working.

Lua has requires quote/apostrophe characters to be escaped. I had the same problem and applied a version of the following patch (change). It resolved the issue for me w/o requiring people to rename their phones (doing so rubs my "ease of use" bone the wrong way ;-))

Updated findDeviceInAppleMap() function:
Code: [Select]
function findDeviceInAppleMap(device,map)
for key,value in pairs(map) do
if (escapeQuotes(value.name) == escapeQuotes(device)) then
return value
end
end
log("Did NOT find device "..device.." in map "..json.encode(map))
return nil
end

Added the escapeQuotes() function
Code: [Select]
------------------------------------------------
-- Escape quote characters (for string comp)
------------------------------------------------
function escapeQuotes( str )
if ( not string.match("\\", str) ) then
return str:gsub("\'", "\\'"):gsub("\?", '\\?'):gsub('\"','\\"') -- escape quote characters
else
return str
end
end

Thank you @sjolshagen  i will include that in the next roll out. I am not sure I fully understand the line
Code: [Select]
not string.match("\\", str) , could you please explain it ?
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 13, 2013, 10:33:42 am
amg0 -> Just a quick question I was wondering about with the polling map. If I don't include a 0 polling distance, will anything less than the next polling distance take the polling base? Aka I use: 1:30,5:90:10:300. If I'm at 0.75, it would set the poll to the base? Or will it just use the lowest poll setting? Same for if I'm at home, would it take the base, or use the lowest poll threshold?
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 13, 2013, 10:34:47 am
@amg0

I am installing your file right now. How long do you want me to run it before i send it to you, and is there anything i should do / should not do with the iphonelocator before i send it ?

In my addrformat i have 7, and mostly it shows united kingdom, occasionally the city/town instead.

And where do i find the log file to send to you ?

I have set my wifes iphone addrformat to blank for the moment to see if that makes any difference, so i am on 7, she is blank
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 13, 2013, 11:27:40 am
Code: [Select]
function escapeQuotes( str )
if ( not string.match("\\", str) ) then
return str:gsub("\'", "\\'"):gsub("\?", '\\?'):gsub('\"','\\"') -- escape quote characters
else
return str
end
end

Thank you @sjolshagen  i will include that in the next roll out. I am not sure I fully understand the line
Code: [Select]
not string.match("\\", str) , could you please explain it ?

It's a copy/paste error on my part. In my plugin (based on your iPhoneLocator plugin) I put all of the devices listed in a Comma Separated list of devices for use in a drop-down on the settings page to select the device. To simplify (for myself), I escape the names when capturing them, so to avoid double escaping (which invalidates the comparison) I added a test for an escaped value. You probably should not include it.

Good catch & my bad.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 11:46:21 am
@amg0

I am installing your file right now. How long do you want me to run it before i send it to you, and is there anything i should do / should not do with the iphonelocator before i send it ?

In my addrformat i have 7, and mostly it shows united kingdom, occasionally the city/town instead.

And where do i find the log file to send to you ?

I have set my wifes iphone addrformat to blank for the moment to see if that makes any difference, so i am on 7, she is blank

nothing special with the new file, just run it until you see something wrong with polling.  if you did have 7 in addrformat I suspect that is the issue. sometime in low density area, google returned less than 7 components in the address and it crashed the plugin, thus stopping the refresh too. that file I sent should not have this problem ( but is in debug mode, so I ll ask you to update to the new release when available )
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 13, 2013, 11:48:34 am

nothing special with the new file, just run it until you see something wrong with polling.  if you did have 7 in addrformat I suspect that is the issue. sometime in low density area, google returned less than 7 components in the address and it crashed the plugin, thus stopping the refresh too. that file I sent should not have this problem ( but is in debug mode, so I ll ask you to update to the new release when available )

Adding the xpcall() wrapper (I included it in a PM I sent you yesterday @amg) around the json.decode() for the google data may prevent the plugin from crashing.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 11:57:24 am

nothing special with the new file, just run it until you see something wrong with polling.  if you did have 7 in addrformat I suspect that is the issue. sometime in low density area, google returned less than 7 components in the address and it crashed the plugin, thus stopping the refresh too. that file I sent should not have this problem ( but is in debug mode, so I ll ask you to update to the new release when available )

Adding the xpcall() wrapper (I included it in a PM I sent you yesterday @amg) around the json.decode() for the google data may prevent the plugin from crashing.

yes, thank for the tip. I am looking at this but , the issue here was different. it was trying to access an index (7) which does not exist in the array. the xpcall would not have helped. However, I am trying to think about using it as you suggested or perhaps slightly differently in order to make it safe so that even if some crash happens, we keep the polling running... still work in progress.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 11:58:55 am
amg0 -> Just a quick question I was wondering about with the polling map. If I don't include a 0 polling distance, will anything less than the next polling distance take the polling base? Aka I use: 1:30,5:90:10:300. If I'm at 0.75, it would set the poll to the base? Or will it just use the lowest poll setting? Same for if I'm at home, would it take the base, or use the lowest poll threshold?

it would set the poll to the base. it always take the Base , then look at the map to see if it should be changed. in your case, your distance 0.75 remains lower than all the distance meters of your map , so PollingBase is used. ( at least that is the theory ... )
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 13, 2013, 01:01:53 pm
amg0 -> Just a quick question I was wondering about with the polling map. If I don't include a 0 polling distance, will anything less than the next polling distance take the polling base? Aka I use: 1:30,5:90:10:300. If I'm at 0.75, it would set the poll to the base? Or will it just use the lowest poll setting? Same for if I'm at home, would it take the base, or use the lowest poll threshold?

it would set the poll to the base. it always take the Base , then look at the map to see if it should be changed. in your case, your distance 0.75 remains lower than all the distance meters of your map , so PollingBase is used. ( at least that is the theory ... )

Got it, I was guessing that would be the behavior but wanted to make sure I understood properly before tweaking this. So I've got an update after running the updated Lua you provided for Mike and I. Mixed results:

Started out this AM with the iPhone already in Present mode, with the Mute on. Uploaded your new file, and did a restart of Luup upon upload. Plugin looked to be fine upon reload. When I went to leave, my PLEG has a trigger to Unmute when a door is tripped to wake it up (unmute) for 5 minutes to see if I go away. If I go away, then it stays unmuted. It seems this worked as I saw the update on my phone of the unmute action as I left. I logged into the GUI to see the status as it didn't look like it was updating again, and it wasn't. I forced a refresh, but it stopped updating shortly after. While getting some brunch, coffee, and car wash, I tried to get access and found I wasn't even getting into the interface from the site. Said my device was unavailable. I think the Vera died for a little while. Miraculously it suddenly started up again and I got a notification. From this point forward, the updates/polling seemed to happen as desired.

I would provide logs, but unfortunately the logs were wiped when the Vera died it seems. When I got home and tried to pull the logs (your plugin still in debug) the file was quite small and only had an earliest timestamp of when the Vera came back to life. I'll keep an eye on it and leave it in debug over the course of the day if we go out and update you on the progress or how it behaves for the next day or so.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 13, 2013, 02:50:51 pm
@shmixx

Quote
When I went to leave, my PLEG has a trigger to Unmute when a door is tripped to wake it up (unmute) for 5 minutes to see if I go away. If I go away, then it stays unmuted

This is a brilliant idea. I have to try and replicate it, as i also have a door sensor which will trigger when someone leaves/enters the house, and muting the phone while at home stops the wife nagging that her battery is running out because of my silly ideas...  ;D
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 13, 2013, 05:19:26 pm
I am trying in PLEG to have a condition, if at home for longer than 15 mins mute the phone. I have created a device property

Jdirection   (*)Justine?s iPhone   IconCode   0

condition JUmute (Jdirection == 100) > NOW > 15:00  but PLEG did not like this


Program Logic : (Jdirection == 100); Now > 15: attempt to compare two nil values
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 13, 2013, 06:24:19 pm
Can you only have one (1) iCloud account configured when using v1.46? I'm trying out the iPhone Locator and can't seem to add a 2nd Vera device to manage my wife's iCloud account (we've got 2 different accounts for things like tracking, etc)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 06:27:23 pm
For information to the group, I am going to slowly go to a public release of v1.50. I guess trying to add less feature and stabilize/industrialize what I have for now.

I just released a v1.48 in that direction which includes the following improvements

as usual install from http://apps.mios.com/test-plugin.php?id=4686&show=versions. debug mode is disabled

in case of issues, try to enable debug mode and share the logs... a good way is to grep the log file with "IPhoneLocator" string
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 13, 2013, 06:31:37 pm
Can you only have one (1) iCloud account configured when using v1.46? I'm trying out the iPhone Locator and can't seem to add a 2nd Vera device to manage my wife's iCloud account (we've got 2 different accounts for things like tracking, etc)

one iCloud account <=> one root device. then IPhoneName variable controls what are the devices, associated to that iCloud account you want to have ( a specific name, or a pattern matching like .* for all). If you configure this to see more than one device, the plugin will create as many child devices as needed ( the root device counts for one )

If you and your wife have 2 different iCloud accounts, that is then 2 different instances of the plugin ( that you can create with the UI5 command "create another". each instance has its own variable for credentials & polling parameters.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 13, 2013, 09:27:02 pm
A few updates and direction for PLEG. Perhaps RichardT if monitoring the thread, can chime in to help provide some direction.

@mike123 re:PLEG - Below is the conditions I was using. You can take a guess what each of they triggers is as they are pretty self explanatory. I think I need to refine them though as once both have been met, I don't know as if they become false again properly. I'm still working on that but needed to get the iPhone plugin working properly more importantly. My goal here is to let PLEG control mute/unmute to save battery at home as you indicated. Then I can set the polling to be updated often enough at 0, so that I can set some automation like unlocking the house and disarming the alarm when I arrive home, as well as for when I leave.

CPhoneMuteOn1   TShawnHome AND (TShawnHome; Now > 5:00)
CPhoneMuteOn2   TShawnHome AND (CPhoneMuteOff; Now > 5:00)
CPhoneMuteOff           TFrontDoor OR TGarageDoor OR TArmed

@amg0 re:Updated Lua - After letting it run for the rest of the day, it looks as though things are working properly with your new fix. Glad you were able to nail it down, and especially so quickly. It looks to be working as expected now and have been successfully triggering a notification I configured for present/away status and been pretty swift in the updates appropriately.

@amg0 re:PollMap - In regard to a comment you made about the polling map being colored, I've attached an image of what my polling map looks like. Mine is showing shades of a blueish green color, though I Recall you said something of gradients between green/red? Also note there are only 3 rings, zooming out farther doesn't yield any more rings. I did find the other ring was just a lighter gradient of the blueish color, so I did solve that mystery.

and lastly ... @amg0, thank you again sir for all the hard work and effort you've put into this plugin. This is phenomenal!! Now that it's working, I'm excited to let it run for a week to make sure it picks me up properly as I tune the polling map, and I will be able to start automating actions based on my departure/arrival.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 14, 2013, 03:31:13 am
@amg0   

1.46 does not seem to solve the polling issue with 7 in addrformat. I have changed it to blank now (default) and will report back later

@shmixx

Thanks for posting your PLEg conditions, i am using something very similar, but it only works with manual updates for location at the moment. As you said, once everything is working fine we can adjust our PLEGs and maybe post them here for others. I think its always helpful to see what others are doing and then learn from the ideas and the programming
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 14, 2013, 05:27:12 am
It looks as if the upgrade to 1.48 has resolved the issues with the polling. So far working fine, with addformat set to 0 (privacy mode)
Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on October 14, 2013, 08:42:06 am
Just an F.Y.I. about battery usage.

One of the devices I've been testing is an iPad (3rd Generation). The battery age is about 15 months of light to moderate usage.
I'm not using dynamic polling, just standard polling every 2 minutes (setting 120)

The iPad was fully charged when I started this test.
I did not use the iPad at all.

From 6pm last night to 8am this morning (14 hours) the iPad battery usage went from 100% to 97%. I can only assume it was being queried from the icloud server every 2 minutes.

During the testing time, I occasionally checked the Vera logs and saw every 2 minutes, the plugin was firing. I couldn't monitor or save logs for a longer period. (haven't learned how to do that yet)

The device was at the home location the entire time.

I really need to test an iPhone 4S that my daughter has, which always exhibits poor battery life. When I can borrow it for a 6 to 8 hour stretch, I'll test that too.

Chris
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 14, 2013, 08:47:33 am
It looks as if the upgrade to 1.48 has resolved the issues with the polling. So far working fine, with addformat set to 0 (privacy mode)

@amg0 - Think I found a bug in L_IPhone.lua, line 653 where you compare period to 0. If the device is muted, the period variable is never instantiated and the comparison fails (hard). I fixed the crash by setting period = 0 within the "if (Muted == "1") then ... end" block.

Also PM'ed you a patch to support drop-downs for the device names (so people won't need to type in the device name which is error prone, IMHO).
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 14, 2013, 09:48:03 am
There might still be an issue with polling in 1.48, on my iphone everthing still working fine. My wifes phone is at home, logged into our wifi, which never was a problem with previous versions. I have her phone muted when at home, until a door is opened (door sensor switching phone to unmute). But even when the phone is unmuted, it does not seem to poll. Both phones are set to addrformat 0.
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on October 14, 2013, 09:59:38 am
Hey

I thought i might share my setup for this since i spent a lot of time to figure out the mute when i'm home and unmute when i'm away . i'm using the PING SENSOR with PLEG to mute and unmute iPhone locator , pretty basic setup .

When my iPhone is connected to the wifi network ping sensor is tripped and using PLEG i configured it to MUTE iphone locator , and once the iPhone is disconnected from my Wifi for 15 min the PLEG unmute the iphone locator , it's working very smoothly with me , i'm still struggling with PLEG though but for basic actions like this it's really easy
 
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 14, 2013, 10:07:22 am
@rmohsen

what ping settings are you using ? I have an iphone too (2 actually, a 4 and a 4s) and not sure how reliable the 'off' is. I can see the occasional green on the ping sensors when i am at home. What is your experience ? From what i have been told here i have set my ping sensor to invert, and the ping settings to 6 sec poll and 6 sec timeout
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on October 14, 2013, 10:40:23 am
Actually no , i'm using the normal status not the inverted one , when it's tripped ( red ) it means my iPhone is connected to the network , Green means it's not . i'm ok with this and i don't need to invert it though ,

Ping duration is 5 seconds here . can't find the TIMEOUT settings though , not sure why . Plugin is pretty reliable with me
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 14, 2013, 12:09:45 pm
@ChrisTheC - ya the iPad has substantially more battery life so the drain is not as hard. Additionally, it doesn't have a true GPS sensor in most cases, it uses cell/wifi triangulation patterns which don't chew as much battery either. Definitely test with the iPhone and you will likely see a bigger battery drain. I have an iPad mini that I can go for days without charging and using pretty heavily (I use it for demos for work everyday). I can still end up with ~20% juice even after a few days of that kidn of usage.

@rmohsen/ramiii - I've found that while the ping might be reliable, that this might impact the phone battery if not plugged in as well. Not drastically, but my goal is to eliminate any sensing being needed as much as possible. I'd also like to have an ability to use the location to arm my house when I leave, so having the geo-location tell when I've left, vs having the Wifi wait 15 minutes before saying I'm gone. We like to arm soon after leaving since it might stir the dog in his crate.

@mike123 - try pulling the power on your vera and letting it sit for a minute before pluggin back in. As described in one of my posts, mine was still having weird issues like you describe until my vera died. When it came back up from being completely dead, it worked perfectly. I'm wondering if there is something that is just not getting updated when doing the general Lua/Luup restarts.

@amg0 - still going strong with updates happening properly. I'll download the next release you make after 1.48 (1.50) when it's ready rather than stirring the pot. In reading another post by inveltr (homewave iOS app dev), does this plugin leverage the "poll node" command? Or if I was to hit the refresh button, could it be used? I'm asking as it would be great to be able to leverage this inside the Homewave app to force a refresh. I shouldn't have a need to set myself home/away, but I may need to force a refresh. Using the built in tap and hold function in homewave, apparently will send a poll node command. This is obviously intended for actual ZWave devices I'd imagine, but just curious if there is extensibility here. Keep up the good work!! (http://forum.micasaverde.com/index.php?topic=17033)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 14, 2013, 01:01:57 pm
It looks as if the upgrade to 1.48 has resolved the issues with the polling. So far working fine, with addformat set to 0 (privacy mode)

@amg0 - Think I found a bug in L_IPhone.lua, line 653 where you compare period to 0. If the device is muted, the period variable is never instantiated and the comparison fails (hard). I fixed the crash by setting period = 0 within the "if (Muted == "1") then ... end" block.

Also PM'ed you a patch to support drop-downs for the device names (so people won't need to type in the device name which is error prone, IMHO).

That is a good one I ll fix right away. It definitly impacts people using Mute command. so it will be in 1.49 beta1.

For HTML select, thx for the idea. I ll wait post 1.50 to dig into this but the user interface will likely be complicated to implement as it would need multiselect capabilities and the IPhoneFormat techincally also support pattern matching so that you could say iPhone.* to select all phones staring by iPhone. note quite sure, from a user interface standpoint how to marry both modes/needs.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 14, 2013, 01:07:37 pm
@amg0 - still going strong with updates happening properly. I'll download the next release you make after 1.48 (1.50) when it's ready rather than stirring the pot. In reading another post by inveltr (homewave iOS app dev), does this plugin leverage the "poll node" command? Or if I was to hit the refresh button, could it be used? I'm asking as it would be great to be able to leverage this inside the Homewave app to force a refresh. I shouldn't have a need to set myself home/away, but I may need to force a refresh. Using the built in tap and hold function in homewave, apparently will send a poll node command. This is obviously intended for actual ZWave devices I'd imagine, but just curious if there is extensibility here. Keep up the good work!! (http://forum.micasaverde.com/index.php?topic=17033)

I am not familiar with this poll node command but will try to read about it. Regarding forcing a refresh, you have a button for that in UI5 so you can do this using in a scene and you also have a uPNP Action that could be used by any external applications or device. maybe that could work for you ?

Service.xml file
Code: [Select]
        <action>
            <name>ForceRefresh</name>
<argumentList>
<argument>
<name>PresentStatus</name>
<direction>out</direction>
<relatedStateVariable>Present</relatedStateVariable>
</argument>
</argumentList>
        </action>

for instance calling the url http://veraip:3480/data_request?id=lu_invoke&DeviceNum=yourphonepluginin (http://veraip:3480/data_request?id=lu_invoke&DeviceNum=yourphonepluginin) forces a refresh and returns
Code: [Select]
<u:ForceRefreshResponse xmlns:u="urn:schemas-upnp-org:service:IPhoneLocator:1">
<PresentStatus>1</PresentStatus>
</u:ForceRefreshResponse>
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 14, 2013, 01:30:11 pm
It looks as if the upgrade to 1.48 has resolved the issues with the polling. So far working fine, with addformat set to 0 (privacy mode)

just a hint with v1.48 you should be able to put "~{country}" in AddrFormat to just see the country. more examples on the first post of this thread: http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221
Title: Re: Plugin - IPhone Locator
Post by: petequintanilla on October 14, 2013, 02:25:00 pm
Great Plugin!

I have a question what does "Invalid google return format" states for? I have changed the address format like ~{street_number} {route},{postal_code} {locality}, {country} with no luck.

Im using v 1.48

Thanks
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 14, 2013, 03:00:56 pm
Great Plugin!

I have a question what does "Invalid google return format" states for? I have changed the address format like ~{street_number} {route},{postal_code} {locality}, {country} with no luck.

Im using v 1.48

Thanks
it means the decode of hte json object returned by google did not work well, with 1.48 it does not crash the plugin but there are no address to show. So I am curious and if you can it would be great to enable debug mode in the .lua file and send me the luaPnP.log file that you can find in /var/log/cmh folder of your vera
Code: [Select]
local DEBUG_MODE = true
Title: Re: Plugin - IPhone Locator
Post by: petequintanilla on October 14, 2013, 11:35:54 pm
Quote
So I am curious and if you can it would be great to enable debug mode in the .lua file and send me the luaPnP.log file that you can find in /var/log/cmh folder of your vera
I was just about to get the log file and suddenly it started to work like a charm. Hope it stays working, and once again thanks for the plugin.
Title: Re: Plugin - IPhone Locator
Post by: davidd1205 on October 15, 2013, 11:04:41 am
Hello Good Jobfor my iphone

Have you a same soluce dor an android phone ?

thanks for your job
Title: Re: Plugin - IPhone Locator
Post by: petequintanilla on October 15, 2013, 11:08:22 am
Quote
I was just about to get the log file and suddenly it started to work like a charm. Hope it stays working, and once again thanks for the plugin.

 I think i spoke to soon, this morning the format error appeared again. Im at the office, but as soon as i get home i will forward the log file.

Thanks
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 16, 2013, 03:24:42 am
I still have some polling issues. I am on 1.48, and i mute my wifes and my iphone while we are at home. When a door is opened, the phones are unmuted and i have a scene refreshing both phones every 2 mins for 10 mins to determine if any of us is leaving. It looks as if at least on my iphone it refreshes once or twice after i have left the house, but still stays on 'present' and does not refresh the location after that. (I can see that as i am arriving at work and my status is present, and timestamp is 2 mins after i left and it should be 10mins). This only changes when my Vera reboots while i am doing changes from work, then the status updates. Or if i press refresh manually while i am at work. Once it starts refreshing i am back to the normal cycle of automatic refreshes, so it just seems to be 'hanging' after unmuting
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 05:58:31 am
You got me thinking and I've got a fix @mikee123... Will post a patch here in a little bit (am trying to decide which of the two obvious ways to fix this behavior I'll opt for).
Title: Re: Plugin - IPhone Locator
Post by: bucko on October 16, 2013, 06:01:21 am
I'm also noticing that after unmuting, it is not updating. Clicking refresh to start the ball rolling.

LOG...

08   10/16/13 17:50:19.281   JobHandler_LuaUPnP::HandleActionRequest device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 action: SetMute <0x31a0d680>
08   10/16/13 17:50:19.282   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:IPhoneLocator1 <0x31a0d680>
06   10/16/13 17:50:19.283   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Muted was: 1 now: 0 #hooks: 0 upnp: 0 v:0xf1f278/NONE duplicate:0 <0x31a0d680>
06   10/16/13 17:50:19.284   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: IconCode was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x31a0d680>
08   10/16/13 17:50:39.656   JobHandler_LuaUPnP::HandleActionRequest device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 action: ForceRefresh <0x31f09680>
08   10/16/13 17:50:39.657   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:IPhoneLocator1 <0x31f09680>
06   10/16/13 17:50:45.023   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevLat was: 24.827381 now: 24.827381 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 __LEAK__ this:45056 start:4280320 to 0x1bb6000 <0x31f09680>
06   10/16/13 17:50:45.023   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevLong was: 102.825819 now: 102.825819 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x31f09680>
06   10/16/13 17:50:45.024   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: CurLat was: 24.827381 now: 24.827198463994 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31f09680>
06   10/16/13 17:50:45.024   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: CurLong was: 102.825819 now: 102.82610575502 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31f09680>
06   10/16/13 17:50:45.025   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevDistance was: 0.003 now: 0.003 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x31f09680>
06   10/16/13 17:50:45.026   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Distance was: 0.003 now: 0.035 #hooks: 1 upnp: 0 v:0xedded8/NONE duplicate:0 <0x31f09680>
06   10/16/13 17:50:45.028   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Present was: 1 now: 1 #hooks: 2 upnp: 0 v:0xf1f238/NONE duplicate:1 <0x31f09680>
06   10/16/13 17:50:45.028   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Location was: Yuhua Road, Chenggong, Kunming, Yunnan, China now: Yuhua Road, Chenggong, Kunming, Yunnan, China #hooks: 0 upnp: 0 v:0xf1f258/NONE duplicate:1 <0x31f09680>
06   10/16/13 17:50:45.029   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: MsgText was: 0.00 Km @ Wed Oct 16 08:17:48 2013 now: 0.04 Km @ Wed Oct 16 17:50:45 2013 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x31f09680>
06   10/16/13 17:50:45.029   Device_Variable::m_szValue_set device: 257 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: IconCode was: 0 now: 100 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 06:01:53 am
I _think_ the following will fix the at least some of the polling problems (after mute) problem, but a) i haven't tested it - not in a  place to and b) it's early in the morning where I live :)

Code: [Select]
===================================================================
--- L_IPhone.lua (revision 67)
+++ L_IPhone.lua (revision )
@@ -404,7 +404,18 @@
  debug(string.format("calling uPNP setMute(%s,%s)",lul_device,newMuteStatus))
  lul_device = tonumber(lul_device)
 
+    local Muted = luup.variable_get(service,"Muted", lul_device) or 0
+    if (tonumber(newMuteStatus) ~= tonumber(Muted))  then
+        -- Change the muted status
+        Muted = newMuteStatus
+        if (Muted == 0) then
+            -- Disable muted state
+            log("Refreshing the device after being unmuted")
+            loop(lul_device)
+        end
+    end
+
- --  update root & update each children
+    --  update root & update each children
  root_device = getRoot(lul_device)
  updateMuteIcon(root_device, newMuteStatus)
  forEachChildren(root_device, updateMuteIcon, newMuteStatus )
@@ -611,6 +622,7 @@
 function loop(lul_device)
  log("Entering loop")
  lul_device = tonumber(lul_device)
+    period = 0
  if (getParent(lul_device)>0) then
  log("Critical error: a child object should not enter the Timer Loop()")
  return
Title: Re: Plugin - IPhone Locator
Post by: davidd1205 on October 16, 2013, 08:51:24 am
Hello  sjolshagen

I saw your project for android you can tell me more to use in android

thank you
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 09:35:43 am
Hello  sjolshagen

I saw your project for android you can tell me more to use in android

thank you

@davidd1205,

Although there still _is_ a way for Android devices to report services and access that data, I don't believe a 3rd party device can access the data without paying Google for access to the business API.

Another option is the findmee service (IIRC) which would support a number of different device types (windows, android & iphone), but I don't have an Android device or Windows device, so my motivation for adding Android support to my plugin is fairly limited. I did, however, ensure the plugin sources I posted to GitHub would let me, or anybody else, add any device they'd prefer to use.

I'm toying with the idea of porting the current iPhone Locator code to the same framework, but time is a bit restricted ATM.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 16, 2013, 09:49:22 am
I have some weird behaviour from my iphonelocator.

I have this as polling setting: 0:900,0.7:60,2:120,5:450,15:900,100:2800 and the phone is at home. I use PLEG to mute the phone while at home, and unmute when the porch door is opened, i unmute the phone 2:45 after, then at 3:00 i refresh, unmute again 5:45 after, refresh at 6:00 and finally unmute 9:45 and refresh 10 mins after door has been opened. It all seems to work ok, but about 15 mins after the door has been opened, the iphonelocator goes crazy and refreshes every few seconds ! I am not sure if its my logic or a bug in iphonelocator.

Here are my PLEG settings:

Jhome  (Jdirection == 100) and PingJust
Jmute  Jhome; NOW > 180
Porchopen  Porchdooropen @ 2 > 6:00
Junmute  Porchopen and Jhome

Actions on Junmute as above.
PingJust indicates phone is at home, and phone is at home
Porchdooropen is the door sensor

Sorry i would post a status report but i cannot get to that at the moment (problem with silly old browser at work)

I have now managed to get a status report, but this was taken after i stopped the permanent refreshes with manually muting the phone

Lighting PLEG
Device ID: 2212013-10-16 15:09:02 PLC Version: 5.2
________________________________________
Triggers
Name   Description   Last Trigger   State   
         
Mikehome   (*)Mike is present   2013-10-15 18:32:20    false
PingMike   Ping Mike is Tripped   2013-10-16 06:01:44    false
Porchdooropen   Porch door is tripped   2013-10-16 14:09:07    false
PingJust   Ping Justine is Tripped   2013-10-16 14:39:46    false
________________________________________
Device Properties
Name   Device Name   Device Variable   Last Change   Value
Mdistance1   (*)Mike   Distance   2013-10-16 14:59:53    35.894
Jdistance   (*)Justine?s iPhone   Distance   2013-10-16 14:32:53    0.037
            
Mdirection   (*)Mike   IconCode   2013-10-16 07:53:16    0
Jdirection   (*)Justine?s iPhone   IconCode   2013-10-16 14:43:41    50
________________________________________
Conditions
Name   Expression   Last True   State         
         
Mikeaway   Mdistance1 > 1   2013-10-16 07:47:23    true
Mhome   Mikehome and PingMike   2013-10-16 06:01:45    false
Mcomhome   (Mdirection == 75) and Mdistance1 < 1   2013-10-14 18:16:11    false
Jhome   (Jdirection == 100) and PingJust   2013-10-16 14:39:53    false
Jmute   Jhome; NOW > 180   2013-10-16 14:43:41    true
Jgoingaway   (Jdirection == 25)   0   false
Porchopen   Porchdooropen @ 2 > 6:00   2013-10-16 14:09:08    false
Mmute   Mhome; NOW > 180   2013-10-16 06:04:46    true
Mcomdark   Mcomhome and Dark   0   false
Junmute   Porchopen and Jhome   2013-10-16 14:28:13    false
Munmute   Porchopen and Mhome   2013-10-16 13:30:31    false
AutoAway   (NOT Mhome) and (NOT Jhome)   2013-10-16 14:41:26    true
________________________________________
Actions
Actions for Condition: Mikeaway
Immediate
Device   Action   Arguments
Test Multi Switch   SetStatus7   newStatus7=1
Test Multi Switch   SetStatus8   newStatus8=0
Actions for Condition: Mcomhome
Immediate
Device   Action   Arguments
Test Multi Switch   SetStatus3   newStatus3=1
Actions for Condition: Jmute
Immediate
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=1
Actions for Condition: Mmute
Immediate
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=1
Actions for Condition: Mhome
Immediate
Device   Action   Arguments
Lighting PLEG   RunScene   SceneNameOrNumber=94
Delay 05:00
Device   Action   Arguments
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=0
Actions for Condition: Mcomdark
Immediate
Device   Action   Arguments
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=100
Actions for Condition: Junmute
Delay 02:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 03:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 05:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 06:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 09:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 10:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Actions for Condition: Munmute
Delay 02:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 03:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 05:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 06:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 09:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 10:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0

Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 12:07:32 pm
I think the attached file should resolve the mute/poll problem(s) people have reported. Please test & post your results to the forum.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 12:10:39 pm
I'm having problems with the distance triggers or PLEG using the distance triggers, but I'm not sure which plugin is having the problem...

Anybody else have issues w/the distance triggers in iPhone Locator?
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 16, 2013, 02:14:28 pm
I have found the problem with the crazy polling after the trigger. I was using Iconcode to determine if i am home (Iconcode 100) but when home and muted this returns 50... I have to use the 'present' trigger instead.

@sjolshagen

I have installed your patch, i will report back tomorrow morning
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 16, 2013, 02:21:04 pm
I still have some polling issues. I am on 1.48, and i mute my wifes and my iphone while we are at home. When a door is opened, the phones are unmuted and i have a scene refreshing both phones every 2 mins for 10 mins to determine if any of us is leaving. It looks as if at least on my iphone it refreshes once or twice after i have left the house, but still stays on 'present' and does not refresh the location after that. (I can see that as i am arriving at work and my status is present, and timestamp is 2 mins after i left and it should be 10mins). This only changes when my Vera reboots while i am doing changes from work, then the status updates. Or if i press refresh manually while i am at work. Once it starts refreshing i am back to the normal cycle of automatic refreshes, so it just seems to be 'hanging' after unmuting
I reproduced the issue and fixed it in v1.49 beta2 on the App Store I believe.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 02:28:38 pm
I reproduced the issue and fixed it in v1.49 beta2 on the App Store I believe.

I had 1.49 beta2 installed and had the problem still.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 16, 2013, 05:48:34 pm
I reproduced the issue and fixed it in v1.49 beta2 on the App Store I believe.

I had 1.49 beta2 installed and had the problem still.
Very strange , please send me a set of logs in debug mode. If possible starting from a plug initialisation time. I am pretty sure 1.49beta 2 cleans this polling halt issue so I suspect something else and logs will help.

The unmute action not immediately retrigering a refresh but instead waiting the next period is by design as I am not yet totally sure if it is safe to program a second time a timer function when one has already been programmed. So far. We need to be sure or to find a way to cancel the previous timer before we create a new one I think. I had preferred to play it safe and when unmute, not immediately refresh for the moment.

I want to publish v1.50 this week end to public store so we can hopefully fix it before
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 16, 2013, 06:07:18 pm
The unmute action not immediately retrigering a refresh but instead waiting the next period is by design as I am not yet totally sure if it is safe to program a second time a timer function when one has already been programmed. So far. We need to be sure or to find a way to cancel the previous timer before we create a new one I think. I had preferred to play it safe and when unmute, not immediately refresh for the moment.

AFIK, there's no way to cancel a timer. A use case to explain why I think it's useful to automatically trigger a poll/refresh once the device unmutes is the case where a person has a poll map with a high poll value (because the device was far away when muting) at the time the device was muted. By waiting for the next scheduled poll you run the risk of having to wait a long time before the data updates. Which would confuse and make it appear as if the device isn't polling.

Granted, it may be better to call the forceRefresh() function instead or reset the poll value to the default time whenever Mute is clicked...?
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 02:57:26 am
@sjolshagen

I installed your fix last night, and unfortunately it has not worked, my phone is still at home although i am at work, it has not refreshed
Title: Re: Plugin - IPhone Locator
Post by: Brientim on October 17, 2013, 03:54:57 am

@sjolshagen

I installed your fix last night, and unfortunately it has not worked, my phone is still at home although i am at work, it has not refreshed
If when you find this, open Find My iPhone on your phone and establish if your phone is updating. When it is displaying the correct location, does the refresh in the app display the correct details?

In the post below it provide another way to verify if tracking is working, so it may be worth going back to basics to verify all the foundation is working first.
http://forum.micasaverde.com/index.php/topic,15565.msg130749.html#msg130749
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 07:33:57 am
@sjolshagen
The 1.49beta3 has another problem which i did not have before, when my porch door is opened the phone is unmuted, and the location refreshed for 10 mins. For whatever reason that does not happen any more.

@Brientim
Quote
open Find My iPhone on your phone and establish if your phone is updating. When it is displaying the correct location, does the refresh in the app display the correct details
I will give that a try tomorrow mornign as it is now updating as i did a manual refresh
Title: Re: Plugin - IPhone Locator
Post by: petequintanilla on October 17, 2013, 09:53:14 am
I'm noticing that the "invalid google format error" only appears during the day, at night it provide exact location

Any clues?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 17, 2013, 10:19:35 am
I'm noticing that the "invalid google format error" only appears during the day, at night it provide exact location

Any clues?

The error message from Google implies that your IP has attempted too many accesses to their service.

If you combine what I'm guessing is a somewhat aggressive polling schedule along with the 3 different i* devices shown in the log, I think you're hitting a limit set by Google. This isn't something I believe the plugin can address (other than by ignoring your poll schedule settings and that makes no sense).

From a plugin perspective, it may be worth comparing locations before calling the address lookup and only do a lookup if the change is "significant". This may avoid extra lookups for a specific device. I am, however, not sure what "significant" would actually mean in this context...

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 10:32:47 am
@sjolshagen
my wifes phone has been polling ok since i refreshed manually this morning. it has been away for just under 2 miles distance, and been polling every 150 secs as in my settings: 0:900,0.6:50,2:150,5:450,15:900,100:2800
She is now 0.55 miles away, so it should be polling every 50 seconds ? But it has switched to polling every 15 minutes now
I get the distance from device properties - distance, and the distance is correct (i checked with my wife where she is)
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 17, 2013, 10:36:21 am
I'm having problems with the distance triggers or PLEG using the distance triggers, but I'm not sure which plugin is having the problem...

Anybody else have issues w/the distance triggers in iPhone Locator?

FYI: Found a problem in the service definition file which would be causing this. Will be sending a patch to @amg0 later today to address it.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 11:02:03 am
I have gone back to 1.49beta2 but that has issues too with not updating, even when it has been refreshed manually. So unfortunately it looks to me as if there still is a gremlin in the system somewhere

And just to make sure, i love the plugin and appreciate all the work going into it !
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 17, 2013, 12:19:24 pm
I have gone back to 1.49beta2 but that has issues too with not updating, even when it has been refreshed manually. So unfortunately it looks to me as if there still is a gremlin in the system somewhere

And just to make sure, i love the plugin and appreciate all the work going into it !

Could you grab the log from /var/log/cmh and send it to me? (PM for email address)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 01:10:16 pm
Here is the log file for the "invalid google return issue"

I do see several problems.

first, Google is rejecting you because you make too many request to it in a too short period of time. I see plug in starts at 20:25:32 and you have 3 instances of the plugin running in paralel. devices 87, 91, 94

That status code from google indicate you are over their service level agreement in terms of number and frequency of request.
Code: [Select]
50   10/16/13 20:25:33.514   luup_log:87: IPhoneLocator: [string "..."]:367: Unexpected character at Line 3 character 18: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
Context:
r this API.",
   "results" : [],
   "status" : "OVER_QUERY_LI
                              ^ <0x2ec57680>

question: do you really have 3 different iCloud accounts that requires you to have 3 different instances of the plug in ?

I am thinking this could be a problem for people having lots of devices and I am going to see how to try to distribute the calls to google maybe introducing some kind of randomize time in the period for refresh so all the instances of plugins are not refreshing at the same time

second you use a lot of 'quotes in device names, I am not fully sure that works well despite the patch I included from this forum , we see these lines but you did not enable DEBUG mode so we do not have much more information and it is not clear if it finally finds the device you are looking for.
Code: [Select]
Line 21: 50   10/16/13 20:25:33.485   luup_log:91: IPhoneLocator: iCloud device ignored, name:Pedro\'s iPhone pattern:Pedro\'s iphone 5 u.s.a. <0x2ee57680>
Line 22: 50   10/16/13 20:25:33.486   luup_log:91: IPhoneLocator: iCloud device ignored, name:Ofelia\'s iPhone pattern:Pedro\'s iphone 5 u.s.a. <0x2ee57680>
Line 23: 50   10/16/13 20:25:33.486   luup_log:91: IPhoneLocator: iCloud device ignored, name:Pedro Quintanilla?s iPad pattern:Pedro\'s iphone 5 u.s.a. <0x2ee57680>
Line 24: 50   10/16/13 20:25:33.487   luup_log:91: IPhoneLocator: iCloud device ignored, name:iPhone pattern:Pedro\'s iphone 5 u.s.a. <0x2ee57680>

Third, on device 87 which is an iPad there is no device in this iCloud account that is matching the iPhoneName parameter. here again in DEBUG mode we would see more
Code: [Select]
Line 20: 50   10/16/13 20:25:33.254   luup_log:87: IPhoneLocator: Bad or No device found:{"maxMsgChar":160,"isMac":false,"lostTimestamp":"","batteryStatus":"Unknown","activationLocked":true,"name":"Clau?s iPad","deviceClass":"iPad","locationCapable":true,"lostModeEnabled":false,"batteryLevel":0,"canWipeAfterLock":true,"deviceDisplayName":"iPad 2","isLocating":true,"thisDevice":false,"wipeInProgress":false,"deviceModel":"SecondGen-white","deviceColor":"white","locFoundEnabled":false,"deviceStatus":"203","id":"aasE3CrcDRCGbR53D0vNbrsyoQ7JZncd4i+g3uv7sGALZIf/+K6EreHYVNSUzmWV","passcodeLength":4,"darkWake":false,"rawDeviceModel":"iPad2,1","features":{"KEY":false,"CWP":false,"LKM":false,"PIN":false,"XRM":false,"CLT":false,"TEU":true,"LMG":false,"LKL":true,"KPD":false,"LLC":false,"WIP":true,"SVP":false,"LCK":true,"WMG":true,"REM":false,"MSG":true,"CLK":false,"LST":true,"LOC":true,"SND":true},"modelDisplayName":"iPad","lostModeCapable":true,"locationEnabled":true} <0x2ec57680>

Hope this helps, to proceed further please enable a debug mode ( in .lua file ) , reload device and please send a complete trace. doing a VERA reboot just before would be good as it reduces the log file size to 0 before starting and it launches all plugins properly.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 01:14:53 pm
@sjolshagen
my wifes phone has been polling ok since i refreshed manually this morning. it has been away for just under 2 miles distance, and been polling every 150 secs as in my settings: 0:900,0.6:50,2:150,5:450,15:900,100:2800
She is now 0.55 miles away, so it should be polling every 50 seconds ? But it has switched to polling every 15 minutes now
I get the distance from device properties - distance, and the distance is correct (i checked with my wife where she is)

Assuming your unit is miles and not kilometers ( otherwise the same logic applies but in kilometers ), since 0.55 is < than 0.6, so polling is 900 seconds.
above 0.6 but under 2 miles polling would be 50 seconds
above 2 miles but under 5 polling is 150 seconds
etc...

0:900,0.6:50,2:150,5:450,15:900,100:2800
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 02:11:12 pm
I thought that might be the case, after looking at it and thinking about it. I have changed it to 0:900,0.3:50,2:150,5:450,15:900,100:2800. That should work better. The accuracy of the iphone gps could be better... it shows distance 0.175 when i am at home, but there is nothing we can do about that. STill, we can get round that.
Will try to email you the log now. I did no enable debugging though.

@amg0  email with log sent
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 03:42:13 pm
I thought that might be the case, after looking at it and thinking about it. I have changed it to 0:900,0.3:50,2:150,5:450,15:900,100:2800. That should work better. The accuracy of the iphone gps could be better... it shows distance 0.175 when i am at home, but there is nothing we can do about that. STill, we can get round that.
Will try to email you the log now. I did no enable debugging though.

@amg0  email with log sent

thank you. I replied but found no issue. I recommend you go back to basics for now. 
a) force a install from the store so we are sure what version you are using , ( no other patch for now ) otherwise it is hard for me to debug
b) do not use pleg, just set your plugin
c) put a standard refresh rate of 60s and see if it works.

if it works, you probably need to trouble shoot your pleg logic

if it does not work or stop polling after a while , please follow these steps
a) enable debug mode in L_IPhone.lua
Code: [Select]
local DEBUG_MODE = trueb) load new L_IPhone.lua file
c) reboot vera
d) run for a little while
e) login to vera using winscp , copy back luaPNP.log file from /var/log/cmh
f) send me the log file
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 03:51:39 pm
I'm noticing that the "invalid google format error" only appears during the day, at night it provide exact location

Any clues?

no.  unless you reduce polling at night with a scene/pleg... anyhow here is a private version of L_IPhone.lua (which randomizes some delay so that we avoid all plugins to call google at the same time) for you to use and send me the log in DEBUG mode if you have the issue.

Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 03:55:47 pm
I'm having problems with the distance triggers or PLEG using the distance triggers, but I'm not sure which plugin is having the problem...

Anybody else have issues w/the distance triggers in iPhone Locator?

FYI: Found a problem in the service definition file which would be causing this. Will be sending a patch to @amg0 later today to address it.

yes please, interested about this, there is little doc about this file
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 04:22:04 pm

thank you. I replied but found no issue. I recommend you go back to basics for now. 
a) force a install from the store so we are sure what version you are using , ( no other patch for now ) otherwise it is hard for me to debug
b) do not use pleg, just set your plugin
c) put a standard refresh rate of 60s and see if it works.


I have done a update from the store lunchtime today to 1.49beta2. Shall i uninstall the plugin completely and reinstall ?
I can try and disable PLEG to not refresh or do anything
Standard refresh rate i can do, but shall i mute manually or do you just want me to test unmuted ? (pretty sure that works)

My phones are muted now, i will trigger a refresh with opening the door now and see what happens. If there are no updates i'll grab another log and send it to you, it might have some clues
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 04:44:03 pm

thank you. I replied but found no issue. I recommend you go back to basics for now. 
a) force a install from the store so we are sure what version you are using , ( no other patch for now ) otherwise it is hard for me to debug
b) do not use pleg, just set your plugin
c) put a standard refresh rate of 60s and see if it works.


I have done a update from the store lunchtime today to 1.49beta2. Shall i uninstall the plugin completely and reinstall ?
I can try and disable PLEG to not refresh or do anything
Standard refresh rate i can do, but shall i mute manually or do you just want me to test unmuted ? (pretty sure that works)

My phones are muted now, i will trigger a refresh with opening the door now and see what happens. If there are no updates i'll grab another log and send it to you, it might have some clues

@Mikee123, no need to uninstall the plugin. if you are already in the latest store version you should be good. but you need to enable DEBUG mode in the lua file and reupload just that file.  You can take the .lua file  I sent to petequintanilla earlier which already has debug mode enabled.
feel free to play with mute / unmute if it helps to reproduce the issue but maybe avoid pleg or complex scripting for now so we can proceed gradually by stages
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 05:05:05 pm
How far back in time does the log go ? I mean how many hours back can you see if i enable the debug mode ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 17, 2013, 05:49:01 pm
How far back in time does the log go ? I mean how many hours back can you see if i enable the debug mode ?
not sure, depends on your set up, not that much. you can search for the last occurences of string initstatus and send me the lines after
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 17, 2013, 05:54:18 pm
I found a little problem in my logic unmuting the phone. This might actaully explain the problem. Maybe you have an idea.

My phone is being muted when at home. I want it unmuted when Porchdooropen is true. But only when i am at home. When i am away it does not need to be unmuted. (unmute also runs refreshes for 10 mins to see if i am going away which is unnecessary while i'm away)

(Mhome;Porchopen) or NOT Mikehome

not sure that will do it. Mikehome is iphonelocator present. Mhome is iphonelocator present and ping true
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 17, 2013, 11:00:25 pm
@amg,

Per your PM, I've had a busy day... This turned into a pretty big patch of "new" stuff (the multi-select list) as well as other bug fixes and updates related to posts [1] made about other plugins in the past (for UPnP compliance, etc).

The patch includes:
-------------------------

The plugin shouldn't really store the password in plaintext anywhere, considering the fact that there are credit cards and real money tied to the iCloud accounts of quite a few people. A thought would be to "intercept" the password, Mime64 encode it (and the username) and then save that as the password variable? Granted, that's not great either but it's probably better than plain-text & readable.

Also, it looks like the refresh in the handleApiReady() function generates a javascript error:
Code: [Select]
Uncaught TypeError: Cannot read property 'deviceID' of undefined J_IPhone.js:164
(anonymous function) J_IPhone.js:164

I tried testing for unit.deviceID value being null (not set) before assigning it to the deviceID variable, but that didn't appear to change anything :(

[1] = http://forum.micasaverde.com/index.php?topic=14134.0 (http://forum.micasaverde.com/index.php?topic=14134.0)
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 17, 2013, 11:08:58 pm
no.  unless you reduce polling at night with a scene/pleg... anyhow here is a private version of L_IPhone.lua (which randomizes some delay so that we avoid all plugins to call google at the same time) for you to use and send me the log in DEBUG mode if you have the issue.

Wouldn't starting only startupDeferred() with a delay ensure the devices stay more consistent rather than the delay changing all the time?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 18, 2013, 02:01:31 am
no.  unless you reduce polling at night with a scene/pleg... anyhow here is a private version of L_IPhone.lua (which randomizes some delay so that we avoid all plugins to call google at the same time) for you to use and send me the log in DEBUG mode if you have the issue.

Wouldn't starting only startupDeferred() with a delay ensure the devices stay more consistent rather than the delay changing all the time?
no because of child devices all going at the same time to google for reverse geolocalisation
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 18, 2013, 02:45:25 am
Looks as if i had a problem with my programming, it did not always unmute my phone when the door was opened. I have corrected that now and everything seems to work fine. So embarrassing...

@sjolshagen

your patch is a .txt file. Do i save it as D_IPhone.json and then upload ?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 18, 2013, 05:19:07 am
@sjolshagen

your patch is a .txt file. Do i save it as D_IPhone.json and then upload ?

It's actually a .patch file, but I had to rename it since this forum restricts the types of files it lets you attach.

The .patch file would be applied using a patch tool the underlying source files. In this case, different parts of the .patch file would get applied to S_IPhone.xml, D_IPhone.json, L_Iphone.lua and J_IPhone.js.

Basically, this file wasn't meant to be installed on the Vera device.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 18, 2013, 05:36:16 am
Ok thanks, i will have to wait until it gets released as i have no idea of how to patch. Sounds good though what you've done
Title: Re: Plugin - IPhone Locator
Post by: matchews on October 19, 2013, 06:50:42 pm
First let me say the plug in is an excellent idea with great implementation.  Please excuse my questions if they seem trivial as I am still in my first week with the Vera.  The plugin installed and connected to the iCloud with ease.  The map feature looks and works great.  I using the present and away actions to trigger some lighting scenes.  The problem is, even when I'm home, the plugin momentarily switches to away and back to present.  I've seen the device display something like "no location data available".  Is there a setting that can be adjusted, or should I be trying to buffer this with some timers.  Thanks in advance for your help!

Matt
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 20, 2013, 11:13:47 am
 I just released v1.50 release candidate on the apps.mios.com store.  It is not yet a public version but you can install it from the usual link http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions) , It includes couple of bug fixes and some of the suggestions from sjolshag

if no major issue is found, I will then make this the new public version on the App Store.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 20, 2013, 11:25:55 am
@amg,

Per your PM, I've had a busy day... This turned into a pretty big patch of "new" stuff (the multi-select list) as well as other bug fixes and updates related to posts [1] made about other plugins in the past (for UPnP compliance, etc).

The patch includes:
-------------------------
  • Fixes to variable names in S_IPhone.xml
  • Support for a multi-select box of names which generates a list of device names parsable by the existing lua module.
    • Will also update UI to reflect new pattern/list of devices. It would still be possible to add a wildcard pattern.
  • The proposed one-time forceRefresh() once the device is unmuted
  • Support for dynamically enabling/disabling debug logging (checkbox in the UI)
  • Changed settings get auto-saved w/o forcing Luup/Lua restart
  • Fixes to D_IPhone.json
    • Removed the comments as the file does not jsonlint with them present.
    • Bug: Distance variable doesn't trigger events for "Distance goes above/below"
  • Turned the password box into a password field (hide the password).

The plugin shouldn't really store the password in plaintext anywhere, considering the fact that there are credit cards and real money tied to the iCloud accounts of quite a few people. A thought would be to "intercept" the password, Mime64 encode it (and the username) and then save that as the password variable? Granted, that's not great either but it's probably better than plain-text & readable.

Also, it looks like the refresh in the handleApiReady() function generates a javascript error:
Code: [Select]
Uncaught TypeError: Cannot read property 'deviceID' of undefined J_IPhone.js:164
(anonymous function) J_IPhone.js:164

I tried testing for unit.deviceID value being null (not set) before assigning it to the deviceID variable, but that didn't appear to change anything :(

[1] = http://forum.micasaverde.com/index.php?topic=14134.0 (http://forum.micasaverde.com/index.php?topic=14134.0)

@sjolshagen , thank you for your inputs. I did include some of these improvements & fixes into 1.50 rc.
Once v1.50 is officially released public, we may need to continue on some of your tracks here. some I could not integrate or did it slightly differently ( like the debug ).

in particular to see the .js changes  I think it would be good you send me a complete set of files ( complete plugin ) so I install and see it in action, I am not using any patch tools ( do not really trust tools to modify my source code ) and changes were not easy to read especially in that .js file because of all the dynamic HTML build up code. I also wonder if jqueryui works so we could use some nicier widgets. about the autosave, do you know if this buildVeraUrl() would work if the user is accessing his VERA from remote locations via the fwdx micasaverde servers ?. we may need a more sophisticated buildVeraUrl() code

The pwd security question is interesting but it would take us much further than a simple mime64 encoding which is really not an encryption. Probably far too easy for even a non programmer user to just copy paste and even decode in any online mime64 decoder out there. I would be curious as to what Micasaverde can  say about encrypting and obfuscating secure data like that

thanks again for the help
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 20, 2013, 11:27:45 am
In the advanced tab the password is still readable
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 20, 2013, 11:30:35 am
In the advanced tab the password is still readable

did you do a full browser refresh ? that seems to be you use the old javascript still in the cache of your browser
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 20, 2013, 01:15:41 pm
Restarted, CTRL f5 but I see see it in google Chrome
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 20, 2013, 01:21:38 pm
Restarted, CTRL f5 but I see see it in google Chrome

try to download J_IPhone.js from your Vera and see what version this is.  ( screen Apps/Developps Apps/Luupfiles, click on download link for J_IPhone.js ).  if you open that file you should find the following string in it
Code: [Select]
<td>Password:</td><td><input type="password" id="iphone_Password" size=23 value=
do you confirm you see v1.50rc in the plugin dashboard bottom right corner ?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 20, 2013, 01:24:56 pm

@sjolshagen , thank you for your inputs. I did include some of these improvements & fixes into 1.50 rc.
Once v1.50 is officially released public, we may need to continue on some of your tracks here. some I could not integrate or did it slightly differently ( like the debug ).


I just synced the Trunk for the plugin and I'm not seeing Debug implemented. I see you're setting the variable debug w/get_device_state(), but not seeing it used anywhere?

in particular to see the .js changes  I think it would be good you send me a complete set of files ( complete plugin ) so I install and see it in action, I am not using any patch tools ( do not really trust tools to modify my source code ) and changes were not easy to read especially in that .js file because of all the dynamic HTML build up code. I also wonder if jqueryui works so we could

Ok, sure. But if I post it here there'll be people downloading what is essentially poorly tested proof of concept code and installing it. Which in turn may result in support questions... I'll push my current version of the plugin to my own Github repository and PM you when it's up there.

use some nicier widgets. about the autosave, do you know if this buildVeraUrl() would work if the user is accessing his VERA from remote locations via the fwdx micasaverde servers ?. we may need a more sophisticated buildVeraUrl() code

I would recommend against changing the elements too much. Having a plugin w/a very different UI experience is likely to cause all sorts of usability confusion. But that's just my opinion...

As for the buildVeraUrl() and SaveToVera() functions, they're lifted directly from the VariableContainer plugin which - for me - works great remotely (it ought to since the functionality uses calling data_request_url variable that the UI sets). I have not experienced (in my own implementation of the iPhoneLocator plugin which contains the save code), nor would I expect any problems with remote vs. local Vera access for these function. It should (and does, in my experience) get tunneled as well.

The pwd security question is interesting but it would take us much further than a simple mime64 encoding which is really not an encryption. Probably far too easy for even a non programmer user to just copy paste and even decode in any online mime64 decoder out there. I would be curious as to what Micasaverde can  say about encrypting and obfuscating secure data like that

Fair enough. What I had in mind was that as is - and because Vera's protection when on a local network in terms of accessing the UI is near non-existent - a child (teenager) would be able to read their parents iCloud password and could then use it to start ordering stuff, etc. At least, by mime64 encoding the data in the variable, it would require enough understanding to see that a) it's a Mime64 encoded datastream and b) they would have to know the decoding tools exist. a) & b) are both beyond most casual computer users, in my experience.

Is mime64 secure..? Nope, not at all. But I think a fair argument can be made that it beats plain-text & readable.

IMHO, the easiest way to go about it would be to have a variable_watch() on Password. But that's just my $0.02 worth :)

Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 20, 2013, 01:47:27 pm
I just synced the Trunk for the plugin and I'm not seeing Debug implemented. I see you're setting the variable debug w/get_device_state(), but not seeing it used anywhere?
see getDebugMode() / setDebugMode() & the uPNP action.  button for this is in the CONTROL tab. I prefered this over the variable watch mode, matter of taste

regarding pwd encryption: maybe there is a way to hide a key in the ENC files when the encryption option is selected in the apps store. I have posted a question, we will see where this brings us

regarding JS file changes, you can PM me for sure, that will avoid confusion people using non tested/integrated version. 

The code repository mcvflorin created for my plugin is public and visible to everybody on  http://code.mios.com/svn_public/mios_iphone-detector/ (http://code.mios.com/svn_public/mios_iphone-detector/) and using any SVN client

You are free to creating your own Github repository for it but are your plans to create/fork a new version of this plugin ?. if so, please be careful that it is not adding to confusion so maybe pick a completely different name, uPNP ID etc
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 20, 2013, 01:56:09 pm
Restarted, CTRL f5 but I see see it in google Chrome

try to download J_IPhone.js from your Vera and see what version this is.  ( screen Apps/Developps Apps/Luupfiles, click on download link for J_IPhone.js ).  if you open that file you should find the following string in it
Code: [Select]
<td>Password:</td><td><input type="password" id="iphone_Password" size=23 value=
do you confirm you see v1.50rc in the plugin dashboard bottom right corner ?

Yes and it is hidden under settings
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 20, 2013, 02:45:06 pm
Yes and it is hidden under settings

The password would not be encoded/hidden in the "Advanced" tab. That's what the exchange between myself & @amg0 in a previous entry was about.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 20, 2013, 02:51:45 pm
see getDebugMode() / setDebugMode() & the uPNP action.  button for this is in the CONTROL tab. I prefered this over the variable watch mode, matter of taste

Yeah, found it in the Lua & xml files. Saw it that the .js file - iphone_Settings() - included it, but not locating where in that function it's being used. Thus my confusion.

regarding JS file changes, you can PM me for sure, that will avoid confusion people using non tested/integrated version. 

The code repository mcvflorin created for my plugin is public and visible to everybody on  http://code.mios.com/svn_public/mios_iphone-detector/ (http://code.mios.com/svn_public/mios_iphone-detector/) and using any SVN client

You are free to creating your own Github repository for it but are your plans to create/fork a new version of this plugin ?. if so, please be careful that it is not adding to confusion so maybe pick a completely different name, uPNP ID etc

I can read the SVN repository, but can't submit so updating the files was a bit of a pain.

Am _not_ wanting to fork the plugin (have no reason to, unless I wind up wanting to try implementing an option to support multiple different device types). Just wanted somewhere to let you grab the files w/o needing to attach them to this forum.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 21, 2013, 05:36:16 pm
I have updated to 1.50rc2. I have noticed sice roughly late version 1.49 (not exactly sure with which version it started) i am draining my battery a lot faster than before, but only when i am out of the house and the phone is not muted. My polling settings have not changed much, at least not in the distances i am normally at, 0 for when i am at home and work is 35 miles. These are my polling settings:
0:900,0.3:60,1.2:75,2.5:180,5:450,15:900,30:1200,50:1800,100:3000
I notice very often when i look at my iphone i have the location arrow on. I have not changed anything on the phone, or changed anything on my Vera settings so i suspect that something in iphonelocator has changed which might be causing this. I also notice that all of a sudden i have a Vera reboot every 10 minutes, as i find pictures of my cameras in my dropbox every time Vera reboots. And before these problems with battery draining i might have had a reboot once a day or every 2 days at most. I am not sure exactly with which version that started, i think one of the last 1.49
Title: Re: Plugin - IPhone Locator
Post by: brettow on October 22, 2013, 06:51:37 am
I have updated to 1.50rc2. I have noticed sice roughly late version 1.49 (not exactly sure with which version it started) i am draining my battery a lot faster than before, but only when i am out of the house and the phone is not muted. My polling settings have not changed much, at least not in the distances i am normally at, 0 for when i am at home and work is 35 miles. These are my polling settings:
0:900,0.3:60,1.2:75,2.5:180,5:450,15:900,30:1200,50:1800,100:3000


Interesting you mentioned this as I have also noticed the battery drain on mine and my wife's phones however put it down to IOS7 which was around the 21st Sept. I have made some changes on the phone to disable all the IOS7 parts that tend to drain the battery and will report back on whether its still happening.

To give you an idea I had a fully charged phone at 10pm and by 7am it was down to 75%.

Edit - Just realised that I had dynamic polling set. Will see how the changes go.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 22, 2013, 07:02:55 am
Interesting you mentioned this as I have also noticed the battery drain on mine and my wife's phones however put it down to IOS7 which was around the 21st Sept. I have made some changes on the phone to disable all the IOS7 parts that tend to drain the battery and will report back on whether its still happening.

To give you an idea I had a fully charged phone at 10pm and by 7am it was down to 75%.

While the plugin instance is muted, it does not poll the iCloud service and as a result should not be causing Apple's iCloud location services to poll your phone.

Code: [Select]
0 10/22/13 6:55:15.101 luup_log:223: IPhoneLocator: Entering loop <0x2fb0b680>
50 10/22/13 6:55:15.101 luup_log:223: IPhoneLocator: Device Muted, ignoring timer <0x2fb0b680>

The resulting code path in the plugin is:
Code: [Select]
log("Entering loop")

getParent(lul_device)

log("Device Muted, ignoring timer")

luup.call_timer("loop", 1, period+delay, "", lul_device)

As you can see, it never enters the 'forceRefresh()' function which would cause Vera to "reach out" to the iCloud location services. As a result, I don't *think* it is possible for the plugin to be causing any additional battery drain while muted.

Now, while NOT muted on the other hand, it certainly will since every time the plugin "reaches out" to the iCloud servers, the iCloud services will poll the iPhone device for its current location. Apple has warned about services that poll their devices causing battery drain in the past.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 22, 2013, 09:18:31 am
Quote
Now, while NOT muted on the other hand, it certainly will since every time the plugin "reaches out" to the iCloud servers, the iCloud services will poll the iPhone device for its current location. Apple has warned about services that poll their devices causing battery drain in the past.
Exactly. No drain while muted. But i have a drain while not muted, which was by far not as extreme with previous versions of the plugin. And with very similar if not the same polling settings
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 22, 2013, 01:50:24 pm
V1.50 final is public on the store.
Doc updated on the first post on this thread: http://forum.micasaverde.com/index.php/topic,16907.0.html (http://forum.micasaverde.com/index.php/topic,16907.0.html)
It includes some contributions from @sjolshagen, not all yet but more to come as time permits.

one key feature is the dynamic debug so you can quickly go into debug mode, let it run for a while and then get us the logs when something is wrong.

if you want to know/see how frequent the plugin polls iCloud , just get the LuaUPnP.log file from your vera and search for strings like "IPhoneLocator: getPeriodForDistance" which gives you information about distance and polling period calculated
Code: [Select]
Line 159: 50 10/22/13 16:22:09.201 luup_log:82: IPhoneLocator: getPeriodForDistance - Distance:0.015 Auto:1 Config for Device:82 ==>600 <0x2deb9680>
Line 162: 50 10/22/13 16:22:09.207 luup_log:82: IPhoneLocator: getPeriodForDistance - Distance:2.453 Auto:1 Config for Device:82 ==>60 <0x2deb9680>
Line 257: 50 10/22/13 16:23:14.916 luup_log:82: IPhoneLocator: getPeriodForDistance - Distance:0.015 Auto:1 Config for Device:82 ==>600 <0x2deb9680>
Line 260: 50 10/22/13 16:23:14.919 luup_log:82: IPhoneLocator: getPeriodForDistance - Distance:2.281 Auto:1 Config for Device:82 ==>60 <0x2deb9680>
Line 356: 50 10/22/13 16:24:18.184 luup_log:82: IPhoneLocator: getPeriodForDistance - Distance:0.015 Auto:1 Config for Device:82 ==>600 <0x2deb9680>

or "IPhoneLocator: Period chosen" which gives you polling period calculated
Code: [Select]
Line 163: 50 10/22/13 16:22:09.207 luup_log:82: IPhoneLocator: Period chosen for device:82 = 60 <0x2deb9680>
Line 261: 50 10/22/13 16:23:14.920 luup_log:82: IPhoneLocator: Period chosen for device:82 = 60 <0x2deb9680>
Line 360: 50 10/22/13 16:24:18.188 luup_log:82: IPhoneLocator: Period chosen for device:82 = 60 <0x2deb9680>
Line 389: 50 10/22/13 16:24:18.858 luup_log:81: IPhoneLocator: Period chosen for device:81 = 600 <0x2dcb9680>
Line 519: 50 10/22/13 16:25:30.305 luup_log:82: IPhoneLocator: Period chosen for device:82 = 60 <0x2deb9680>

or "forceRefresh action is called" which gives us auto & manual refresh times
Code: [Select]
Line 11880: 50 10/22/13 19:08:58.104 luup_log:82: IPhoneLocator: forceRefresh action is called on behalf of device:82 <0x2de6d680>
Line 11958: 50 10/22/13 19:09:27.101 luup_log:81: IPhoneLocator: forceRefresh action is called on behalf of device:81 <0x2dc6d680>
Line 12484: 50 10/22/13 19:19:05.101 luup_log:82: IPhoneLocator: forceRefresh action is called on behalf of device:82 <0x2de6d680>
Line 12570: 50 10/22/13 19:19:37.101 luup_log:81: IPhoneLocator: forceRefresh action is called on behalf of device:81 <0x2dc6d680>
Line 13056: 50 10/22/13 19:29:16.101 luup_log:82: IPhoneLocator: forceRefresh action is called on behalf of device:82 <0x2de6d680>
Line 13143: 50 10/22/13 19:29:44.101 luup_log:81: IPhoneLocator: forceRefresh action is called on behalf of device:81 <0x2dc6d680>
Title: Re: Plugin - IPhone Locator
Post by: AP on October 22, 2013, 04:47:13 pm
Sorry for asking but is there a "how to" that can help u get started? Because I have downloaded the app in the AppStore and put in my info and it has created a device but I can't tell if it works or not, I don't get a view in the map section just grayed out


Sent from my iPad using Tapatalk - now Free (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 22, 2013, 05:08:12 pm
Sorry for asking but is there a "how to" that can help u get started? Because I have downloaded the app in the AppStore and put in my info and it has created a device but I can't tell if it works or not, I don't get a view in the map section just grayed out


Sent from my iPad using Tapatalk - now Free (http://tapatalk.com/m?id=1)

the best we have is http://forum.micasaverde.com/index.php/topic,16907.0.html and some messages in that thread.
you have to enter your iCloud user name and password , then for the IPhoneName you can type .* to start with.
then enter a homelat / homelong values ( you can find them in your favorite GPS or iPhone itself )
then make sure your iPhone is setup to share its location information in iCloud account
hope fully it will get your started.
Title: Re: Plugin - IPhone Locator
Post by: AP on October 22, 2013, 05:17:53 pm

Sorry for asking but is there a "how to" that can help u get started? Because I have downloaded the app in the AppStore and put in my info and it has created a device but I can't tell if it works or not, I don't get a view in the map section just grayed out


Sent from my iPad using Tapatalk - now Free (http://tapatalk.com/m?id=1)

the best we have is http://forum.micasaverde.com/index.php/topic,16907.0.html and some messages in that thread.
you have to enter your iCloud user name and password , then for the IPhoneName you can type .* to start with.
then enter a homelat / homelong values ( you can find them in your favorite GPS or iPhone itself )
then make sure your iPhone is setup to share its location information in iCloud account
hope fully it will get your started.

Thx but I have already tried that, but when I trie to enter long and lat and also change device name to .* it doesn't stick when I close it or open an other tab


Sent from my iPhone using Tapatalk - now Free (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 22, 2013, 05:18:15 pm
then enter a homelat / homelong values ( you can find them in your favorite GPS or iPhone itself )

@amg,

For the original Google Latitude plugin I defaulted the latitude/longitude values of "home" to  luup.latitude and luup.longitude - i.e. the location of the Vera Unit itself - whenever the equivalent of the homelat/homelong values are empty. May be worth implementing for the IPhoneLocator plugin too?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 22, 2013, 05:19:07 pm
Thx but I have already tried that, but when I trie to enter long and lat and also change device name to .* it doesn't stick when I close it or open an other tab

Did you click the "Save" button (goes red when the variables in the settings get updated)?
Title: Re: Plugin - IPhone Locator
Post by: AP on October 22, 2013, 05:24:00 pm

Thx but I have already tried that, but when I trie to enter long and lat and also change device name to .* it doesn't stick when I close it or open an other tab

Did you click the "Save" button (goes red when the variables in the settings get updated)?
That's the issue it dosent turn red and still says reload, and as soon as I shift to another tab my Newley typed values are gone


Sent from my iPhone using Tapatalk - now Free (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 22, 2013, 08:36:15 pm
That's the issue it dosent turn red and still says reload, and as soon as I shift to another tab my Newley typed values are gone

Something seems to be amiss with your setup. It's not the plugin.
- I'd suggest to reboot your Vera (power off/on)
- refresh your browser with [ctrl]-[F5] or close browser
- maybe even restart your PC

- try again entering your settings.
- don't forget to click the big, red [Save] button in the top right of your Vera UI

If all fails, check the Lua log: http://[VeraIP]/cgi-bin/cmh/log.sh?Device=LuaUPnP
Hope that helps.

MJ
Title: Re: Plugin - IPhone Locator
Post by: brettow on October 23, 2013, 12:08:01 am

Thx but I have already tried that, but when I trie to enter long and lat and also change device name to .* it doesn't stick when I close it or open an other tab


I had the same problem and a workaround was to leave the existing txt in the field. Type in what you needed inside the txt e.g Mytxt is the original txt so My*txt would be what you end up with. Then save it, then go back and remove the other txt. Unsure why this happened and I tried both firefox and ie with the same results. A reboot didnt fix it either.

No idea why however it worked.
Title: Re: Plugin - IPhone Locator
Post by: yraps on October 23, 2013, 01:23:00 am
Few questions;
1. I have 2 devices under the same iCloud account. I want to track my iPhone and NOT my iPad. When inserted the exact iPhone string name nothing came up. Thereafter I tried "*." and finally it picked up (I guess) the first device on the iCloud list, my iPad. On the plug-in it shows the right location as well as on the top bar the device name was displayed. The question is how I force the plug-in to look for a specific device name? All my devices have "<first name> iPhone <or> iPad"
2. The map tab doesn't work no map is been displayed? any clues ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 23, 2013, 02:17:10 am
Few questions;
1. I have 2 devices under the same iCloud account. I want to track my iPhone and NOT my iPad. When inserted the exact iPhone string name nothing came up. Thereafter I tried "*." and finally it picked up (I guess) the first device on the iCloud list, my iPad. On the plug-in it shows the right location as well as on the top bar the device name was displayed. The question is how I force the plug-in to look for a specific device name? All my devices have "<first name> iPhone <or> iPad"
2. The map tab doesn't work no map is been displayed? any clues ?

it depends on name & pattern matching lua, see first post. to be 100% sure that should work
^name$,^name2$
Title: Re: Plugin - IPhone Locator
Post by: brockangelo on October 23, 2013, 01:09:52 pm
Thanks for all your hard work on this plugin. I love the idea, and out of the box I'm able to see all my devices (even the macbook).

I'm having an issue where the plugin reports me as away, and I'm not sure why, but it reports me as 6000 miles away. I thought I had lat / long in the wrong boxes, but then it reported me as 3000 miles away.

I have the following settings (and I'm in the middle of Illinois):

Home Lat:    40.10
Home Long: 88.25
Home Range: 01.00
Unit:    Kilometers
Addr Format:   (empty)

The street address shows correct for the device, so I can tell its pulling in the location just fine; but the away status doesn't seem to register properly.
Title: Re: Plugin - IPhone Locator
Post by: Brientim on October 23, 2013, 01:22:32 pm
Is Illinois' longitude West and therefore, -88.25.
Title: Re: Plugin - IPhone Locator
Post by: brockangelo on October 23, 2013, 01:25:09 pm
Ha! Thanks Brientim. Just saw that....

I'm just going to crawl quietly back to my hole... :)

Thanks
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 23, 2013, 02:46:36 pm
then enter a homelat / homelong values ( you can find them in your favorite GPS or iPhone itself )

@amg,

For the original Google Latitude plugin I defaulted the latitude/longitude values of "home" to  luup.latitude and luup.longitude - i.e. the location of the Vera Unit itself - whenever the equivalent of the homelat/homelong values are empty. May be worth implementing for the IPhoneLocator plugin too?

that is what v1.50 does I believe,  unless I got this wrong
Code: [Select]
local HomeLat= luup.variable_get(service,"HomeLat", lul_device)
if (HomeLat == nil) or (HomeLat == "")  then
luup.variable_set(service,"HomeLat",luup.latitude,lul_device)
luup.variable_set(service,"CurLat",luup.latitude,lul_device)
luup.variable_set(service,"PrevLat",luup.latitude,lul_device)
else
luup.variable_set(service,"CurLat",HomeLat,lul_device)
luup.variable_set(service,"PrevLat",HomeLat,lul_device)
end

local HomeLong= luup.variable_get(service,"HomeLong", lul_device)
if (HomeLong == nil) or (HomeLong == "")  then
luup.variable_set(service,"HomeLong",luup.longitude,lul_device)
luup.variable_set(service,"CurLong",luup.longitude,lul_device)
luup.variable_set(service,"PrevLong",luup.longitude,lul_device)
else
luup.variable_set(service,"CurLong",HomeLong,lul_device)
luup.variable_set(service,"PrevLong",HomeLong,lul_device)
end 
   
Title: Re: Plugin - IPhone Locator
Post by: AP on October 23, 2013, 04:25:13 pm

That's the issue it dosent turn red and still says reload, and as soon as I shift to another tab my Newley typed values are gone

Something seems to be amiss with your setup. It's not the plugin.
- I'd suggest to reboot your Vera (power off/on)
- refresh your browser with [ctrl]-[F5] or close browser
- maybe even restart your PC

- try again entering your settings.
- don't forget to click the big, red [Save] button in the top right of your Vera UI

If all fails, check the Lua log: http://[VeraIP]/cgi-bin/cmh/log.sh?Device=LuaUPnP
Hope that helps.

MJ

We'll thx a reboot made it all work


Sent from my iPad using Tapatalk - now Free (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 23, 2013, 04:36:20 pm
We'll thx a reboot made it all work

Great. Glad you got it working.
Remember to always do a browser refresh when tinkering with the UI or installing new plugins. Sometimes stuff is kept in the browser cache and this leads to unpredictable results ...
I learned this the hard way myself  ;).

MJ
Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 23, 2013, 10:32:41 pm
@amg0

I believe someone had put in a request somewhere in regards to how to handle a lack of result. I believe this is happening in some rare circumstances for me as I've seen times where I suddenly get the message that I'm away, when I haven't even moved my phone for hours, then jumps back at the next refresh that I'm home. I'm running the newer v1.50. Not sure the details, but I'll see if I can catch it in the logs next time it occurs to provide some logs. Just wanted to add that I think this would be a valuable addition to the code.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 24, 2013, 02:00:57 am
@amg0

I believe someone had put in a request somewhere in regards to how to handle a lack of result. I believe this is happening in some rare circumstances for me as I've seen times where I suddenly get the message that I'm away, when I haven't even moved my phone for hours, then jumps back at the next refresh that I'm home. I'm running the newer v1.50. Not sure the details, but I'll see if I can catch it in the logs next time it occurs to provide some logs. Just wanted to add that I think this would be a valuable addition to the code.

ok. I did add the handling of no or bad reply from google in older versoin, so it is included in v1.50 public release. so wondering if that should be something else. logs will help ( you can enable DEBUG mode easily now using the button in the control tab of the device. just do not forget to remove it )

remember GPS is not totally stable nor precise a +- 20/50 m is possible. so it could also depend on what home range you have put. I have 0.2 in my range and never have any fluctuations
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 24, 2013, 03:24:31 am
I have 0,4 as range, but often I am reported more than 0,4 away, while I am just at home. Very strange, since my wife 's iPhone is reporting the correct location and they are next to each other.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 24, 2013, 04:32:41 am
I have 0,4 as range, but often I am reported more than 0,4 away, while I am just at home. Very strange, since my wife 's iPhone is reporting the correct location and they are next to each other.

Based on some research I did, it looks like the iPhone prefers to indicate location based on WIFI networks (over GPS). If you have many wifi networks around you, it should improve location reporting (they tend to move less), but there are lots of examples online where the database entry for a wifi network is off relative to the actual physical location. As a result, you may not get completely precise results. In the past I've operated with up to 1.5km as the "home" location range.
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on October 24, 2013, 07:08:31 am
Ahh, I have no wifi on my iPhone, it is broken
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 24, 2013, 08:04:33 am
Ahh, I have no wifi on my iPhone, it is broken

That would explain why the phone jumps around. (You're seeing the "echo" of where the phone last saw the sky _and_ it got polled by your Vera/plugin). As you may well know, GPS requires line of sight to three satellites for an accurate(ish) location. The signal can, supposedly, travel through glass and plastic, but woodwork, concrete, etc is another matter altogether.

Title: Re: Plugin - IPhone Locator
Post by: shmixx on October 24, 2013, 10:18:02 am
All valid points by the collaborative group. I do have WiFi enabled on mine as I have a VZW (no 2 things at once :() so I need WiFi to do cell and data. Unfortunately mine still bounces around. But it's only maybe 1 or 2 times in a day at most. Outside this, it's usually pretty darn accurate. My "home" location is set as 0.04 and I've left it on Meters. Accuracy is pretty good in tests as I can at most get to the next street before the main road and my phone notifies me that I'm away. Same if I go for a run around the neighborhood or if I take the dog for a walk it accurately represents me away/home.

I guess I may have to look at the distances being reported when those random occurrences happen to see if perhaps I can just set the window slightly larger to account for the misrepresented location. I'll retract the "issue" until I'm able to grab some logs and get some further details.

Thanks team!!  8)
Title: Re: Plugin - IPhone Locator
Post by: Blokl on October 24, 2013, 11:38:31 am
Hello,

I installed v1.5 on vera lite and my network speed drops down.
Is there some configuration I missed?

Regards,

Blokl
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on October 24, 2013, 01:20:08 pm
Hello,

I installed v1.5 on vera lite and my network speed drops down.
Is there some configuration I missed?

Regards,

Blokl

Not clear to me what you mean by "Network speed", nor where the speed drops down? From what, to what, etc?
Title: Re: Plugin - IPhone Locator
Post by: Brientim on October 24, 2013, 02:39:46 pm
GPS navigation requires 4 satellites, 3 to locate and triangulate the position and the 4th is used for time sync and altitude. The more satellites available the calculating reduces the margin of error and increase accuracy.

However, hybrid or assisted gps (for Apple - reading below if you want some more info) interject known information as points of reference such things as wifi or cell towers to assist in calculating the position.  This is very important for when you are inside and help your phone know were you are.

http://www.macworld.com/article/1159528/how_iphone_location_works.html

http://tewha.net/2011/10/how-the-iphone-gps-differs-from-a-standalone-navigation-gps/
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 24, 2013, 03:43:59 pm
Has anybody here experienced a difference between an iphone4 and a 4S ? I am using the same settings for both phones, but my wifes iphone4 seems a lot more inaccurate with its gps position, and it also needs a lot more refreshes to get a position. On the smae setings, if i leave the house with both phones, my 4S registers AWAY, while my wifes 4 is still PRESENT. I cannot understand with exactly the same settings, why both phones behave so differently
Title: Re: Plugin - IPhone Locator
Post by: Brientim on October 24, 2013, 04:11:04 pm
The iPhones, iPad are suppose to work the same but variables include cases and where you have your phone etc.

Earlier on, I posted a test if the gps tracking and I would suggest you have a look at this to see if they are behaving the same.

Note: when you are at home, you maybe using wifi.
When you leave, GPS, 3/4G to connect to the iCloud

 So there is a difference between home and away depending on how it connects to the cloud.
Find my iPhone is reliant on the iCloud connection to relay position.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on October 25, 2013, 08:41:10 pm
Hello, I can't seem to get the Map tab to display any maps.  It just says "map"

Any ideas?
Hey ... did you put a book on your keyboard ;D.

Try rebooting your Vera and refresh your browser (by closing it or pressing [CTRL]-[F5]).
I had a similar experience today - it took quite a while until the map showed up.
Might have been a glitch in the network somewhere though.

MJ


PS: you can use the [Modify] button to change your post ...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 26, 2013, 02:48:08 am
Hello, I can't seem to get the Google Map tab to display any maps.  It just says "map"

Any ideas?
What browser and version do you use?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 27, 2013, 04:53:02 pm
Private release of V1.53 , it can be installed from http://apps.mios.com/test-plugin.php?id=4686&show=versions

This is a private version ( not generally available to public ) which introduces a number of enhancements based on the idea of @sjolshagen.  It will require quite a bit of testing, so beta testers and feedbacks are welcome.  in case of trouble, please enable DEBUG mode ( using the button on the control tab ) and send the debug log file ( or a grep based on "IPhoneLocator" string )

Enhancements over the public V1.50 version
Title: Re: Plugin - IPhone Locator
Post by: cubs2b23 on October 29, 2013, 01:17:22 pm
Maybe I missed that this was fixed in a more recent version (I'm running 1.49 beta2) but I've noticed that my map's ranges are in km even though I have it set to Statute Miles.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 29, 2013, 01:34:42 pm
Maybe I missed that this was fixed in a more recent version (I'm running 1.49 beta2) but I've noticed that my map's ranges are in km even though I have it set to Statute Miles.
yes , you can please try the public version on the App Store ( v1.50 public )
then after a change of unit in the variable make sure you reload LUA engine, refresh browser.
then all numbers in polling map / distance variable are considered to be in the selected unit.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 30, 2013, 07:15:13 am
Strange thing happening with my iphonelocator 1.50, has been working fine for a while now. Today,  phone switched to away without actually going away. When checking in the advanced settings, distance is 0.006, and in settings i have home range as 0.1, so phone should still be present ? It has now switched back to present with a distance in advanced now 0.018 ? very strange
Title: Re: Plugin - IPhone Locator
Post by: xAPPO on October 30, 2013, 08:23:07 am
First of all many thanks for such a useful and well supported plugin. Well done.

A little unusual but I have a lot of iOS devices (10+) on one iCloud account - they all show up well.  But usually only a couple of these are out and about and so I'm concerned that with adaptive polling I may be hitting iCloud with unnecessary polls.  Would it be possible in some future update to handle the map / adapative polling of each device independently in their settings perhaps ?   I don't want to split the devices across several iCloud accounts as they then become invisible to each other.  I guess I could load several instances of the plugin each handling one device but that seems inefficient and will use lots of precious memory.

Also ..  Can anyone think of a way to get at the Google map display using a remote browser (not via mios dashboard) ?   A variable with the dynamic url might be workable with some associated code from my end to dynamically redirect a fixed url .... hmm maybe I can build it already from the lat/long vars. What I would like to do is to be able to display full screen the live / interactive map on a (non iOS) remote device, perhaps even a TV based browser enabling us to be able to display a location that updates after each poll from Vera.   

One further personal goal would be one map, perhaps from the master device displaying all my child device locations but whilst useful to me I don't think others would have much use for this so I'll look into whether I can use  the individual lat/longs to achieve this.  I'm very aware that feature wishlists can be very demotivating.

K
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 30, 2013, 01:25:09 pm
First of all many thanks for such a useful and well supported plugin. Well done.

A little unusual but I have a lot of iOS devices (10+) on one iCloud account - they all show up well.  But usually only a couple of these are out and about and so I'm concerned that with adaptive polling I may be hitting iCloud with unnecessary polls.  Would it be possible in some future update to handle the map / adapative polling of each device independently in their settings perhaps ?   I don't want to split the devices across several iCloud accounts as they then become invisible to each other.  I guess I could load several instances of the plugin each handling one device but that seems inefficient and will use lots of precious memory.

Also ..  Can anyone think of a way to get at the Google map display using a remote browser (not via mios dashboard) ?   A variable with the dynamic url might be workable with some associated code from my end to dynamically redirect a fixed url .... hmm maybe I can build it already from the lat/long vars. What I would like to do is to be able to display full screen the live / interactive map on a (non iOS) remote device, perhaps even a TV based browser enabling us to be able to display a location that updates after each poll from Vera.   

One further personal goal would be one map, perhaps from the master device displaying all my child device locations but whilst useful to me I don't think others would have much use for this so I'll look into whether I can use  the individual lat/longs to achieve this.  I'm very aware that feature wishlists can be very demotivating.

K

good suggestions. the google map url and showing all devices on one map should not be too hard, although the "center on phone" button feature could end up beeing a little challenge.

For the polling this is a bit complex. For all the devices under a single iCloud account, there is only one actual polling request which is made by the vera box to to iCloud. The response will then update all the devices. so having one or 20 devices under your iCloud account is not generating more polls. at least not between your vera and the iCloud. Then betwen iCloud and your devices that is another story controlled by apple and that I do not really know.

each device can hardly have their own polling map because we are anyhow forced , from the root device which is handling the polling , to poll at the smallest time period that is being asked accross all the devices under that common iCloud account. if a device's distance requires a poll each 100s but another device's distance requires a poll of 2s, the root device handling the actual poll will poll at 2s.  polling time is of course reevaluated each time.
hope that helps
Title: Re: Plugin - IPhone Locator
Post by: Stephan on October 31, 2013, 09:01:23 am
Hi,

still Distance variable trigger events for "Distance goes above/below" does not work. I have tried 1.50 and current 1.53 rel.

everything else works fine...

Kind regards
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 31, 2013, 12:51:43 pm
Hello, I can't seem to get the Map tab to display any maps.  It just says "map"

Any ideas?

I have reproduced this issue when connecting remotely via the MCV servers. the google script handling the map drawing fails to load and it seems to be some sort of security restriction on the MCV servers that is not hapening when you are loggin in locally. I have opened a question on this forum to seek some help about this as I do not know how to fix this.  similarly icons are not showing up either and it seems to be a known issue.

were you logged in remotely when this happened ?

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 31, 2013, 12:58:07 pm
I log in remotely, and the map works fine. I am on 1.50
Title: Re: Plugin - IPhone Locator
Post by: matchews on October 31, 2013, 01:00:23 pm

Strange thing happening with my iphonelocator 1.50, has been working fine for a while now. Today,  phone switched to away without actually going away. When checking in the advanced settings, distance is 0.006, and in settings i have home range as 0.1, so phone should still be present ? It has now switched back to present with a distance in advanced now 0.018 ? very strange

I'm experiencing the same thing.


Sent from my iPhone using Tapatalk (http://tapatalk.com/m?id=1)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 31, 2013, 02:00:11 pm
Hi,
still Distance variable trigger events for "Distance goes above/below" does not work. I have tried 1.50 and current 1.53 rel.
everything else works fine...
Kind regards

Fixed with this new file I hope. Was a rename which did not make it through to the .json file. I will post an update later, fix will be in v>=1.54 but you can upload that file using UI5 device file screen and it should work
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 31, 2013, 04:52:36 pm
I have published a private version on the apps store v1.54 that you can install from http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions)

News
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 31, 2013, 05:37:05 pm
I have just upgraded to 1.54, but cant find the new features:

Add a Full Screen button to Map tab in order to open map in a blank window
Add a GetMapUrl UPNP action which returns the url to open in a browse to see a map centered on the phone position
Add a MapUrl variable that holds the url to open that same google map

I see a Mapurl in advanced settings, but the field is blank
Title: Re: Plugin - IPhone Locator
Post by: amg0 on October 31, 2013, 05:49:00 pm
I have just upgraded to 1.54, but cant find the new features:

Add a Full Screen button to Map tab in order to open map in a blank window
Add a GetMapUrl UPNP action which returns the url to open in a browse to see a map centered on the phone position
Add a MapUrl variable that holds the url to open that same google map

I see a Mapurl in advanced settings, but the field is blank

remember to reload LUA , then force a refresh your browser ( Ctrl F5 to clear the cache ). then you should see v1.54 in the bottom right corner of your pluging dashboard.


- Full screen button: below the center phone , center home in the MAP tab.
- GetMapUPNP action: seeable if you use urls to call UPNP actions like explained in http://wiki.micasaverde.com/index.php/Luup_Requests#actions
- MapUrl Variable in the device advanced tab.
- Distance trigger fix : not really visible unless you use the trigger

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on October 31, 2013, 06:33:55 pm
It wanted another reload, now everything is there. Very good i have to say.

Quote
GetMapUPNP action: seeable if you use urls to call UPNP actions like explained in http://wiki.micasaverde.com/index.php/Luup_Requests#actions

I think before i even attempt understanding this, i probably need to learn a few more basics... slowly getting there though
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 01, 2013, 08:22:46 am
Upgrade Suggestion : Multiple Locations
I may be able to do this with the variables but could also be implemented into the app is multiple locations for tracking the iPhones.

Example: My daughters phone could have a school and home location saved with different present distances. This way I could have vera send a push notification to my phone with she arrives/leaves home and arrives/leaves school.

This could be the same case with my wife's phone between home/work/daycare/her moms, etc...  Or maybe if she stops somewhere unexpectedly for a period of time so I can find out where her bf lives. LOL joking



Title: Re: Plugin - IPhone Locator
Post by: pentium on November 01, 2013, 10:11:26 am
This is just absolutely stunning! 

I finally figured out how to get the latest release (1.54) and I have a question.  In the advanced tab there are fields for email and password.  Are these still used?  At least in my case, the password is not hidden as it is in the settings tab. 

I cannot thank all of you enough!  I have read the 25 pages and the 18 pages and they document amazing cooperation, and obviously hours and hours of work.  Thank you.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 01, 2013, 11:47:05 am
I finally figured out how to get the latest release (1.54) and I have a question.  In the advanced tab there are fields for email and password.  Are these still used?  At least in my case, the password is not hidden as it is in the settings tab.

Yes, they are used. The settings tab is just a human friendly means to easily enter all the relevant parameters. You'll find that most plugins/devices don't have a settings tab and you are forced to enter your data in the advanced tab.
At the moment there is nothing to be done about the human readable password in the advanced tab. If I'm not mistaken @amg0 is still looking for a 'better' way.
Do NOT delete any entries in the advanced tab.

MJ
Title: Re: Plugin - IPhone Locator
Post by: justauser on November 01, 2013, 01:20:30 pm
I just installed 1.54 and this is my first time using the IPhone Locator App at all.  If I wanted to set up a scene where anytime my phone goes more than 4 miles away from my house it sets the IPhone Locator to 'Away' - would I go into triggers, select 'Distance goes above' and then just enter '4' for the distance?  Or do I need to put something like '4 Mm' or '4.0'?

The reason I ask is because I create this scene (using 4 as the distance) and then manually set my phone to 'Present'.  I'm currently home and everytime it polls it comes up with a number around 1.60 (sometimes 1.58, sometimes 1.61) - never above 4 and for some reason every time it polls it sets my iphone to 'Away'.

Am I doing something wrong?  Sorry if this has been covered in the thread, I tried to read a lot of it but 18 pages is a lot of information. 
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 01, 2013, 01:53:06 pm
I just installed 1.54 and this is my first time using the IPhone Locator App at all.  If I wanted to set up a scene where anytime my phone goes more than 4 miles away from my house it sets the IPhone Locator to 'Away' - would I go into triggers, select 'Distance goes above' and then just enter '4' for the distance?  Or do I need to put something like '4 Mm' or '4.0'?

The reason I ask is because I create this scene (using 4 as the distance) and then manually set my phone to 'Present'.  I'm currently home and every time it polls it comes up with a number around 1.60 (sometimes 1.58, sometimes 1.61) - never above 4 and for some reason every time it polls it sets my iphone to 'Away'.

Am I doing something wrong?  Sorry if this has been covered in the thread, I tried to read a lot of it but 18 pages is a lot of information. 

I think you put the cart before the horse. It is the IPhone Locator that triggers scenes (although you could of course use scenes to manipulate the IPL). You don't need to set up a scene that sets the IPL to [Away]. IPL does this by itself.

You have to make sure that your parameters are correct in the settings tab. [Home Lat/Home Long] specifies your home location (mind the East/West notation). [Home Range] specifies which distance from the above Lat/Lon you consider still to be home. When Lat/Lon is correct and you poll the IPL while you (or rather your iPhone) is at home then the status will turn to [Present]. As soon as the phone moves away more than the set [Home Range] your status will change to [Away] with the next poll.
The [Polling period] and [(polling)Map] settings let you set distances and intervals when you want IPL to update your location. E.g. you want to poll less often when you are far away from home. Please read post 1 of this thread.

This behavior can then be used in scenes where you specify the scene trigger to do something when you are 4km (or miles) from home. E.g. I created a scene that locks my entrance doors as soon as I leave the [Home Range] {Device is Away}. Similarly in your case you'd want to trigger a scene when {Device goes above} 4km.

In summary - IPL handles the [Present/Away] states by itself. With these states and/or distances from home you create triggers to run scenes.

Hope I could shed some light on this fantastic piece of code.

MJ
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 01, 2013, 01:54:59 pm
I just installed 1.54 and this is my first time using the IPhone Locator App at all.  If I wanted to set up a scene where anytime my phone goes more than 4 miles away from my house it sets the IPhone Locator to 'Away' - would I go into triggers, select 'Distance goes above' and then just enter '4' for the distance?  Or do I need to put something like '4 Mm' or '4.0'?

The reason I ask is because I create this scene (using 4 as the distance) and then manually set my phone to 'Present'.  I'm currently home and everytime it polls it comes up with a number around 1.60 (sometimes 1.58, sometimes 1.61) - never above 4 and for some reason every time it polls it sets my iphone to 'Away'.

Am I doing something wrong?  Sorry if this has been covered in the thread, I tried to read a lot of it but 18 pages is a lot of information.

Under Settings once you set you home coordinates then set home range to 4 statute miles. it will automatically set your presence as Away. Then you can use your away status as your trigger. You don't need to set a trigger to set you as present or away. The app already does this.
Title: Re: Plugin - IPhone Locator
Post by: justauser on November 01, 2013, 02:01:20 pm
Ah, thank you emtschei and aaronsquire.  Much appreciated. 

Out of curiosity, is there a suggested Home Range to put in?  Like the iphone is usually accurate to x miles?
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 01, 2013, 02:10:45 pm
Out of curiosity, is there a suggested Home Range to put in?  Like the iphone is usually accurate to x miles?
You're welcome.
The [Home Range] much depends on your needs and can be set to (almost) anything you want. Mine is 0.05 (km) which is about half my driveway :).
Accuracy of the iPhone is a much discussed topic and depends on a couple of things. See @Brientim's post 237 in this thread for further explanation and links:
http://forum.micasaverde.com/index.php/topic,16907.msg133130.html#msg133130 (http://forum.micasaverde.com/index.php/topic,16907.msg133130.html#msg133130)

You have to find out how precise IPL reflects your home location and set your [Home Range] accordingly.

MJ
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 01, 2013, 02:45:21 pm
Out of curiosity, is there a suggested Home Range to put in?  Like the iphone is usually accurate to x miles?

You're welcome. I've set mine to 0.08 miles as to include some area even outside the house. Don't want to be out in the yard plus or minus GPS error and it turn lights off on me. But soon as I start driving down the road, typically I get push notification that vera has detected I'm away and turned off the lights before I'm out of sight of the house. Loving this app.
Title: Re: Plugin - IPhone Locator
Post by: pentium on November 01, 2013, 04:13:13 pm
I specifically followed this topic because I want the plugin to set my alarm if my wife and I are both away.  We have separate icloud accounts.  Will I have to figure out how to use a pleg or other plugin to manage this or is there something simple, however inefficient, that I could use to achieve this?  If I get that far, then I would like to be able to see if we are both home at night and failed to set the alarm.  I see a lot of opportunities, but I am confounded by the fact that I have to deal with two accounts/phones/people.  Thanks
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 01, 2013, 07:28:16 pm
I specifically followed this topic because I want the plugin to set my alarm if my wife and I are both away.  We have separate icloud accounts.  Will I have to figure out how to use a pleg or other plugin to manage this or is there something simple, however inefficient, that I could use to achieve this?  If I get that far, then I would like to be able to see if we are both home at night and failed to set the alarm.  I see a lot of opportunities, but I am confounded by the fact that I have to deal with two accounts/phones/people.  Thanks

My wife and I have our own accounts. I have two instances of Iphone Locator running on my vera. I use PLEG to check when either of us get home and a scene is set to do certain things if I come home and others when she gets home. Also, once both of us are away, it sets thermostat to away, lights off, arms and locks the doors. So yes its possible and very simple. I'm a new user and got it working with no problems.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 01, 2013, 08:05:03 pm
My wife and I have our own accounts. I have two instances of Iphone Locator running on my vera. I use PLEG to check when either of us get home and a scene is set to do certain things if I come home and others when she gets home. Also, once both of us are away, it sets thermostat to away, lights off, arms and locks the doors. So yes its possible and very simple. I'm a new user and got it working with no problems.
I have the same setup. 2 Iphonelocators for my wife and myself. It is sort of working. But i am struggling a little, and my logic is growing out of control, trying to cope with all eventualities.
If your setup is working fine, could you post a status ? I am only really interested of what you do to determine when both are home (i think i got that working fine though), when one of us is approaching (especially in the dark as i want light s to be turned on), and this is what i am really struggling with, approaching home but before returning home going away again. (When i am on the train home, i get close to the house on the train, but the train stops actually further away from the house, so i forst approach, the go away, then approach again if that makes sense)
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 01, 2013, 10:04:39 pm
I have the same setup. 2 Iphonelocators for my wife and myself. It is sort of working. But i am struggling a little, and my logic is growing out of control, trying to cope with all eventualities.
If your setup is working fine, could you post a status ? I am only really interested of what you do to determine when both are home (i think i got that working fine though), when one of us is approaching (especially in the dark as i want light s to be turned on), and this is what i am really struggling with, approaching home but before returning home going away again. (When i am on the train home, i get close to the house on the train, but the train stops actually further away from the house, so i forst approach, the go away, then approach again if that makes sense)
+1 for the setup. I haven't dug my fingers into the PLEG yet...

I see the problem with your coming close to your house on the way home. An interesting situation which might be solved with a fine tuned polling map.

I don't bother with turning on outside lights when approaching. I use a 10W LED flood light that turns on at dusk and off at a random time around 1am. This gives me also a sense of security and costs less than $5/year.
But then ... I'm in the boonies where my lights bother no one but the wildlife  :).

MJ
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 01, 2013, 10:35:10 pm
At the moment there is nothing to be done about the human readable password in the advanced tab. If I'm not mistaken @amg0 is still looking for a 'better' way.
Do NOT delete any entries in the advanced tab.

Correct. @amg0 is working on encoding the password (in a future release). At that point, it will be "garbled" in the Advanced Tab as well.

As @emtschei states, the Advanced tab is a true reflection of the state of the plugin. I.e. the password, username and any other variable that is persistently stored by the plugin will be saved there.

Regardless of when @amg releases the password encryption, keep in mind that this does _not_ make your password "secure". It will only make it a little less obvious than what it currently is. I suspect that someone with an eye for cryptology would be able to decode almost anything we could do to "protect" your password on this device.

As a result, be security conscious as you use both the iPhone Locator plugin (and provide logs, etc for troubleshooting!
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 02, 2013, 01:07:07 pm
I have the same setup. 2 Iphonelocators for my wife and myself. It is sort of working. But i am struggling a little, and my logic is growing out of control, trying to cope with all eventualities.
If your setup is working fine, could you post a status ? I am only really interested of what you do to determine when both are home (i think i got that working fine though), when one of us is approaching (especially in the dark as i want light s to be turned on), and this is what i am really struggling with, approaching home but before returning home going away again. (When i am on the train home, i get close to the house on the train, but the train stops actually further away from the house, so i forst approach, the go away, then approach again if that makes sense)

Basically I use PLEG and I have different action/scene depending on which of us come home. Or if either of us come home after dark there is a different scene which basically turns everything on. Hope this helps.
Triggers

Day
Day or Night indicates Day time.


Night
 Day or Night indicates Night time.


TAaronAway
 (*)Aaron iPhone is away


TAaronHome
 (*)Aaron iPhone is present


TJessicaAway
 (*)Jessica iPhone is away


TJessicaHome
 (*)Jessica iPhone is present


Conditions
BothAway
TJessicaAway AND TAaronAway


JessicaHome
TJessicaHome and Day


AaronHome
TAaronHome and Day


HomeLate
(TJessicaHome and Night) OR (TAaronHome AND Night)


Actions or Scenes
BothAway

JessicaHome

AaronHome

HomeLate
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 02, 2013, 01:37:16 pm
These are the conditions i have... i am not 100% sure yet i am handling the away and coming back properly. It is an ongoing experiment, all the M... and Mike... conditions are for my phone and are the ones i am experimenting with. I am trying to turn on the lights when my wife or i approach in the dark, then turn them off again once we have been home for a minimum of a few minutes. It is working occasionally, but still a few glitches to sort out, thats why i wanted to see what you have done. It is always interesting to see what others do, gives you ideas of what can be done and how

Mikeaway   Mdistance1 > 0.4   2013-11-01 18:47:13.003    false
Jgoingaway   (Jdirection == 25)   2013-11-02 14:48:24.306    false
Mhome   Mikehome and PingMike   2013-11-02 17:21:40.181    false
Jhome   Justhome and PingJust   2013-11-02 15:15:10.221    true
Mcomhome   (Mdirection == 75) and Mdistance1 < 1.2   2013-11-01 20:18:10.283    false
Jcomhome   (Jdirection == 75) and Jdistance < 1.2   2013-11-01 20:18:48.367    false
Jmute   (Jhome; NOW > 310) and Justhome   2013-11-02 15:20:36.141    true
Mmute   (Mhome; NOW > 310) and Mikehome   2013-11-02 17:27:43.163    true
Mcomdark   (Mcomhometrue or Jcomhome) and Dark   2013-11-01 20:18:48.377    false
Porchopen   Porchdooropen   2013-11-02 17:25:34.114    false
Junmute   Porchopen and Justhome   2013-11-02 17:25:34.147    false
Munmute   Porchopen and Mikehome   2013-11-02 17:25:34.152    false
AutoAway   (NOT Mikehome) and (NOT Justhome)   2013-11-01 18:47:13.102    false
AutoAway5m   AutoAway and (AutoAway; NOW > 5:00)   2013-11-01 18:52:18.209    false
Mhomelights   ((Mcomhome;Mikehome < 30:00) or (Jcomhome;Justhome < 30:00)) and Dark   2013-11-02 16:33:00.173    true
AutoHome   (Mcomhome or Jcomhome or Justhome or PingJust or PingMike or Mikehome) and NOT AutohomeON   2013-11-01 20:18:10.309    false
Justaway   Jdistance > 0.4   2013-11-01 18:48:16.343    false
Mikenotnear   Mcomhome;Mgoingaway < 3:00   2013-11-01 18:20:33.325    false
Mcomhometrue   Mcomhome and (Mcomhome; NOW > 2:00)    2013-11-01 20:21:15.276    false
Mgoingaway   (Mdirection == 25)   2013-11-01 18:53:01.234    false

Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 02, 2013, 05:52:00 pm
I just published a private version v1.57. Install from http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions)

v1.57

Important note: as you upgrade your plugin to this new version, it will take your password from the advanced tab and encrypt it. you will not be able to see your password in the user interface any more. to change it, just go into the SETTINGS tab, type in your password and move the focus cursor to somewhere else. it will save & encrpyt your password immediately. However, it will require a browser refresh before this can be taken into account for things like refreshing the list of devices in the iCLoud account for instance. I have not been yet to identify why. if people have idea feel free to suggest...

As I have to travel for work this week, this version should not evolve too much any more and it can be considered a beta version which, if no one has major issue with it , will become the future public version V1.60 on the store.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 02, 2013, 06:36:19 pm
At the moment there is nothing to be done about the human readable password in the advanced tab. If I'm not mistaken @amg0 is still looking for a 'better' way.
Do NOT delete any entries in the advanced tab.

Correct. @amg0 is working on encoding the password (in a future release). At that point, it will be "garbled" in the Advanced Tab as well.

As @emtschei states, the Advanced tab is a true reflection of the state of the plugin. I.e. the password, username and any other variable that is persistently stored by the plugin will be saved there.

Regardless of when @amg releases the password encryption, keep in mind that this does _not_ make your password "secure". It will only make it a little less obvious than what it currently is. I suspect that someone with an eye for cryptology would be able to decode almost anything we could do to "protect" your password on this device.

As a result, be security conscious as you use both the iPhone Locator plugin (and provide logs, etc for troubleshooting!

absolutely correct. one thing to note though: a copy/paste of the encrypted password shown in advanced tab will not work in another vera. ( unless the thief has access to your vera ... )
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 02, 2013, 06:41:52 pm
Upgrade Suggestion : Multiple Locations
I may be able to do this with the variables but could also be implemented into the app is multiple locations for tracking the iPhones.

Example: My daughters phone could have a school and home location saved with different present distances. This way I could have vera send a push notification to my phone with she arrives/leaves home and arrives/leaves school.

This could be the same case with my wife's phone between home/work/daycare/her moms, etc...  Or maybe if she stops somewhere unexpectedly for a period of time so I can find out where her bf lives. LOL joking

I believe that use case can be solved by multiple instances of the plugin. Just configure same iCloud account but different Home base location. so you can have one plugin for home, one plugin for work
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 08:27:48 am
First, what a fantastic plugin. Great Work!

I just loaded 1.57 and I have two accounts, one with 5 devices, the other with two. All went well, however the account with two devices, the parent shows 1.57, the child stayed at 1.54. Did the reload, ctrl f5, reload thing, still no go. The child remains at 1.54. it shows the location properly, etc, just 1.54.

Will I have to delete the account and create it again.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 03, 2013, 08:32:29 am
First, what a fantastic plugin. Great Work!

I just loaded 1.57 and I have two accounts, one with 5 devices, the other with two. All went well, however the account with two devices, the parent shows 1.57, the child stayed at 1.54. Did the reload, ctrl f5, reload thing, still no go. The child remains at 1.54. it shows the location properly, etc, just 1.54.

Will I have to delete the account and create it again.
this is strange.  could you enable DEBUG mode ( in control tab ) , then restart LUA engine.  send me the LuaUPnP.log file.  what is the configuration parameters on the root and the phone name of the child ?

you can also try to delete the 1.54 device and restart LUA. if the iPhoneName pattern in the parent device is correct, it will be recreated.
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 10:17:20 am

Quote
this is strange.  could you enable DEBUG mode ( in control tab ) , then restart LUA engine.  send me the LuaUPnP.log file.  what is the configuration parameters on the root and the phone name of the child ?

you can also try to delete the 1.54 device and restart LUA. if the iPhoneName pattern in the parent device is correct, it will be recreated.

Just saw this, I've deleted the parent (is there anyway to just delete one device, not all of them and the plugin?) and recreated my account, all devices are fine there. However when I try to setup my wifes account, no devices are created, iCloud poll fails to show any devices. Her device names had a ' and I removed it from two of them, but here phone is not here right now so I can't change that name.

But even when I explicitly force the two devices without the ' (apostrophe) it will not recognize them. iCloud see's all the devices and I can poll them.

How do I get the debug file you need?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 03, 2013, 10:53:55 am

Quote
this is strange.  could you enable DEBUG mode ( in control tab ) , then restart LUA engine.  send me the LuaUPnP.log file.  what is the configuration parameters on the root and the phone name of the child ?

you can also try to delete the 1.54 device and restart LUA. if the iPhoneName pattern in the parent device is correct, it will be recreated.

Just saw this, I've deleted the parent (is there anyway to just delete one device, not all of them and the plugin?) and recreated my account, all devices are fine there. However when I try to setup my wifes account, no devices are created, iCloud poll fails to show any devices. Her device names had a ' and I removed it from two of them, but here phone is not here right now so I can't change that name.

But even when I explicitly force the two devices without the ' (apostrophe) it will not recognize them. iCloud see's all the devices and I can poll them.

How do I get the debug file you need?
you could have deleted just the child device ( the one without a (*) in the title ) but anyhow let's try this method.


Sorry if some of the below sounds basic, just establishing a good baseline to help...

- You have 2 accounts, one with 5 devices and your wife's account with 2 devices. correct ?

- You already have one IPhoneLocator Plugin configured with your first iCloud account and it shows the 5 devices. correct ?

- For your wife's account, first thing obvious you need to make sure you have a second instance of the IPhoneLocator plugin installed and configured with your Wife email & password.  is that the case ?

You then can use https://www.icloud.com/#find (https://www.icloud.com/#find) to check the iCloud login and verify the list of devices associated to this account. Note precisly the names down and maybe communicate them to me via PM.

For now, in your wife IphoneLocator plugin configuration,  I suggest to go into the Advanced Tab and enter .* in the IPhoneName variable  ( that is telling the plugin to pick-up all the devices from the iCloud account ). do this, then click on SAVE button and wait the full reload cycle of Lua

- If the devices that you saw using https://www.icloud.com/#find (https://www.icloud.com/#find) are not showing up in your VERA dashboard then:

- go into the Control Tab of your wide IPhoneLocator plugin
- click the DEBUG button
- reload LUA and wait the cycle to finish
- collect the log by either one of the method below and PM them to me:

a) open http://<your vera ip address>/cgi-bin/cmh/log.sh?Device=LuaUPnP and copy paste the result.   not very easy or practical to get it the complete file.   a more convenient way could be installing the infoviewer plugin  ( http://forum.micasaverde.com/index.php/topic,13477.msg100381.html#msg100381 )

b) use a program like winSCP in SCP protocol mode, log in into VERA as root with the vera password, go to the vera folder /var/log/cmh and drag and drop the LuaUPnP.log file from VERA to your desktop. more complicated method and requires you to know your root password.  on Vera3 I think it is printed below the box, on Vera lite you have to determine it, this is explained here : http://wiki.micasaverde.com/index.php/Logon_Vera_SSH (http://wiki.micasaverde.com/index.php/Logon_Vera_SSH)


Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 11:04:16 am

Quote
this is strange.  could you enable DEBUG mode ( in control tab ) , then restart LUA engine.  send me the LuaUPnP.log file.  what is the configuration parameters on the root and the phone name of the child ?

you can also try to delete the 1.54 device and restart LUA. if the iPhoneName pattern in the parent device is correct, it will be recreated.

Just saw this, I've deleted the parent (is there anyway to just delete one device, not all of them and the plugin?) and recreated my account, all devices are fine there. However when I try to setup my wifes account, no devices are created, iCloud poll fails to show any devices. Her device names had a ' and I removed it from two of them, but here phone is not here right now so I can't change that name.

But even when I explicitly force the two devices without the ' (apostrophe) it will not recognize them. iCloud see's all the devices and I can poll them.

How do I get the debug file you need?
you could have deleted just the child device ( the one without a (*) in the title ) but anyhow let's try this method.


Sorry if some of the below sounds basic, just establishing a good baseline to help...

- You have 2 accounts, one with 5 devices and your wife's account with 2 devices. correct ?

Yes

- You already have one IPhoneLocator Plugin configured with your first iCloud account and it shows the 5 devices. correct ?

Yes

- For your wife's account, first thing obvious you need to make sure you have a second instance of the IPhoneLocator plugin installed and configured with your Wife email & password.  is that the case ?

Yes

You then can use https://www.icloud.com/#find (https://www.icloud.com/#find) to check the iCloud login and verify the list of devices associated to this account. Note precisly the names down and maybe communicate them to me via PM.

OK

For now, in your wife IphoneLocator plugin configuration,  I suggest to go into the Advanced Tab and enter .* in the IPhoneName variable  ( that is telling the plugin to pick-up all the devices from the iCloud account ). do this, then click on SAVE button and wait the full reload cycle of Lua

Done

- If the devices that you saw using https://www.icloud.com/#find (https://www.icloud.com/#find) are not showing up in your VERA dashboard then:

- go into the Control Tab of your wide IPhoneLocator plugin
- click the DEBUG button
- reload LUA and wait the cycle to finish
- collect the log by either one of the method below and PM them to me:

a) open http://<your vera ip address>/cgi-bin/cmh/log.sh?Device=LuaUPnP and copy paste the result.   not very easy or practical to get it the complete file.   a more convenient way could be installing the infoviewer plugin  ( http://forum.micasaverde.com/index.php/topic,13477.msg100381.html#msg100381 )

Installed Infoviewer get: Vera error: Failed to get a line count of:/var/log/cmh/LuaUPnP.log

b) use a program like winSCP in SCP protocol mode, log in into VERA as root with the vera password, go to the vera folder /var/log/cmh and drag and drop the LuaUPnP.log file from VERA to your desktop. more complicated method and requires you to know your root password.  on Vera3 I think it is printed below the box, on Vera lite you have to determine it, this is explained here : http://wiki.micasaverde.com/index.php/Logon_Vera_SSH (http://wiki.micasaverde.com/index.php/Logon_Vera_SSH)

Tried that too :)

I use a usb drive for logging, so I don't exactly know how to get to the file.

Going to wait until I can change the name of the phone, then I'll try again. It can't even poll iCloud to get the list of devices, so I suspect it's the apostrophe in the name. Should know better anyway  ::)

Great Plugin, love the show all devices on Map.
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 11:33:23 am
Disabled USB logging, and now I can see the file.

Can't PM you yet, guess I don't have enough posts...

Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 12:08:53 pm
Looks like an authentication issue from the logs, I've checked and re-entered the account info, nada. I've deleted the hashed password in the advanced tab, and forced it to create/populate the field again, nada. Its a mixed case, numeric password not unlike mine. I'll try to delete and reinstall the plugin again. Otherwise I'll go back to 1.54 and see if that works.
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 03, 2013, 12:22:43 pm
Just want to say a big thank you to everyone who has helped from scripting, to the plugin it has become now!

Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 03, 2013, 01:18:20 pm
Looks like an authentication issue from the logs, I've checked and re-entered the account info, nada. I've deleted the hashed password in the advanced tab, and forced it to create/populate the field again, nada. Its a mixed case, numeric password not unlike mine. I'll try to delete and reinstall the plugin again. Otherwise I'll go back to 1.54 and see if that works.

have you confirmed that authentication ( user & pwd ) is working on  https://www.icloud.com/#find  first ?

assuming so, you also need to be aware that the ONLY way to enter the password is to do it in the SETTING tab in the password. Do not try to enter it directly in the advanced tab, it wont work; the advance tab password variable is just the storage of the encrypted salted version.

To enter a password you need to do it in SETTINGS tab  , in the password field. Then change the field focus to something else on the screen. It will save the password.  Then reload LUA to be sure and come back to SETTINGS tab.  click on REFRESH button and you  should see the iDevice names list in the left listbox of the dialog.

if it does not work, you do not have to let me know your password but maybe something similar with the kind of special caracters you used in it so I can test if this could be a encrypt/decrypt issue. I have tested things like       "abcdefgh",       "abcde!:/.;?fgh*%",       "abcde,#{[|`\^@",       "abcde\'ghi\"ljl",       "^??&#??@$???" they all work, but who knows...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 03, 2013, 01:22:20 pm
Just want to say a big thank you to everyone who has helped from scripting, to the plugin it has become now!

for everybody who use & likes it, do not hesitate to put a review in the Apps/MyApps/IPhone plugin, Add Review button. Maybe it ll help MVC to know what plugin they have to proactively insure future compatibility in their future designs...
Title: Re: Plugin - IPhone Locator
Post by: pabrad on November 03, 2013, 05:33:25 pm
First, thanks so much for a great plugin. 

I have one quirk that I can't figure out: the distance is not always calculated.

Polling is working every time.  Polling map works.  iPhone location is always accurate.  Address will change correctly.  Latitude/longitude will change correctly.  But the distance will remain at 0 for quite a while, then jump to the correct distance, then stay at that distance for awhile, then jump to the correct distance, etc.  So, my distance/present/away triggers don't always work.  For example, my iPhone will come home, with the plugin showing my home address, but the distance away will not return back to 0 right away.

I have reinstalled the plugin, rebooted vera, etc., but the problem remains.

I am currently running v1.57.  The problem has existed from the beginning.  I started with 1.40.

Anyone have any ideas?

Thanks for any help you can give.
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 06:14:33 pm
Looks like an authentication issue from the logs, I've checked and re-entered the account info, nada. I've deleted the hashed password in the advanced tab, and forced it to create/populate the field again, nada. Its a mixed case, numeric password not unlike mine. I'll try to delete and reinstall the plugin again. Otherwise I'll go back to 1.54 and see if that works.

have you confirmed that authentication ( user & pwd ) is working on  https://www.icloud.com/#find  first ?

assuming so, you also need to be aware that the ONLY way to enter the password is to do it in the SETTING tab in the password. Do not try to enter it directly in the advanced tab, it wont work; the advance tab password variable is just the storage of the encrypted salted version.

To enter a password you need to do it in SETTINGS tab  , in the password field. Then change the field focus to something else on the screen. It will save the password.  Then reload LUA to be sure and come back to SETTINGS tab.  click on REFRESH button and you  should see the iDevice names list in the left listbox of the dialog.

if it does not work, you do not have to let me know your password but maybe something similar with the kind of special caracters you used in it so I can test if this could be a encrypt/decrypt issue. I have tested things like       "abcdefgh",       "abcde!:/.;?fgh*%",       "abcde,#{[|`\^@",       "abcde\'ghi\"ljl",       "^??&#??@$???" they all work, but who knows...

Uninstalled the plugin, reload, ctrl f5, reload, followed your instructions. No Go. It still looks like an authentication issue. the password is formated like this "A1bcedam" mine is similar and works "A12b3cde"
I can always log in to iCloud and see her devices. Also her iCloud account is using a gmail.com address, I use a .me account
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 03, 2013, 06:26:29 pm
Looks like an authentication issue from the logs, I've checked and re-entered the account info, nada. I've deleted the hashed password in the advanced tab, and forced it to create/populate the field again, nada. Its a mixed case, numeric password not unlike mine. I'll try to delete and reinstall the plugin again. Otherwise I'll go back to 1.54 and see if that works.

have you confirmed that authentication ( user & pwd ) is working on  https://www.icloud.com/#find  first ?

assuming so, you also need to be aware that the ONLY way to enter the password is to do it in the SETTING tab in the password. Do not try to enter it directly in the advanced tab, it wont work; the advance tab password variable is just the storage of the encrypted salted version.

To enter a password you need to do it in SETTINGS tab  , in the password field. Then change the field focus to something else on the screen. It will save the password.  Then reload LUA to be sure and come back to SETTINGS tab.  click on REFRESH button and you  should see the iDevice names list in the left listbox of the dialog.

if it does not work, you do not have to let me know your password but maybe something similar with the kind of special caracters you used in it so I can test if this could be a encrypt/decrypt issue. I have tested things like       "abcdefgh",       "abcde!:/.;?fgh*%",       "abcde,#{[|`\^@",       "abcde\'ghi\"ljl",       "^??&#??@$???" they all work, but who knows...

Uninstalled the plugin, reload, ctrl f5, reload, followed your instructions. No Go. It still looks like an authentication issue. the password is formated like this "A1bcedam" mine is similar and works "A12b3cde"
I can always log in to iCloud and see her devices. Also her iCloud account is using a gmail.com address, I use a .me account

Loaded 1.54 all goodness, can see the account, no authentication error in the debug log...Oddly enough, the advanced tab did not populate with the clear text password. I had to force the password and reload, then it stuck and retrieved the list of devices.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 04, 2013, 06:09:41 am
Loaded 1.54 all goodness, can see the account, no authentication error in the debug log...Oddly enough, the advanced tab did not populate with the clear text password. I had to force the password and reload, then it stuck and retrieved the list of devices.

if it works in 1.54 , and then if you upgrade to 1.57 and it does not work, then it is got to be some form of pwd encryption issue. I am interested in finding the root cause since others could have issues too.  At your convenience, you could enable DEBUG in 1.54 , then proceed with the upgrade , then send me the log files.  you can still downgrade back to 1.54 after. Sorry for all the hasles but at least it could help the community. you can send me log file by PM.

Regarding your comment "the advanced tab did not populate with the clear text password" this is perfectly normal, when downgrading back to 1.54 it just left the value that was there, therefore the old encrypted value saved here by 1.57.  The only good way to manage password is to enter it in the SETTINGS tab.  Also note VERA does not reflect the changes you made in the advanced tab until you refresh the browser for some reasons.   so Lua reload + browser refresh remains a fundamental action to do unfortunately...
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 04, 2013, 09:29:34 am
I love the full page map. I think it might be small updating. Although my wife has been shown on one location on the small map for a little while now (at least 15 mins, polls between 60 secs and 75 secs), the full page map still shows her at her previous location. So the full page map could be a little slow updating
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 04, 2013, 01:05:17 pm
I love the full page map. I think it might be small updating. Although my wife has been shown on one location on the small map for a little while now (at least 15 mins, polls between 60 secs and 75 secs), the full page map still shows her at her previous location. So the full page map could be a little slow updating

@Mikee123, The full screen page for the map is static. it is simply opening google map in a new browser window, there is no update code running there to track phones location, it wont refresh. Only the map inside the plugin window is 'alive'.  it possibly could be implemented by a VERA plugin handler method generating the markup of a full web page ( including maps scripts and refresh logic for the markers). Could be an exercise of some readers unless I get bored one of these upcoming weekends :-)
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 04, 2013, 01:09:58 pm
Loaded 1.54 all goodness, can see the account, no authentication error in the debug log...Oddly enough, the advanced tab did not populate with the clear text password. I had to force the password and reload, then it stuck and retrieved the list of devices.

if it works in 1.54 , and then if you upgrade to 1.57 and it does not work, then it is got to be some form of pwd encryption issue. I am interested in finding the root cause since others could have issues too.  At your convenience, you could enable DEBUG in 1.54 , then proceed with the upgrade , then send me the log files.  you can still downgrade back to 1.54 after. Sorry for all the hasles but at least it could help the community. you can send me log file by PM.

Regarding your comment "the advanced tab did not populate with the clear text password" this is perfectly normal, when downgrading back to 1.54 it just left the value that was there, therefore the old encrypted value saved here by 1.57.  The only good way to manage password is to enter it in the SETTINGS tab.  Also note VERA does not reflect the changes you made in the advanced tab until you refresh the browser for some reasons.   so Lua reload + browser refresh remains a fundamental action to do unfortunately...

Just nine more posts and I should be able to PM you the files. ::) I'll browse around the forums and get that number up. As to the concept of "hassle" there is none. This is why we are here. The work you have done benefits everyone and the little bit of time to install, reload, etc are nothing compared to your work.

Thanks again, will be sending you the files later.
Title: Re: Plugin - IPhone Locator
Post by: Stephan on November 04, 2013, 01:56:47 pm
@amg0: superb plugin, great work!!! 1.57 works fine incl. pw encryption.

feature consideration: ability to store a second location where one regularly stays for longer periods (like work). Including range and corresponding trigger. This would allow special scenes with more restrict settings for energy saving like heating or cooling etc.

Kind regards
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 04, 2013, 02:55:35 pm
I love the full page map. I think it might be small updating. Although my wife has been shown on one location on the small map for a little while now (at least 15 mins, polls between 60 secs and 75 secs), the full page map still shows her at her previous location. So the full page map could be a little slow updating

@Mikee123, The full screen page for the map is static. it is simply opening google map in a new browser window, there is no update code running there to track phones location, it wont refresh. Only the map inside the plugin window is 'alive'.  it possibly could be implemented by a VERA plugin handler method generating the markup of a full web page ( including maps scripts and refresh logic for the markers). Could be an exercise of some readers unless I get bored one of these upcoming weekends :-)

I understand, and i was fully aware of that. What happened on the small map, my wifes phone was in a different location to the full page map. Meaning, it was on one location on the small map, but when i opened the full page map, it should have been there, but it wasnt. I dont think what i've written before made sense... maybe it makes sense now what i meant.
One other little problem, but that could be icloud, not sure if there is anything you can do.
When i unmute my phone, over the next 10 minutes i have a few forced refreshes. Most of the time, after the 3rd or 4th refresh it gets the actual location. It would be good if that would work quicker (if thats possible), as sometimes even after the 5th refresh the phone is still present and therefore mutes, but i am actually 35 miles away at work... when i unmute manually i still have to have a few forced refreshes until it gets that i am not present.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 04, 2013, 04:02:16 pm
@amg0: superb plugin, great work!!! 1.57 works fine incl. pw encryption.

feature consideration: ability to store a second location where one regularly stays for longer periods (like work). Including range and corresponding trigger. This would allow special scenes with more restrict settings for energy saving like heating or cooling etc.

Kind regards

@Stephan. Absolutely right. A superb, great plugin.
This feature was suggested before in Post 257 and answered in post 275.
I agree, from a coding perspective and to not overload the plugin you could achieve this goal with the creation of a second, independent instance of this plugin.

Upgrade Suggestion : Multiple Locations
I may be able to do this with the variables but could also be implemented into the app is multiple locations for tracking the iPhones.

Example: My daughters phone could have a school and home location saved with different present distances. This way I could have vera send a push notification to my phone with she arrives/leaves home and arrives/leaves school.

I believe that use case can be solved by multiple instances of the plugin. Just configure same iCloud account but different Home base location. so you can have one plugin for home, one plugin for work

MJ
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 04, 2013, 05:51:28 pm
For @betabob & others , I posted a V1.58 on the apps store ( private release ) with a small fix.

The plug in initialisation was not processing properly in case of the brand new creation of a new device ( which may have been some of the issues encountered. all upgrades were ok but not creation of new plugins ) .

Title: Re: Plugin - IPhone Locator
Post by: betabob on November 04, 2013, 09:07:52 pm
For @betabob & others , I posted a V1.58 on the apps store ( private release ) with a small fix.

The plug in initialisation was not processing properly in case of the brand new creation of a new device ( which may have been some of the issues encountered. all upgrades were ok but not creation of new plugins ) .

That may explain the weirdness. Do you still want me to debug and send you the file? I should be able to PM you now:) I'll try to do this later tonight (it's 2200 hrs here) as I'm at work :)
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 04, 2013, 09:08:26 pm
Just upgraded to 1.58 and one of my two plugin instances stopped working:

Code: [Select]
0 11/04/13 21:04:26.113 luup_log:224: IPhoneLocator: createChildDevices() <0x300fb680>
50 11/04/13 21:04:26.119 luup_log:224: IPhoneLocator: debug: getAppleDeviceMap for: [apple iCloud username] <0x300fb680>
50 11/04/13 21:04:26.505 luup_log:224: IPhoneLocator: succeed to call fmipservice/device but received 401, Check credentials ? <0x300fb680>
50 11/04/13 21:04:26.507 luup_log:224: IPhoneLocator: ***Response={"res":1,"sta":401,"hea":{"x-responding-server":"st11p02me-fmipservice002_004","x-responding-partition":"p02","set-cookie":"<cookie_id>;path=/;secure;httponly","x-request-uuid":"abf15a89-48f2-416c-a9a2-27c2c5fc62e7-initClient","content-length":"50","x-responding-instance":"fmipservice-10200204-st11p02me-fmipservice002-8004-1T53","date":"Tue, 05 Nov 2013 02:04:25 GMT","server":"Apple-iCloud"}} <0x300fb680>
01 11/04/13 21:04:26.507 LuaInterface::CallFunction_Timer-5 function startupDeferred failed [string "local mime = require('mime')..."]:849: bad argument #1 to 'pairs' (table expected, got nil) <0x300fb680>

This was an upgrade from 1.54 -> 1.58. Looks like the password is somehow not being decoded properly?
The password used for this account is _only_ a combination of alphanumeric characters, i.e. capitalized and non-capitalized letters plus a X-digit number sequence.
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 04, 2013, 11:01:12 pm
Just upgraded to 1.58 and one of my two plugin instances stopped working:

Code: [Select]
0 11/04/13 21:04:26.113 luup_log:224: IPhoneLocator: createChildDevices() <0x300fb680>
50 11/04/13 21:04:26.119 luup_log:224: IPhoneLocator: debug: getAppleDeviceMap for: [apple iCloud username] <0x300fb680>
50 11/04/13 21:04:26.505 luup_log:224: IPhoneLocator: succeed to call fmipservice/device but received 401, Check credentials ? <0x300fb680>
50 11/04/13 21:04:26.507 luup_log:224: IPhoneLocator: ***Response={"res":1,"sta":401,"hea":{"x-responding-server":"st11p02me-fmipservice002_004","x-responding-partition":"p02","set-cookie":"<cookie_id>;path=/;secure;httponly","x-request-uuid":"abf15a89-48f2-416c-a9a2-27c2c5fc62e7-initClient","content-length":"50","x-responding-instance":"fmipservice-10200204-st11p02me-fmipservice002-8004-1T53","date":"Tue, 05 Nov 2013 02:04:25 GMT","server":"Apple-iCloud"}} <0x300fb680>
01 11/04/13 21:04:26.507 LuaInterface::CallFunction_Timer-5 function startupDeferred failed [string "local mime = require('mime')..."]:849: bad argument #1 to 'pairs' (table expected, got nil) <0x300fb680>

This was an upgrade from 1.54 -> 1.58. Looks like the password is somehow not being decoded properly?
The password used for this account is _only_ a combination of alphanumeric characters, i.e. capitalized and non-capitalized letters plus a X-digit number sequence.

That was the error message I got after 1.54 to 1.57 with the same structure for the password.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 05, 2013, 12:31:53 am
Just upgraded to 1.58 and one of my two plugin instances stopped working:

Code: [Select]
0 11/04/13 21:04:26.113 luup_log:224: IPhoneLocator: createChildDevices() <0x300fb680>
50 11/04/13 21:04:26.119 luup_log:224: IPhoneLocator: debug: getAppleDeviceMap for: [apple iCloud username] <0x300fb680>
50 11/04/13 21:04:26.505 luup_log:224: IPhoneLocator: succeed to call fmipservice/device but received 401, Check credentials ? <0x300fb680>
50 11/04/13 21:04:26.507 luup_log:224: IPhoneLocator: ***Response={"res":1,"sta":401,"hea":{"x-responding-server":"st11p02me-fmipservice002_004","x-responding-partition":"p02","set-cookie":"<cookie_id>;path=/;secure;httponly","x-request-uuid":"abf15a89-48f2-416c-a9a2-27c2c5fc62e7-initClient","content-length":"50","x-responding-instance":"fmipservice-10200204-st11p02me-fmipservice002-8004-1T53","date":"Tue, 05 Nov 2013 02:04:25 GMT","server":"Apple-iCloud"}} <0x300fb680>
01 11/04/13 21:04:26.507 LuaInterface::CallFunction_Timer-5 function startupDeferred failed [string "local mime = require('mime')..."]:849: bad argument #1 to 'pairs' (table expected, got nil) <0x300fb680>

This was an upgrade from 1.54 -> 1.58. Looks like the password is somehow not being decoded properly?
The password used for this account is _only_ a combination of alphanumeric characters, i.e. capitalized and non-capitalized letters plus a X-digit number sequence.

That was the error message I got after 1.54 to 1.57 with the same structure for the password.
Good we Clearly see something wrong with credentials (as you receive a 401 result) plus a crash. Send me the logs and as soon as I come back from this bus trip I ll send you some code to test for password encode decide. Also can you try to type the password in the settings tab then save and capture the log in the mean time? Thx!
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 05, 2013, 05:22:54 am
Good we Clearly see something wrong with credentials (as you receive a 401 result) plus a crash. Send me the logs and as soon as I come back from this bus trip I ll send you some code to test for password encode decide. Also can you try to type the password in the settings tab then save and capture the log in the mean time? Thx!

Sorry, I downgraded to 1.54 again. The plugin triggers "away heat", so it needs to work. With the problem device being my wife's instance, and the wife has a mildly antagonistic relationship with Vera, I can't afford for this to not work as expected for the next few days (getting cold here) :-)
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 05, 2013, 08:05:21 am
Thanks for this great plugin! I helped a bit with the scene in the previous thread, but a plugin is much better and easier to use.

Calculation of my distance from home seems to fail sometimes. I'm 2.2km away from home. The plugin sets my distance to 2.2km as it should, but sometimes the distance is randomly set to -0.00km while i'm still at the same place (2.2km away). The displayed address is still right though, that hasn't changed. After a few (manual) refreshes the distance is suddenly 3.11km, while the displayed address still didn't change so it should still be calculated as 2.2km.

I'm currently using v1.54, but I had the same problem with v1.50. By the way: v1.58 gives the 401 error for me too.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 05, 2013, 08:35:16 am
I am on 1.54, but i think there might still be a problem with distance reporting. In the advanced settings of my wifes iphone, distance is being reported at 1.7 ( and has been at least for 1 hour. I have created a device property for distance for her phone, that is still showing 0.009, and i have refreshed my status report a few times
Title: Re: Plugin - IPhone Locator
Post by: airedale on November 05, 2013, 09:06:18 am
I am on version 1.57 and have a distance setting set for both my wife's phone and my phone that when the distance goes below 3 miles it turns on my garage lights. Then 20 minutes later the lights are set to turn off. I just want them on when we are getting home. These are two different triggers for the same scene.

It seems though that the scene was continually running last night. I was able to see this when I was pulling out of my driveway that evening. I noticed the lights were off, but then all of a sudden turned on. I then went to the scene and looked at the last time the scene was triggered and it was continuing to increment up. My wife's trigger seemed to be affected more often than mine, but both were getting triggered while we were home.

Is anyone else running into this?
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 05, 2013, 09:24:02 am
@airedale

Without seeing the scenes you have or triggers that are enabled, I would imagine you may simply have a trigger for when the distance = less than 3m. The refresh of the iPhone plugin may simply be re-triggering that threshold while you are home. When the refresh comes through, it may simply be picking up another <3m trigger. Especially if the update distance changes ever so slightly. Depending on your polling interval, this may trigger the scene as often as your polling update comes through. With the turn off after 20 minutes piece, it may take at least 20 minutes for the scene to re-trigger since it's technically still running after it is tripped first since you have a delay action on the scene.

My suggestion, look into using PLEG to configure this scene/trigger set. You can also do some things to save on battery life including muting the phone updates while home for longer periods or unmuting when certain other sensors are tripped (doors, garages, etc).
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 05, 2013, 10:26:18 am
Just upgraded to 1.58 and one of my two plugin instances stopped working:

Code: [Select]
0 11/04/13 21:04:26.113 luup_log:224: IPhoneLocator: createChildDevices() <0x300fb680>
50 11/04/13 21:04:26.119 luup_log:224: IPhoneLocator: debug: getAppleDeviceMap for: [apple iCloud username] <0x300fb680>
50 11/04/13 21:04:26.505 luup_log:224: IPhoneLocator: succeed to call fmipservice/device but received 401, Check credentials ? <0x300fb680>
50 11/04/13 21:04:26.507 luup_log:224: IPhoneLocator: ***Response={"res":1,"sta":401,"hea":{"x-responding-server":"st11p02me-fmipservice002_004","x-responding-partition":"p02","set-cookie":"<cookie_id>;path=/;secure;httponly","x-request-uuid":"abf15a89-48f2-416c-a9a2-27c2c5fc62e7-initClient","content-length":"50","x-responding-instance":"fmipservice-10200204-st11p02me-fmipservice002-8004-1T53","date":"Tue, 05 Nov 2013 02:04:25 GMT","server":"Apple-iCloud"}} <0x300fb680>
01 11/04/13 21:04:26.507 LuaInterface::CallFunction_Timer-5 function startupDeferred failed [string "local mime = require('mime')..."]:849: bad argument #1 to 'pairs' (table expected, got nil) <0x300fb680>

This was an upgrade from 1.54 -> 1.58. Looks like the password is somehow not being decoded properly?
The password used for this account is _only_ a combination of alphanumeric characters, i.e. capitalized and non-capitalized letters plus a X-digit number sequence.

That was the error message I got after 1.54 to 1.57 with the same structure for the password.
Good we Clearly see something wrong with credentials (as you receive a 401 result) plus a crash. Send me the logs and as soon as I come back from this bus trip I ll send you some code to test for password encode decide. Also can you try to type the password in the settings tab then save and capture the log in the mean time? Thx!

Just did the upgrade from 1.54 to 1.58 in debug. Everything worked, password encoded can see wifes child devices from iCloud (but have not added them as children). Then after trying to add a child to wifes account "401" error.

So whatever is configured at 1.54 seems to be upgraded properly, until the next refresh (ie: add child)

Add a child to my account, no error in my authentication, but hers is still hosed.

My password pattern is X00x0xxx (Cap, number, number,lowercase,number,lowercase, lowercase, lowercase)
Hers is X0xxxxxx

What are the patterns of those that failed?
Back to 1.54 which is working
Title: Re: Plugin - IPhone Locator
Post by: Mic on November 05, 2013, 10:46:11 am
Thanks for the hard work,
                                          how do you guy setup it to not draining your battery? Also just and idea, would be nice if you could add a button that (play sound) on the iphone, so if you are like me and some time try to find your iphone in the house, i juste have to press the button and the iphone will play sound to find it,

Thanks again
Mike
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 05, 2013, 11:02:13 am
how do you guy setup it to not draining your battery?

 I use a combination of the dynamic polling (my settings: 0:90,0.3:60,1.2:75,2.5:180,5:450,15:900,30:1200,50:1800,100:3000) and i mute my phone while i am at home, and unmute when my porch door is opened. That is working quite well and does not drain the battery too much. I have a scene which polls the phone a few times after being unmuted to see if i really leave the house.
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 05, 2013, 01:52:55 pm

 I use a combination of the dynamic polling (my settings: 0:90,0.3:60,1.2:75,2.5:180,5:450,15:900,30:1200,50:1800,100:3000)

@mikee123: can you explain this dynamic polling settings (numbers above)?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 05, 2013, 02:30:09 pm
@mikee123: can you explain this dynamic polling settings (numbers above)?

From the 1st post in this thread:

PollingMap: Enables a polling duration based on the Distance reported. The polling duration calculated is the minimal of all polling required between all devices managed from this same iCloud account based on the polling map and their respective base location. if empty, dynamic polling follows a simple algorythm: if (Distance>100) the period is 10 times the based period, if Distance>10 the period is 3 times the based period.  if it is filled in, then its format is a COMMA (',') separated list of pairs like dist:polling. Number of pairs/steps is not fixed, up to you. for instance 0:600,1:60,10:300,100:1800 which would mean, if the distance is less than 1, polling will be 600s, if it is between 1 and 10, polling will be 60s, if it is between 10 and 100, polling will be 300s, if it is above 100, polling will be 1800s
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 05, 2013, 03:03:26 pm

From the 1st post in this thread:


Ouch, Could have thought and checked that myself, Noob...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 05, 2013, 06:18:42 pm
I found one problem but I do not believe it explains it all yet.  ???

For those who have a suspected password encrypt issue, here is a potential test.
a) install 1.58 from app store
b) install the file L_IPhone.lua attached to this message ( I fixed the plugin crash, will publish in apps store when I am back home  )
c) in the TEST LUUP Code box try this code ( you can even add your real password in the pwd table ) and check in the logs that you do not have a failure message.


Code: [Select]
local mime = require('mime')
local iPhoneEnc = require('L_IPhoneEnc')

function unitTestPassword()
local pwd = {
"abcdefgh",
"abcde!:/.;?fgh*%",
"abcde,#{[|`\^@",
"abcde\'ghi\"ljl",
                "C0gsdfsdfds",
                "G78f5okj",
"^??&#??@$???"
}
for k,v in pairs(pwd) do
local enc1 = iPhoneEnc.Encrypt(v)
local enc2 = mime.b64(enc1)
local res1 = mime.unb64(enc2)
local res2 = iPhoneEnc.Decrypt(res1)
if (res2==v) then
luup.log(string.format("IPhoneLocator Success: %s : %s : %s : %s : %s",v,enc1,enc2,res1,res2))
else
luup.log(string.format("IPhoneLocator Failure: %s : %s : %s : %s : %s",v,enc1,enc2,res1,res2))
end
end
    return true
end

return unitTestPassword()
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 05, 2013, 06:42:10 pm
@airedale

Without seeing the scenes you have or triggers that are enabled, I would imagine you may simply have a trigger for when the distance = less than 3m. The refresh of the iPhone plugin may simply be re-triggering that threshold while you are home. When the refresh comes through, it may simply be picking up another <3m trigger. Especially if the update distance changes ever so slightly. Depending on your polling interval, this may trigger the scene as often as your polling update comes through. With the turn off after 20 minutes piece, it may take at least 20 minutes for the scene to re-trigger since it's technically still running after it is tripped first since you have a delay action on the scene.

My suggestion, look into using PLEG to configure this scene/trigger set. You can also do some things to save on battery life including muting the phone updates while home for longer periods or unmuting when certain other sensors are tripped (doors, garages, etc).

Looks like there's a bug in the .json file. For the distance triggers to not fire every time the condition is (still is) true, as opposed to "every time the condition becomes true after having been false", I believe we to set the 'norepeat' flag to '1' in the .json event entry for the distance (see the added entry between the "serviceId" and "argumentList".

It was included in my original json patch, but I forgot to call it out explicitly so I think @amg0 may have missed it.

My bad :(

Code: [Select]
"id": 2,
"label": {
"lang_tag": "distance_goes_below",
"text": "Distance goes below"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
        "norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": "<",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_below",
"text": "_DEVICE_NAME_ distance goes below _ARGUMENT_VALUE_ unit"
}
}
]
},
{
"id": 3,
"label": {
"lang_tag": "distance_goes_above",
"text": "Distance goes above"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
"norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": ">",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_above",
"text": "_DEVICE_NAME_ distance goes above _ARGUMENT_VALUE_ unit"
}
}
]
}
Title: Re: Plugin - IPhone Locator
Post by: bucko on November 05, 2013, 08:19:08 pm
Just found a bug with this plugin.

I use Lastpass to log in to my Vera dashboard. This password is different from my iCloud login.

If I log in to Vera UI, and then go into the iPhone Locator plugin, I get the message that my iCloud email is incorrect, so the plugin stops.

Lastpass is replacing my iCloud login info with the Vera UI login automatically, so the plugin fails to log into my iCloud account. This plug in needs to be insulated from being tyed into my Vera UI. Lastpass is detecting the URL address of my Vera when I open the plugin, so it's filling in my Vera login automatically in the iCloud login with the Vera login everytime.

If I do not login to Vera first, then open the iPhone plugin, the iCloud info is intact and the plugin works fine.
So. logging into Vera UI, THEN opening the iPhone plugin breaks it. Somehow you need to lock the iCloud login boxes (with a tick box?).
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 05, 2013, 08:24:16 pm
Just found a bug with this plugin.

I use Lastpass to log in to my Vera dashboard. This password is different from my iCloud login.

If I log in to Vera UI, and then go into the iPhone Locator plugin, I get the message that my iCloud email is incorrect, so the plugin stops.

Lastpass is replacing my iCloud login info with the Vera UI login automatically, so the plugin fails to log into my iCloud account. This plug in needs to be insulated from being tyed into my Vera UI. Lastpass is detecting the URL address of my Vera when I open the plugin, so it's filling in my Vera login automatically in the iCloud login with the Vera login everytime.

If I do not login to Vera first, then open the iPhone plugin, the iCloud info is intact and the plugin works fine.
So. logging into Vera UI, THEN opening the iPhone plugin breaks it. Somehow you need to lock the iCloud login boxes (with a tick box?).

Not sure I agree the problem is the plugin... Being a Lastpass user, the fact that it indiscriminately will enter the password in any field it perceives to be "the field" is more of a Lastpass bug than any other site's bug.

The fix is simple anyway: in Lastpass, turn off auto fill & submit for the Vera URL.
Title: Re: Plugin - IPhone Locator
Post by: airedale on November 05, 2013, 08:57:15 pm
@airedale

Without seeing the scenes you have or triggers that are enabled, I would imagine you may simply have a trigger for when the distance = less than 3m. The refresh of the iPhone plugin may simply be re-triggering that threshold while you are home. When the refresh comes through, it may simply be picking up another <3m trigger. Especially if the update distance changes ever so slightly. Depending on your polling interval, this may trigger the scene as often as your polling update comes through. With the turn off after 20 minutes piece, it may take at least 20 minutes for the scene to re-trigger since it's technically still running after it is tripped first since you have a delay action on the scene.

My suggestion, look into using PLEG to configure this scene/trigger set. You can also do some things to save on battery life including muting the phone updates while home for longer periods or unmuting when certain other sensors are tripped (doors, garages, etc).

Looks like there's a bug in the .json file. For the distance triggers to not fire every time the condition is (still is) true, as opposed to "every time the condition becomes true after having been false", I believe we to set the 'norepeat' flag to '1' in the .json event entry for the distance (see the added entry between the "serviceId" and "argumentList".

It was included in my original json patch, but I forgot to call it out explicitly so I think @amg0 may have missed it.

My bad :(

Code: [Select]
"id": 2,
"label": {
"lang_tag": "distance_goes_below",
"text": "Distance goes below"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
        "norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": "<",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_below",
"text": "_DEVICE_NAME_ distance goes below _ARGUMENT_VALUE_ unit"
}
}
]
},
{
"id": 3,
"label": {
"lang_tag": "distance_goes_above",
"text": "Distance goes above"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
"norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": ">",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_above",
"text": "_DEVICE_NAME_ distance goes above _ARGUMENT_VALUE_ unit"
}
}
]
}

Thanks - I thought the response of using something from PLXX didn't make sense. I tried the PLXX plugins and found that I'd much rather write my own code rather than use them. Creating a hack with it just didn't seem right.

Should I expect it to get resolved in the next release? Also, I have never replaced a .json file. Can I just download, edit and reupload it until it is officially updated?
Title: Re: Plugin - IPhone Locator
Post by: bucko on November 05, 2013, 09:48:13 pm

Not sure I agree the problem is the plugin... Being a Lastpass user, the fact that it indiscriminately will enter the password in any field it perceives to be "the field" is more of a Lastpass bug than any other site's bug.

The fix is simple anyway: in Lastpass, turn off auto fill & submit for the Vera URL.

I understand that part. But AFTER I login to Vera and then open the iPhone plugin, that is when Lastpass will change my iCloud log in. I can only make changes to my iPhone plug in if I remember not to log in to Vera UI first.
Title: Re: Plugin - IPhone Locator
Post by: micasarojo on November 05, 2013, 11:18:03 pm
Hi I get "Invalid google return format" for the four apple devices I am monitoring.  Looking at /var/log/cmh/LuaUPnP.log I see a consistent "You have exceeded your daily request quota for this API" from google.  So -- am I doing something wrong with the polling? (looks like set to 60 by default).  I see an option for dynamic polling but wasn't sure what that did exactly.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 06, 2013, 03:39:15 am
Also, I have never replaced a .json file. Can I just download, edit and reupload it until it is officially updated?

Yes, that's basically the process. Make sure you run the file content through jsonlint.com to make sure you didn't introduce any errors in the syntax too.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 06, 2013, 07:02:54 am
I found one problem but I do not believe it explains it all yet.  ???

For those who have a suspected password encrypt issue, here is a potential test.
a) install 1.58 from app store
b) install the file L_IPhone.lua attached to this message ( I fixed the plugin crash, will publish in apps store when I am back home  )
c) in the TEST LUUP Code box try this code ( you can even add your real password in the pwd table ) and check in the logs that you do not have a failure message.

Here you go. Your 'passwords' are all successfully encrypted. I added one myself which fails. Output:
Code: [Select]
50 11/06/13 13:00:23.074 luup_log:0: IPhoneLocator Success: abcdefgh : 5[
                                                                                T
50 11/06/13 13:00:23.114 luup_log:0: IPhoneLocator Success: abcde!:/.;?fgh*% : 5[
                                                                                        TMJhtn,!&kf : NVsLVBBNSmh0A24sISZrZg== : 5[
                                                                                                                                   TMJhtn,!&kf : abcde!:/.;?fgh*% <0x781f>
50 11/06/13 13:00:23.149 luup_log:0: IPhoneLocator Success: abcde,#{[|`^@ : 5[
                                                                                     T@S<D1 : NVsLVBBAUzwBRDEUBg== : 5[
                                                                                                                       T@S<D1 : abcde,#{[|`^@ <0x781f>
50 11/06/13 13:00:23.185 luup_log:0: IPhoneLocator Success: abcde'ghi"ljl : 5[
                                                                                     TK/3= * : NVsLVBBLFy8zGj0gKg== : 5[
                                                                                                                        TK/3= * : abcde'ghi"ljl <0x781f>
50 11/06/13 13:00:23.213 luup_log:0: IPhoneLocator Success: C0gsdfsdfds : C
50 11/06/13 13:00:23.234 luup_log:0: IPhoneLocator Success: G78f5okj : PV@: Ew5QVkADGy0= : PV@: G78f5okj <0x781f>
50 11/06/13 13:00:23.251 luup_log:0: IPhoneLocator Failure: bla@bla : 6U p : NlUJcBcR : 6U p : bla@b} <0x781f>
50 11/06/13 13:00:23.282 luup_log:0: IPhoneLocator Success: ^??&#??@$??? :
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 06, 2013, 10:55:28 am
Hi I get "Invalid google return format" for the four apple devices I am monitoring.  Looking at /var/log/cmh/LuaUPnP.log I see a consistent "You have exceeded your daily request quota for this API" from google.  So -- am I doing something wrong with the polling? (looks like set to 60 by default).  I see an option for dynamic polling but wasn't sure what that did exactly.

Hi @micasarojo - and welcome.
Do you still have this issue or was this only during your 'testing' of the plugin.
There are a couple of posts in this thread that already cover your problem. In particular have a look at post 173 & 178.
Also the dynamic polling is explained in the very first post.

MJ
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 06, 2013, 11:29:46 am
I can't get this app to work anymore. I tried new version and kept getting error messages so I unistalled app and tried to reinstall version 1.50 since it was final release. It wouldn't save data when I edited device. So I read where everyone was going back to version 1.54 but I still have same problem. I don't get the option to click save changes. What am I doing wrong?
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 06, 2013, 11:43:23 am
I can't get this app to work anymore. I tried new version and kept getting error messages so I unistalled app and tried to reinstall version 1.50 since it was final release. It wouldn't save data when I edited device. So I read where everyone was going back to version 1.54 but I still have same problem. I don't get the option to click save changes. What am I doing wrong?

Hi. There was a similar issue around post 217/218.
Did you reboot your Vera (power off/on) and clear your browser cache [Ctrl]-[F5]?

MJ
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 06, 2013, 12:06:27 pm
Hi. There was a similar issue around post 217/218.
Did you reboot your Vera (power off/on) and clear your browser cache [Ctrl]-[F5]?

MJ

I thought I had... but... I tried again. Restarted Vera and Cleared Cache... and it's working. Thanks MJ
Title: Re: Plugin - IPhone Locator
Post by: airedale on November 08, 2013, 08:43:54 am
I think I might have found another issue with the distance triggers.

First, I did make the update to the JSON file and that helped stop it from triggering while I am at home for the most part.

In one of my scenes I have a push notification set to alert me whenever the lights get turned on outside. That only occurs when the distance goes below X miles for either my phone or my wife's phone (both of which are two separate devices in vera). We were sound asleep, and therefore, were not traveling to cause the distance to trigger.

I went and looked at the scene and it seems to have triggered twice around 3 in the morning (once for each phone). I am wondering if vera reloaded and that is when it triggered something. Both triggers (one for my wife's phone and one for mine) tripped within 15 minutes of each other. I have no other explanation, other than thinking that vera reloaded, but I have no way to confirm since my log files rolled over.

Any thoughts on this?
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on November 08, 2013, 09:20:53 am
My wife's phone has been triggering that she's home when she stops on the way home. It's done this for the past two days. Also in the morning, once she's up and getting ready it triggers that she's home... but she never left. She has an iPhone 4s. I'm wondering if this has something to do with settings on her phone and it's going to sleep or something. I have Iphone 5 and it's been working flawlessly on triggering between when I'm home and when I leave.

Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 08, 2013, 09:27:08 am
My wife's phone has been triggering that she's home when she stops on the way home. It's done this for the past two days. Also in the morning, once she's up and getting ready it triggers that she's home... but she never left. She has an iPhone 4s. I'm wondering if this has something to do with settings on her phone and it's going to sleep or something. I have Iphone 5 and it's been working flawlessly on triggering between when I'm home and when I leave.

You should check the logs to see what the distance was/is while she was home along with what the range value is. If, for the triggers while she's home, the distance stays the same & it's still triggering, it was discussed in a prior post this week. If the distance changes, while she's home, then something else is going on. Could be the iCloud service getting confused or something in the plugin. To decide, debug logs would be needed.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 08, 2013, 12:07:20 pm
My wife's phone has been triggering that she's home when she stops on the way home. It's done this for the past two days. Also in the morning, once she's up and getting ready it triggers that she's home... but she never left. She has an iPhone 4s. I'm wondering if this has something to do with settings on her phone and it's going to sleep or something. I have Iphone 5 and it's been working flawlessly on triggering between when I'm home and when I leave.

Maybe the same problem as I described in reply #301?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 08, 2013, 12:09:48 pm
I think I might have found another issue with the distance triggers.

First, I did make the update to the JSON file and that helped stop it from triggering while I am at home for the most part.

In one of my scenes I have a push notification set to alert me whenever the lights get turned on outside. That only occurs when the distance goes below X miles for either my phone or my wife's phone (both of which are two separate devices in vera). We were sound asleep, and therefore, were not traveling to cause the distance to trigger.

I went and looked at the scene and it seems to have triggered twice around 3 in the morning (once for each phone). I am wondering if vera reloaded and that is when it triggered something. Both triggers (one for my wife's phone and one for mine) tripped within 15 minutes of each other. I have no other explanation, other than thinking that vera reloaded, but I have no way to confirm since my log files rolled over.

Any thoughts on this?

Install the system monitor plugin, now you can detect reboot and reload actions (as triggers). Just let Vera send you a push notification when it reloaded
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 08, 2013, 12:12:54 pm
My wife's phone has been triggering that she's home when she stops on the way home. It's done this for the past two days. Also in the morning, once she's up and getting ready it triggers that she's home... but she never left. She has an iPhone 4s. I'm wondering if this has something to do with settings on her phone and it's going to sleep or something. I have Iphone 5 and it's been working flawlessly on triggering between when I'm home and when I leave.

Maybe the same problem as I described in reply #301?

Possibly... My initial inclination is that the distance changing is an iCloud issue and not a plugin issue, but comprehensive debug logs may help us figure out whether the plugin is at fault.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 08, 2013, 12:43:40 pm
I think I might have found another issue with the distance triggers.

First, I did make the update to the JSON file and that helped stop it from triggering while I am at home for the most part.

In one of my scenes I have a push notification set to alert me whenever the lights get turned on outside. That only occurs when the distance goes below X miles for either my phone or my wife's phone (both of which are two separate devices in vera). We were sound asleep, and therefore, were not traveling to cause the distance to trigger.

I went and looked at the scene and it seems to have triggered twice around 3 in the morning (once for each phone). I am wondering if vera reloaded and that is when it triggered something. Both triggers (one for my wife's phone and one for mine) tripped within 15 minutes of each other. I have no other explanation, other than thinking that vera reloaded, but I have no way to confirm since my log files rolled over.

Any thoughts on this?

Install the system monitor plugin, now you can detect reboot and reload actions (as triggers). Just let Vera send you a push notification when it reloaded

my vera does zWave healing at around 2am each day, I have never checked wether that creates a Luup restart but it could be
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 08, 2013, 12:50:44 pm
@airedale

Without seeing the scenes you have or triggers that are enabled, I would imagine you may simply have a trigger for when the distance = less than 3m. The refresh of the iPhone plugin may simply be re-triggering that threshold while you are home. When the refresh comes through, it may simply be picking up another <3m trigger. Especially if the update distance changes ever so slightly. Depending on your polling interval, this may trigger the scene as often as your polling update comes through. With the turn off after 20 minutes piece, it may take at least 20 minutes for the scene to re-trigger since it's technically still running after it is tripped first since you have a delay action on the scene.

My suggestion, look into using PLEG to configure this scene/trigger set. You can also do some things to save on battery life including muting the phone updates while home for longer periods or unmuting when certain other sensors are tripped (doors, garages, etc).

Looks like there's a bug in the .json file. For the distance triggers to not fire every time the condition is (still is) true, as opposed to "every time the condition becomes true after having been false", I believe we to set the 'norepeat' flag to '1' in the .json event entry for the distance (see the added entry between the "serviceId" and "argumentList".

It was included in my original json patch, but I forgot to call it out explicitly so I think @amg0 may have missed it.

My bad :(

Code: [Select]
"id": 2,
"label": {
"lang_tag": "distance_goes_below",
"text": "Distance goes below"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
        "norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": "<",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_below",
"text": "_DEVICE_NAME_ distance goes below _ARGUMENT_VALUE_ unit"
}
}
]
},
{
"id": 3,
"label": {
"lang_tag": "distance_goes_above",
"text": "Distance goes above"
},
"serviceId": "urn:upnp-org:serviceId:IPhoneLocator1",
"norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "Distance",
"comparisson": ">",
"prefix": {
"lang_tag": "distance",
"text": "Distance"
},
"suffix": {
},
"HumanFriendlyText": {
"lang_tag": "hft_distance_goes_above",
"text": "_DEVICE_NAME_ distance goes above _ARGUMENT_VALUE_ unit"
}
}
]
}

Thanks - I thought the response of using something from PLXX didn't make sense. I tried the PLXX plugins and found that I'd much rather write my own code rather than use them. Creating a hack with it just didn't seem right.

Should I expect it to get resolved in the next release? Also, I have never replaced a .json file. Can I just download, edit and reupload it until it is officially updated?

got it ; will be in next roll out. A question maybe : what about the "present" trigger, should we make the "norepeat": "1" also ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 08, 2013, 01:45:49 pm
I just published a private version : v1.59 with the following changes

We will see if this creates a bit less issues now.

Enjoy!
Title: Re: Plugin - IPhone Locator
Post by: betabob on November 08, 2013, 02:03:39 pm
I just published a private version : v1.59 with the following changes
  • Encryption: too many people had issues, I must find a better encrypt way for password , so for now I returned to a more simple way and people should not have pwd issues any more
  • Fixed the handling of bad credentials errors which was not taken care properly
  • Fixed the Distance trigger to avoid repetition. did the same for the Present trigger
Thank! so far so good, I'll try adding and removing children to my wifes account.
We will see if this creates a bit less issues now.

Enjoy!
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 10, 2013, 06:17:37 am
I just published a private version : v1.59 with the following changes
  • Encryption: too many people had issues, I must find a better encrypt way for password , so for now I returned to a more simple way and people should not have pwd issues any more
  • Fixed the handling of bad credentials errors which was not taken care properly
  • Fixed the Distance trigger to avoid repetition. did the same for the Present trigger

We will see if this creates a bit less issues now.

Enjoy!

Encryption is doing fine now with v1.59. Disabling repetition is a nice addition too. I still have wrong distances though, bouncing between -0.00km and 2.20km without moving my iPhone. Can I help debugging that issue?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 10, 2013, 07:30:17 am
I just published a private version : v1.59 with the following changes
  • Encryption: too many people had issues, I must find a better encrypt way for password , so for now I returned to a more simple way and people should not have pwd issues any more
  • Fixed the handling of bad credentials errors which was not taken care properly
  • Fixed the Distance trigger to avoid repetition. did the same for the Present trigger

We will see if this creates a bit less issues now.

Enjoy!

Encryption is doing fine now with v1.59. Disabling repetition is a nice addition too. I still have wrong distances though, bouncing between -0.00km and 2.20km without moving my iPhone. Can I help debugging that issue?

Enable DEBUG mode ( in control tab ) , reload LUA engine , refresh browser , reproduce your issue and share ( using private mail ) the luaUPnP.log file located in /var/cmh/log of your vera. you also share the file in this forum, but to be sure, search it for your password and if found ,scramble it before sharing. thx
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 10, 2013, 07:53:18 am
If you live somewhere with multiple towers and wifi networks around you, that could be the reason. Indoors, GPS is less reliable (microwaves and physical objects) so apple uses wifi networks to help find the location. If the wifi networks in your area were accurately reported, you'll see better results. If they weren't. Well, then the GIGO principle applies. There were (lots of) issues with location reporting of network hubs initially. It's not all that much better now. I have had to use up to 2miles as my "home location" in the past (and on older phones) and I'd also see "jumping". That was not related to any plugin, it was the phone and API misreporting.

Just a thought.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 10, 2013, 08:50:17 am
I just published a private version : v1.59 with the following changes
  • Encryption: too many people had issues, I must find a better encrypt way for password , so for now I returned to a more simple way and people should not have pwd issues any more
  • Fixed the handling of bad credentials errors which was not taken care properly
  • Fixed the Distance trigger to avoid repetition. did the same for the Present trigger

We will see if this creates a bit less issues now.

Enjoy!

Encryption is doing fine now with v1.59. Disabling repetition is a nice addition too. I still have wrong distances though, bouncing between -0.00km and 2.20km without moving my iPhone. Can I help debugging that issue?

Enable DEBUG mode ( in control tab ) , reload LUA engine , refresh browser , reproduce your issue and share ( using private mail ) the luaUPnP.log file located in /var/cmh/log of your vera. you also share the file in this forum, but to be sure, search it for your password and if found ,scramble it before sharing. thx

Here it is. I/my iPhone didn't move, but distance jumped from 3.111 (time: 11/10/13 14:13:33.835) to 2.2 (time: 11/10/13 14:14:28.832) to -0 (time: 11/10/13 14:15:17.922) km. note that the last value detected is minus (-) 0 km. The actual (text) address that was displayed between the 3.111km and 2.2km value is very close to each other (inaccuracy of 1 street, definitely not 1.111km).
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 10, 2013, 10:11:42 am
Here it is. I/my iPhone didn't move, but distance jumped from 3.111 (time: 11/10/13 14:13:33.835) to 2.2 (time: 11/10/13 14:14:28.832) to -0 (time: 11/10/13 14:15:17.922) km. note that the last value detected is minus (-) 0 km. The actual (text) address that was displayed between the 3.111km and 2.2km value is very close to each other (inaccuracy of 1 street, definitely not 1.111km).

I confirm @sjolshagen's explanation is the most likely cause.
Your phone was reporting stable location until 11/10/13 14:15:17.881 where is suddently changed to 80 meters away.

Code: [Select]
Line 23: 50 11/10/13 14:13:27.134 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 53: 50 11/10/13 14:13:33.806 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 83: 50 11/10/13 14:13:46.354 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 113: 50 11/10/13 14:13:59.331 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 143: 50 11/10/13 14:14:09.497 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 173: 50 11/10/13 14:14:18.939 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 203: 50 11/10/13 14:14:28.826 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 233: 50 11/10/13 14:14:40.299 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 263: 50 11/10/13 14:14:57.624 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8414>
Line 293: 50 11/10/13 14:15:17.881 luup_log:12: IPhoneLocator: debug: saving lat:52.154736 long:4.463503 <0x8818>

I can confirm that this new lat,long information comes from the iCloud response in the json response object. see the PositionType = Wifi. iCloud is telling us your phone was geolocated using a wifi method.

Code: [Select]
"location":{
"timeStamp":1384089316476,
"locationType":null,
"positionType":"Wifi",
"horizontalAccuracy":65.0,
"locationFinished":true,
"isInaccurate":false,
"longitude":4.463503321384106,
"latitude":52.15473596781083,
"isOld":false
},

Not sure there is anything to do about that except maybe extending the range you use for Home base

Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 10, 2013, 10:55:27 am
I confirm @sjolshagen's explanation is the most likely cause.
Your phone was reporting stable location until 11/10/13 14:15:17.881 where is suddently changed to 80 meters away.

Code: [Select]
Line 23: 50 11/10/13 14:13:27.134 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 53: 50 11/10/13 14:13:33.806 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 83: 50 11/10/13 14:13:46.354 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 113: 50 11/10/13 14:13:59.331 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 143: 50 11/10/13 14:14:09.497 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 173: 50 11/10/13 14:14:18.939 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x7c14>
Line 203: 50 11/10/13 14:14:28.826 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 233: 50 11/10/13 14:14:40.299 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8018>
Line 263: 50 11/10/13 14:14:57.624 luup_log:12: IPhoneLocator: debug: saving lat:52.154114 long:4.462909 <0x8414>
Line 293: 50 11/10/13 14:15:17.881 luup_log:12: IPhoneLocator: debug: saving lat:52.154736 long:4.463503 <0x8818>

I can confirm that this new lat,long information comes from the iCloud response in the json response object. see the PositionType = Wifi. iCloud is telling us your phone was geolocated using a wifi method.

Code: [Select]
"location":{
"timeStamp":1384089316476,
"locationType":null,
"positionType":"Wifi",
"horizontalAccuracy":65.0,
"locationFinished":true,
"isInaccurate":false,
"longitude":4.463503321384106,
"latitude":52.15473596781083,
"isOld":false
},

Not sure there is anything to do about that except maybe extending the range you use for Home base

I can live with the inaccuracy of 80m. But what about the -0.0km? long/lat are still > 2km away from home, but distance says -0.0km sometimes...

from the log when plugin indicates -0.0km:
50   11/10/13 16:51:00.550   luup_log:12: IPhoneLocator: debug: saving lat:52.153732 long:4.460379 <0x1807>

my home location as set in the plugin:
lat: 52.147291 long: 4.478986

Planning a route on google maps between those 2 locations gives me a route of 2.5km...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 10, 2013, 11:19:47 am
I can live with the inaccuracy of 80m. But what about the -0.0km? long/lat are still > 2km away from home, but distance says -0.0km sometimes...

from the log when plugin indicates -0.0km:
50   11/10/13 16:51:00.550   luup_log:12: IPhoneLocator: debug: saving lat:52.153732 long:4.460379 <0x1807>

my home location as set in the plugin:
lat: 52.147291 long: 4.478986

Planning a route on google maps between those 2 locations gives me a route of 2.5km...

I have put a math.abs() in the code to make sure we do not get negative values. However, the distance between the 2 points you give is 1.46km , cf http://boulter.com/gps/distance/?from=52.153732+4.460379+&to=52.147291+4.478986&units=k

If you have a doubt, please send me the debug file again with the complete sequence so I can look it in further. in order to do os , please:

1- install the latest V1.59 from the store ( the beta2 one, I just uploaded it )
2- then install the file attached which includes the patch for math.abs()
3- let me know + and/or capture a log in DEBUG mode

thx !
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 11, 2013, 10:23:10 am
I installed 1.59 beta 2 last night. Did you change anything in how the plugin reacts when unmuted ? My plugin is muted while at home, and a scene runs when the porch door is opened to detemine if i am leaving. This has worked fairly well, but after the upgrade first time for quite a while when i arrived at work the phone was still 'present' and 'muted'. A manual unmute solved the problem, but i wonder if that has anything to do with changes since 1.59
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 11, 2013, 11:33:19 am
I installed 1.59 beta 2 last night. Did you change anything in how the plugin reacts when unmuted ? My plugin is muted while at home, and a scene runs when the porch door is opened to detemine if i am leaving. This has worked fairly well, but after the upgrade first time for quite a while when i arrived at work the phone was still 'present' and 'muted'. A manual unmute solved the problem, but i wonder if that has anything to do with changes since 1.59

hummm, are you using the "Present" variable trigger ? The one change I can think of is that I made the Distance and the Present trigger as "no repeat" ( cf discussion earlier ) , which I believe is the correct behavior

no change to behavior when the device is unmuted. Meaning, it finds the root device, then updates the icons of all root & children and force a refresh of position.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 11, 2013, 12:00:05 pm
I see what you mean by
Quote
I made the Distance and the Present trigger as "no repeat" ( cf discussion earlier ) , which I believe is the correct behavior
and i think you are right. That cannot have caused it. I was referring to my iphonelocator device showing present and being muted. It also showed last update 6:03 which is when i left the house, after that it should have tried updating my location for another 10 minutes to detemine if i leave (that is a scen doing the forced refreshes triggered by the porch door). AT the moment this scene triggers 4 unmutes followed by forced refreshes within 10 minutes. Maybe i have to increase that.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 11, 2013, 12:34:14 pm
@mikee123

Mind sharing the scene that you are using? I'm assuming it's PLEG like mine. Perhaps might help to see the logic being used, may be an optimal way to set it to not run into the problem you indicated. I've run into something similar where I now have a scene to disarm the alarm when I'm home, but when I'm leaving I need to wait until the plugins finds me not home before it can successfully be armed when I leave. So it's a bit of a race condition that just needs logic to avoid. Now it's all good. Might be something similar for you.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 11, 2013, 12:41:14 pm
@shmixx

Unfortunately no easy way of posting it (unless there is a way of posting scene actions). I am using PLEG to determine if the porch door has been opened, and i am at home, or Ping has not been triggered in 10 mins. This as a condition triggers my 'unmute' scene, which unmutes the phone, a few seconds later forces a refresh, a couple of mins later unmutes, then again a few seconds later next refresh and so on. I have done this with a normal scene, by clicking on the iphonelocators unmute and refresh buttons, and in manage delays add necessary delays. If there is an easier way of posting this let me know, i am more than happy to share my settings. Buts its all quite extensive as we have 2 iphones, and trying to cater for most eventualities is quite complex
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 11, 2013, 01:56:24 pm
In the PLEG device, on the first screen, choose the Status button. It will open a pop-up that you can see to show you all your triggers, conditions, actions, etc. If you can post the report, this will help illustrate your setup. If there is a lot of other actions in there, perhaps just trim it down and we can take a stab. I've got something similar (as I think we've both discussed in threads) for my setup, and might be able to offer some insight there.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 11, 2013, 03:11:48 pm
@shmixx

Sorry i misunderstood you. I thought you just wanted the scene i use. Here is my PLEG:

Lighting PLEG
Device ID: 2212013-11-11 19:42:43.065 PLC Version: 5.3
________________________________________
Triggers
Name   Description   Last Trigger   State
Mikehome   (*)Mike is present   2013-11-11 14:33:38.300    true
PingMike   Ping Mike is Tripped   2013-11-11 19:42:10.249    true
Porchdooropen   Porch door is tripped   2013-11-11 19:15:32.692    false
PingJust   Ping Justine is Tripped   2013-11-11 19:32:10.254    false
AutohomeON   MultiSwitch 2 Switch 6 is turned on   2013-11-10 00:06:33.367    true

Device Properties
Name   Device Name   Device Variable   Last Change   Value
Mdistance1   (*)Mike   Distance   2013-11-11 19:41:26.859    0.008
Jdistance   (*)Justine?s iPhone   Distance   2013-11-11 19:25:39.373    0.005
Mdirection   (*)Mike   IconCode   2013-11-11 19:25:20.105    100
Jdirection   (*)Justine?s iPhone   IconCode   2013-11-11 19:32:01.201    50
________________________________________
Conditions
Name   Expression   Last True   State
Patiodoor   Patio_door_opened   0   false
Mikeaway   Mdistance1 > 0.4   2013-11-11 14:02:23.858    false
Jgoingaway   (Jdirection == 25)   2013-11-10 15:10:32.188    false
Mhome   Mikehome and PingMike   2013-11-11 19:42:10.287    true
Jhome   Justhome and PingJust   2013-11-11 19:32:10.408    false
Mcomhome   (Mdirection == 75) and Mdistance1 < 1.2   2013-11-11 14:29:41.083    false
Jcomhome   (Jdirection == 75) and Jdistance < 1.2   2013-11-08 14:43:48.230    false
Jmute   (Jhome; NOW > 310) and Justhome   2013-11-11 19:38:01.130    true
Mmute   (Mhome; NOW > 310) and Mikehome   2013-11-11 19:25:01.142    false
Mcomdark   (Mcomhome or Jcomhome) and Dark   2013-11-08 19:26:12.203    false
Porchopen   Porchdooropen   2013-11-11 19:15:32.738    false
Junmute   (Porchopen and Justhome) or NopingJ   2013-11-11 19:15:32.742    false
Munmute (Porchopen and Mikehome) or NopingM   2013-11-11 19:15:32.747    false
AutoAway    (NOT Mikehome) and (NOT Justhome)   2013-11-09 19:00:54.324    false
AutoAway5m   AutoAway and (AutoAway; NOW > 5:00)   2013-11-09 19:06:30.226    false
Mhomelights   (Mcomhome;Mikehome < 30:00) and Dark   2013-11-11 16:18:12.169    true
AutoHome   (Mcomhome or Jcomhome or Justhome or PingJust or PingMike or Mikehome) and NOT AutohomeON   2013-11-10 00:06:33.244    false
Justaway   Jdistance > 0.4   2013-11-10 15:10:31.836    false
Mikenotnear   (Mcomhome;Mgoingaway < 3:00) or Mdistance1 > 2.5   2013-11-11 07:57:45.560    false
Mcomhometrue   Mcomhome and (Mcomhome; NOW > 2:00)    2013-11-11 14:32:39.200    false
Mgoingaway   (Mdirection == 25)   2013-11-11 14:02:24.009    false
NopingJ   (PingJust and (PingJust; Now < 10:00))   2013-11-11 19:33:01.169    false
NopingM   (PingMike and (PingMike; Now < 10:00))   2013-11-11 19:41:01.190    false
Justnotnear   (Jcomhome;Jgoingaway < 3:00) or Jdistance > 2.5   2013-11-10 15:10:31.854    false
Jhomelights   (Jcomhome;Justhome < 30:00) and Dark   2013-11-08 16:22:52.191    false
________________________________________
Actions
Actions for Condition: Patiodoor
Immediate
Device   Action   Arguments
Lighting PLEG   RunScene   SceneNameOrNumber=63
Actions for Condition: Mcomhome
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus3   newStatus3=1
Actions for Condition: FDmotion
Immediate
Device   Action   Arguments
Lighting PLEG   RunScene   SceneNameOrNumber=88
Actions for Condition: Jmute
Immediate
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=1
Actions for Condition: Mmute
Immediate
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=1
Actions for Condition: Mcomdark
Immediate
Device   Action   Arguments
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=100
Delay 01:30
Device   Action   Arguments
Porch light   SetLoadLevelTarget   newLoadlevelTarget=100
Actions for Condition: Junmute
Immediate
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 02:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 02:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 03:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 05:00
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 05:45
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 07:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 09:45
Device   Action   Arguments
(*)Justine?s iPhone   SetMute   newMuteStatus=0
Delay 10:00
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Delay 10:05
Device   Action   Arguments
(*)Justine?s iPhone   ForceRefresh   PresentStatus=0
Actions for Condition: Munmute
Immediate
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=0
Delay 02:45
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Delay 03:00
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=0
Delay 03:10
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Delay 05:45
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Delay 06:00
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=0
Delay 07:00
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Delay 09:45
Device   Action   Arguments
(*)Mike   SetMute   newMuteStatus=0
Delay 10:00
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Delay 10:05
Device   Action   Arguments
(*)Mike   ForceRefresh   PresentStatus=0
Actions for Condition: AutoAway5m
Immediate
Device   Action   Arguments
Lighting PLEG   RunScene   SceneNameOrNumber=84
MultiSwitch 2   SetStatus5   newStatus5=1
MultiSwitch 2   SetStatus6   newStatus6=0
Actions for Condition: AutoHome
Immediate
Device   Action   Arguments
Lighting PLEG   RunScene   SceneNameOrNumber=85
MultiSwitch 2   SetStatus5   newStatus5=0
MultiSwitch 2   SetStatus6   newStatus6=1
Actions for Condition: Mhomelights
Delay 05:00
Device   Action   Arguments
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=0
Porch light   SetLoadLevelTarget   newLoadlevelTarget=0
Actions for Condition: Mhome
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus8   newStatus8=1
MultiSwitch 2   SetStatus7   newStatus7=0
MultiSwitch 2   SetStatus3   newStatus3=0
Actions for Condition: Jhome
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus2   newStatus2=1
MultiSwitch 2   SetStatus1   newStatus1=0
MultiSwitch 2   SetStatus4   newStatus4=0
Actions for Condition: Jcomhome
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus4   newStatus4=1
Actions for Condition: Justaway
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus2   newStatus2=0
MultiSwitch 2   SetStatus1   newStatus1=1
Actions for Condition: Mikeaway
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus7   newStatus7=1
MultiSwitch 2   SetStatus8   newStatus8=0
Actions for Condition: Mikenotnear
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus3   newStatus3=0
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=0
Porch light   SetLoadLevelTarget   newLoadlevelTarget=0
Actions for Condition: Mcomhometrue
Delay 03:00
Device   Action   Arguments
Porch light   SetLoadLevelTarget   newLoadlevelTarget=0
Actions for Condition: Justnotnear
Immediate
Device   Action   Arguments
MultiSwitch 2   SetStatus4   newStatus4=0
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=0
Porch light   SetLoadLevelTarget   newLoadlevelTarget=0
Actions for Condition: Jhomelights
Delay 05:00
Device   Action   Arguments
Front door lights   SetLoadLevelTarget   newLoadlevelTarget=0
Porch light   SetLoadLevelTarget   newLoadlevelTarget=0

Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 11, 2013, 03:47:18 pm
@mikee123

Wow, thats a lot of PLEG!!  :o

I think overall there is a lot going on that you have there, and it's possible that something in the PLEG logic is behaving differently rather than the iPhone plugin. I've been using the PLEG and this plugin, and the mute/unmute has been working pretty well. In fact, when messing with my PLEG I actually had some issues, not the plugin.

That said, some thoughts I have on the logic:

Delays - I would look at potentially just letting the PLEG do it's thing for the timing of refreshes for your default distance when the user gets home and let the 10 minute window runs itself. Instead of manually choosing to force refreshes, and force an unmute. This can help reduce some of the difficulty in the PLEG as well with different items you have listed through there. The battery drain from the 10 minutes with even a rapid 30 second refresh time on the plugin will not be so drastic. Once you know there hasn't been movement enough for 10 minutes, you can mute the plugin until that door gets tripped.

Ping usage - If I'm correct, this plugin is designed for iPhones. The downside to iPhone as I've found, is the PING plugin doesn't really work that well once the device goes to sleep. I started to try and test this, but wasn't pleased with the output so I decided to ignore using it in my logic as it didn't really help too much.

Leveraging Door Sensors - there is a particular door that can be used as a trigger for things like (lights coming on, alarm disarm, etc) I would leverage those to help reduce the need for tracking you coming home. I thought through it in most cases, and outside of the wife being upstairs and all downstairs lights being off, wanting to have lights come on in kitchen when I get home, I leveraged a door sensor instead of my distance shrinking and arriving home. Also, it allows me to save on iPhone battery when either of us is not home, because I essentially mute BOTH phones when not home.

Obviously these thoughts are my own and geared toward my own setup and optimizations. Your situation may vary and needs obviously are different. Just wanted to offer some thoughts to help make it a bit slimmed down and optimized where possible.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 11, 2013, 05:43:52 pm
@shmixx

It is always good to see what other people do, gives you ideas of how to do things different, even if your needs are different i find, so i always appreciate comments and ideas.
With the ping sensor, i have 2 iphones, and as far as i can tell, even when the phones have not been touched for a couple of hours, the ping sensor still triggers every few minutes, so for me it works quite well to say if it has not been triggered for at least 10 minutes unmute the phone and check location. So far i have not seen any instance of the ping sensor not triggering while we were in. So for me it works very well and is a good extra indicator if one of us have left the house. We have a jailbroken iphone 4 and a 4s.

What i would like to understand better is this:

Quote
Delays - I would look at potentially just letting the PLEG do it's thing for the timing of refreshes for your default distance when the user gets home and let the 10 minute window runs itself. Instead of manually choosing to force refreshes, and force an unmute.

I am not sure i can follow you there but would like to, as this might really be a better way of doing things. And even if it wasnt, it gives you an alternative. Could you try to explain/show what you mean or do you have an example of how you solve this problem of muting/unmuting ?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 12, 2013, 04:02:59 am
I have put a math.abs() in the code to make sure we do not get negative values. However, the distance between the 2 points you give is 1.46km , cf http://boulter.com/gps/distance/?from=52.153732+4.460379+&to=52.147291+4.478986&units=k

If you have a doubt, please send me the debug file again with the complete sequence so I can look it in further. in order to do os , please:

1- install the latest V1.59 from the store ( the beta2 one, I just uploaded it )
2- then install the file attached which includes the patch for math.abs()
3- let me know + and/or capture a log in DEBUG mode

thx !

Thanks for the update. Unfortunately this didn't help. There still is a negative value (-0), and the plugin sometimes says that I'm home while being > 1km away from home.

Code: [Select]
50 11/12/13 9:55:08.790 luup_log:12: IPhoneLocator: debug: saving lat:52.154446 long:4.463646 <0x1807>
06 11/12/13 9:55:08.791 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevLat was: 52.1544 now: 52.1544 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x1807>
06 11/12/13 9:55:08.792 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevLong was: 4.46362 now: 4.46365 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x1807>
06 11/12/13 9:55:08.794 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: CurLat was: 52.1544 now: 52.1544 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x1807>
06 11/12/13 9:55:08.795 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: CurLong was: 4.46365 now: 4.46365 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x1807>
50 11/12/13 9:55:08.796 luup_log:12: IPhoneLocator: debug: distanceBetween(52.147291, 4.478986, 52.1544, 4.46365, Km) <0x1807>
50 11/12/13 9:55:08.798 luup_log:12: IPhoneLocator: debug: distanceBetween returns: abs(0) <0x1807>
06 11/12/13 9:55:08.799 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: PrevDistance was: -0 now: -0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x1807>
06 11/12/13 9:55:08.799 Device_Variable::m_szValue_set device: 12 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Distance was: -0 now: -0 #hooks: 0 upnp: 0 v:0x850170/NONE duplicate:1 <0x1807>
50 11/12/13 9:55:08.801 luup_log:12: IPhoneLocator: Device Status(12): in Home <0x1807>

http://boulter.com/gps/distance/?from=52.147291%2C+4.478986&to=52.1544%2C+4.46365&units=k gives a distance of 1.31km.

Please let me know if you need more logs!
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 12, 2013, 05:59:03 am
Update: I modified L_IPhone.lua and replaced the formula in the distanceBetween function with the one I used in my old scene (the other thread). I'm still using v1.58b2. Fyi: Formula used is the Haversine Formula.

Code: [Select]
function distanceBetween(lat1, lon1, lat2, lon2, distance_unit)
        local R = 6378.137
        local dLat = (lat2 - lat1) * math.pi / 180
        local dLon = (lon2 - lon1) * math.pi / 180
        local a = math.sin(dLat/2) * math.sin(dLat/2) +
                math.cos(lat1 * math.pi / 180) * math.cos(lat2 * math.pi / 180) *
                math.sin(dLon/2) * math.sin(dLon/2)
        local c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
        local d = R * c
        if distance_unit == "Km"  then
                dist = d
        elseif (distance_unit == "Nm") then
                dist = d * 0.5399568034557
        elseif (distance_unit == "Mm") then
                dist = d * 0.6213711922373
        end
        return dist
end

This seems to work much better in my case. Distance is now reported as 1.32km instead of -0 or 2.20km, which seems to be much more accurate: as said in my previous post http://boulter.com/gps/distance/?from=52.147291%2C+4.478986&to=52.1544%2C+4.46365&units=k gives a distance of 1.31km. The -0 problem seems to be solved too now, but I'll keep an eye on it! I included Mm and Nm, these values seem to be ok too.

My conclusion so far: the current formula used doesn't seem to work in all cases. I hope this one works for everybody!
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 12, 2013, 10:09:18 am
Just installed the plugin. When I try and enter mt iCloud email I get an error saying it's not correct.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 12, 2013, 11:20:45 am
@shmixx

What i would like to understand better is this:

Quote
Delays - I would look at potentially just letting the PLEG do it's thing for the timing of refreshes for your default distance when the user gets home and let the 10 minute window runs itself. Instead of manually choosing to force refreshes, and force an unmute.

I am not sure i can follow you there but would like to, as this might really be a better way of doing things. And even if it wasnt, it gives you an alternative. Could you try to explain/show what you mean or do you have an example of how you solve this problem of muting/unmuting ?

Unfortunately I somehow screwed up my current PLEG that has this listed in it and can't copy/paste the conditions I'm using, but will try to describe until I get it back up and working. I mention this to illustrate that my PLEG syntax below, may be a bit off, so please be careful and evaluate the syntax as you place it. And of course test to verify functionality.

The way I leveraged it, is using the Polling map setting as you would, in my case I want to be as close to accurate of when I get home, so my poll map is: 0:30,0.5:60,2:120,10:300,30:900,50:1800. This means the common polling when I'm home and unmuted, will be 30 seconds. I'll adapt my scenario explanation using 10 minutes as this is the timeframe it looks like you are using.

I created essentially 2 iPhone triggers (present/away), and 2 triggers for the doors (door sensors to be tripped whether armed or not, Side/Front). From here I configured 3 conditions: Mute1, Mute2, Unmute. The goal here is when the iPhone is seen as present, this essentially starts Mute1. Mute1 = iPhoneHome AND (iPhoneHome; NOW > 10:00). This will leave your phone being refreshed every 30 seconds, until you hit the 10 minute threshold, in which case the Mute condition will be satisfied and Action should be to mute the phone.

The second condition to understand here is the Unmute. Unmute = (SideTrip OR FrontTrip OR iPhoneAway). This will have an Action of unmuting the iPhone device signaling that you may be leaving. For me sometimes I just open the front door to let the dog out. So it just opens up the polling again on my phone for the next 5 minutes to basically see if I actually leave. If not, then the Mute2 comes into play.

Mute 2 = iPhoneHome AND (Unmute; NOW > 10:00). This will identify if you haven't left after opening the door, and an associated Action of Muting the iPhone plugin again will put you back into mute mode.

So instead of setting constant delays, you can take advantage of the built in function of the plugin, and leverage PLEG to just mute/unmute based on the timeframes set in the conditions. Personally, I use 5 minutes and that is enough time for me to open the door, get out of the house, and break the distance barrier set in my iPhone plugin settings. Keep in mind as well, that every time you open the door (maybe forgot your keys and run back inside, or forgot to arm the alarm (hopefully its in Vera!  :o )) that this will reset the timer basically because Unmute condition should become false once the door closes. Alternatively, you can add _ConditionName to make it evaluate EVERY time in the case of perhaps an actual garage door or something.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 12, 2013, 01:48:44 pm
Just installed the plugin. When I try and enter mt iCloud email I get an error saying it's not correct.

email is controlled by a javascript regular expression . do you use an email address that is fitting that regular expression ( ? ). the workaround is to enter the email address directly into the advanced tab

Code: [Select]
function goodemail(email)
{
var reg = new RegExp('^[a-z0-9]+[_|\.|-]?([a-z0-9_]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
return(reg.test(email));
}
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 12, 2013, 01:51:16 pm
Update: I modified L_IPhone.lua and replaced the formula in the distanceBetween function with the one I used in my old scene (the other thread). I'm still using v1.58b2. Fyi: Formula used is the Haversine Formula.

Code: [Select]
function distanceBetween(lat1, lon1, lat2, lon2, distance_unit)
        local R = 6378.137
        local dLat = (lat2 - lat1) * math.pi / 180
        local dLon = (lon2 - lon1) * math.pi / 180
        local a = math.sin(dLat/2) * math.sin(dLat/2) +
                math.cos(lat1 * math.pi / 180) * math.cos(lat2 * math.pi / 180) *
                math.sin(dLon/2) * math.sin(dLon/2)
        local c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
        local d = R * c
        if distance_unit == "Km"  then
                dist = d
        elseif (distance_unit == "Nm") then
                dist = d * 0.5399568034557
        elseif (distance_unit == "Mm") then
                dist = d * 0.6213711922373
        end
        return dist
end

This seems to work much better in my case. Distance is now reported as 1.32km instead of -0 or 2.20km, which seems to be much more accurate: as said in my previous post http://boulter.com/gps/distance/?from=52.147291%2C+4.478986&to=52.1544%2C+4.46365&units=k gives a distance of 1.31km. The -0 problem seems to be solved too now, but I'll keep an eye on it! I included Mm and Nm, these values seem to be ok too.

My conclusion so far: the current formula used doesn't seem to work in all cases. I hope this one works for everybody!

I tried and it works fine for me so I will include this code in the next release. Thx for the contribution
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 12, 2013, 02:22:18 pm
Just installed the plugin. When I try and enter mt iCloud email I get an error saying it's not correct.

email is controlled by a javascript regular expression . do you use an email address that is fitting that regular expression ( ? ). the workaround is to enter the email address directly into the advanced tab

Code: [Select]
function goodemail(email)
{
var reg = new RegExp('^[a-z0-9]+[_|\.|-]?([a-z0-9_]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
return(reg.test(email));
}

my email is lastname.firstname.middleinitial@gmail.com.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 12, 2013, 02:29:40 pm
Just installed the plugin. When I try and enter mt iCloud email I get an error saying it's not correct.

email is controlled by a javascript regular expression . do you use an email address that is fitting that regular expression ( ? ). the workaround is to enter the email address directly into the advanced tab

Code: [Select]
function goodemail(email)
{
var reg = new RegExp('^[a-z0-9]+[_|\.|-]?([a-z0-9_]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
return(reg.test(email));
}

my email is lastname.firstname.middleinitial@gmail.com.

This might be a more generic regexp:

Code: [Select]
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$
Or if you wanted to follow the official RFC you would have to use the following monstrosity:

Code: [Select]
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
;)

source: http://blog.trojanhunter.com/2012/09/26/the-best-regex-to-validate-an-email-address/
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 12, 2013, 04:54:52 pm
Just released v1.59 beta5 ( hoping to make a public release 1.60 someday 8)  ) on, http://apps.mios.com/test-plugin.php?id=4686&show=versions

Contents:

Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 12, 2013, 04:58:35 pm
...
Or if you wanted to follow the official RFC you would have to use the following monstrosity:

Code: [Select]
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
;)

source: http://blog.trojanhunter.com/2012/09/26/the-best-regex-to-validate-an-email-address/

yep , there are some things like that, that I have given up learning, ever... things like regexp, LUA :)
I have taken the non-monster one in the code.

Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 12, 2013, 08:33:38 pm
I'm still confused as to why my email address is giving the "not correct" error. I tried updating to the latest beta and am still getting the message. I don't know enough about programming to know how to manually add my email address.
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 12, 2013, 08:57:09 pm
I'm still confused as to why my email address is giving the "not correct" error. I tried updating to the latest beta and am still getting the message. I don't know enough about programming to know how to manually add my email address.

@amg0 has to look into this.
But for now you can go to the [Advanced] tab of the plugin and scroll down until you find the [Email] field. There you can enter your mail address directly. Leave this field by pressing [Tab] key, close the plugin and then press the big, red [Save] button in the top right corner. Once Luup has restarted, check the plugin and log again for success.

Edit: Did you install the latest version v1.59 Beta 5 - as @amg0 has changed the regular expression for checking proper input.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 13, 2013, 02:57:46 am
I'm still confused as to why my email address is giving the "not correct" error. I tried updating to the latest beta and am still getting the message. I don't know enough about programming to know how to manually add my email address.

The regex in reply #357 should handle your mail-address, so v1.59b5 should work for you. Are you using capitals in your email-address? Then don't, just try typing it (completely) lower-case in the plugin settings. If the problem persists then please share your email address by private message to find out what goes wrong.
Title: Re: Plugin - IPhone Locator
Post by: ccantie on November 13, 2013, 06:03:53 am
Hello,
It works fine but I have something strange.
In the log I see : luup_log:180: IPhoneLocator: [string "..."]:367: Unexpected character at Line 3 character 18: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
And the devide says Invalid google return format.
I have three Ipads two are at home and one near Paris, I think that it is from this that occurs the error.
Do you know this error ?
It's occurs only during the day when my wife is at work.
Claude
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 13, 2013, 07:05:15 am
@shmixx

I have tried what you suggested. I have these polling settings: 0:90,0.3:50,1.2:60,2.5:150,5:450,15:900,30:1200,50:1800,100:3000

I have disabled my manual polling, and just unmuted for 10 minutes. Did not work for me, I left the house, arrived at work but my plugin was muted again, and i was still present. Now i am trying a combination, have the phone unmuted, and also a few manual refreshes within these 10 minutes. Would still like to see your PLEG status once youre up and running again
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 13, 2013, 07:07:04 am
Hello,
It works fine but I have something strange.
In the log I see : luup_log:180: IPhoneLocator: [string "..."]:367: Unexpected character at Line 3 character 18: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
And the devide says Invalid google return format.
I have three Ipads two are at home and one near Paris, I think that it is from this that occurs the error.
Do you know this error ?
It's occurs only during the day when my wife is at work.
Claude

I guess the plugin only polls Google for an address if you added the device in the plugin. Are you tracking all 3 ipads with vera or only one? There should be an exception in the log too which could be helpful, please post that exception here.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 13, 2013, 01:04:44 pm
Hello,
It works fine but I have something strange.
In the log I see : luup_log:180: IPhoneLocator: [string "..."]:367: Unexpected character at Line 3 character 18: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
And the devide says Invalid google return format.
I have three Ipads two are at home and one near Paris, I think that it is from this that occurs the error.
Do you know this error ?
It's occurs only during the day when my wife is at work.
Claude

Here is my suspicion of what happens:

We have seen that sometime google is not able to decode properly a lat,long position and returns some empty result. that , in the past , used to crash the plugin code as the JSON decoding was failing.  Now the plugin code is protecting itself from this by a lua xpcall( function() )   which essentially is a way to catch any error happening inside the function. I, then log the error in the log file for reference.

so , the plugin is not crashing , it is detecting google could not reply, it is updating your device with the message "Invalid google return format" and life goes on.
Code: [Select]
--local obj = json.decode(str) ==> can crash, call it in protected mode. Thx @sjolshagen for the hint !
local res,obj = xpcall( function () local obj = json.decode(str) return obj end , log )
if (res==true) then
if (obj.status=="OK") then  -- google success
address=formatAddress(targetdevice,obj)
else
address="Google returned an error"
debug("getAddressFromLatLong obj.status is not ok. json string was:"..str)
end
else
-- pcall returned false
address="Invalid google return format"
UserMessage(address)
log("Exception: json.decode("..str..") failed")
end

we can verify this whole story more precisely by a) looking at DEBUG version of logs and b) precisely taking the lat, long at the time this happened and directly call the google web service http://maps.googleapis.com/maps/api/geocode/json?latlng=<yourlat>,<yourlong>&sensor=false (http://maps.googleapis.com/maps/api/geocode/json?latlng=<yourlat>,<yourlong>&sensor=false)
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 13, 2013, 04:42:13 pm
@shmixx

I have tried what you suggested. I have these polling settings: 0:90,0.3:50,1.2:60,2.5:150,5:450,15:900,30:1200,50:1800,100:3000

I have disabled my manual polling, and just unmuted for 10 minutes. Did not work for me, I left the house, arrived at work but my plugin was muted again, and i was still present. Now i am trying a combination, have the phone unmuted, and also a few manual refreshes within these 10 minutes. Would still like to see your PLEG status once youre up and running again
@Mikee123 - back up and running thanks to RichardT. I should have known it would be as simple as restoring form a backup. Though I had some quirkiness trying to restore using Safari. Learned my lesson. ;)

Here is the PLEG code I use:

TRIGGERS
TShawnAway    (*)Destiny is away   2013-11-13 12:46:52.595   false
TShawnHome    (*)Destiny is present   2013-11-13 15:49:20.857   true
TTarynAway    (*)Taryn?s iPhone is away   2013-11-13 12:06:15.306   false
TTarynHome    (*)Taryn?s iPhone is present   2013-11-13 12:06:25.395   true
TGarageDoor    Zone #11 - Garage Door is tripped   2013-11-13 15:51:46.337   false
TFrontDoor    Zone #9 - Front Door is tripped   2013-11-13 15:50:46.647   false
TArmed    Alarm Panel is ARMED   2013-11-12 22:35:06.517   false

CONDITIONS
CPhoneMuteOn1   (TShawnHome AND (TShawnHome; Now > 5:00)) OR (TTarynHome AND (TTarynHome; Now > 5:00))   2013-11-10 16:14:19.135   true
CPhoneMuteOn2   (TShawnHome AND (CPhoneMuteOff; Now > 5:00)) OR (TTarynHome AND (CPhoneMuteOff; Now > 5:00))   2013-11-13 15:57:03.152   true
CPhoneMuteOff   TFrontDoor OR TGarageDoor OR TArmed   2013-11-13 15:51:46.377   false

CPMO1 - Senses whether either 1 of us is home for more than 5 minutes. If so, Action is to mute.
CPMO2 - Senses when the garage side door or the front door are opened (CPhoneMuteOff) or if the Alarm is arms, and one of us is STILL home for 5 minutes.
CPMOFF - Basically is the trip to unmute the phone until my CPMO2 condition is met and mutes the phone again.

Keep in mind you leverage the distance function to do some things like turn lights on so you may want to split up the conditions for yourself and the significant other so as not to mute both phones. One important note, when I finally enabled this and got it running, since I was working on it at home, my first condition was always true already and the current states may not line up properly. I had to just open a door to trigger CPMOFF to get it into sync and get them functioning properly. The other important note, is not to go solely by the times reported in Status in the PLEG, as that was a mistake of mine. Using the NOW function, doesn't always update the time states.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 14, 2013, 07:58:10 am
Ok so I think I finally got the plugin installed and configured correctly. Now I'm trying to figure out what to do with it. Anyone have any suggestions on ways to use the plug in?
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 14, 2013, 09:12:38 am
@seannymurrs

Have you looked at this thread ? One example is in the post just above yours....
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 14, 2013, 09:45:45 am
Ok so I think I finally got the plugin installed and configured correctly. Now I'm trying to figure out what to do with it. Anyone have any suggestions on ways to use the plug in?
He, he, you're a funny one ... installs a piece of software without knowing what to do with it ...  ;)

The simpler use would be just to automatically lock your door/garage when you leave home; have the driveway gate open, the driveway/porch lights turn on, the garage door open, the door unlocked when you approach home; arm/disarm alarm ...
You could of course spy on or your wife's whereabouts  :P. But then a more practical use could be to see (have peace of mind) when your kids arrive safely at school or back at home ...
See where you have been for how long all day ...

Just use your imagination - there a many applications for it ...
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 14, 2013, 10:01:14 am
Agreed, I'm slowly working my way toward having the house alarm itself when both of us leave, and disarm when we come home. Also configuring the thermostats to drop the temperatures using the ESM function built into my thermostats when we are both gone as well to cut down on costs. Of course there are plenty of things you can do here. Eventually when I get the garage doors setup with sensors and open/close, I'll be setting those to automatically open/close for us too based on locations and timers. OR at least a notification. Let your mind wander, and the PLEG logic begin!!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 14, 2013, 01:37:06 pm
My personal use of it is this. my wife and I have both have an iPhone and different iCloud account. I have 2 devices which track our respective position. when both are at home, I trigger a "present" status which is a virtual switch plugin.   There are scene attached to that plugin when it changes status and do things like arming on or off motion detectors, foscam camera...  one thing which I did not do yet, could be pointing the foscam camera to the ceiling when we are at home ( privacy mode ! )

another use is staring at these little address that changes, I find it too fancy :)

I use PLEG but am a small user of it... I find it very powerful but you can easily go overboard with it and scratch your head for a long time. I use it to Mute both devices when both of us are at home and the time is between 9pm and 6am

schedule
MutePhoneTime   Weekly   21:00:00   1,2,3,4,5,6,7   None   Weekly   06:00:00   1,2,3,4,5,6,7   None   true   2013-11-11 21:00:00.100

device properties
iPhoneAlexis   (*)iPhone de Alexis   Present   2013-11-14 13:38:02.941   1
iPhoneFrede   Frederique iPhone   Present   2013-11-14 12:28:13.631   0

conditions
EverybodyAbsent   (iPhoneAlexis==0 and iPhoneFrede==0)   2013-11-14 13:00:23.888   false
NotEverybodyAbsent   not EverybodyAbsent   2013-11-14 13:38:02.955   true
EverybodyPresent   (iPhoneAlexis==1 and iPhoneFrede==1)   2013-11-11 20:02:08.992   false
MutePhoneSet   (EverybodyPresent and MutePhoneTime)   2013-11-11 21:00:00.117   false
MutePhoneUnset   not MutePhoneTime   2013-11-11 06:00:00.115   false

and the actions
Actions for Condition: MutePhoneSet
Immediate
Device   Action   Arguments
Frederique iPhone SetMute    newMuteStatus=1
(*)iPhone de Alexis   SetMute    newMuteStatus=1

Actions for Condition: MutePhoneUnset
Immediate
Device   Action   Arguments
Frederique iPhone SetMute    newMuteStatus=0
(*)iPhone de Alexis   SetMute    newMuteStatus=0
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 15, 2013, 12:24:20 pm
Ok so I ran into some issues today. I had version 1.59 successfully configured so it was tracking my iPhone. I tried creating another device through the app in order to add my wife's iPhone which is on a separate iCloud account. For some reason it wouldn't save her information. I would enter her email and password and her device would show up. I would add it to the list and then click the save button but as soon as I left that tab or closed out of the device it would clear all the info. I decided to try deleting the device but accidentally uninstalled the whole app. No problem I thought I'll just reinstall. I went and found version 1.60 and installed that but now I'm having the exact same issue when trying to set up my phone. When I enter in my info and save it it doesn't actually save. Any ideas?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 15, 2013, 02:32:22 pm
Ok so I ran into some issues today. I had version 1.59 successfully configured so it was tracking my iPhone. I tried creating another device through the app in order to add my wife's iPhone which is on a separate iCloud account. For some reason it wouldn't save her information. I would enter her email and password and her device would show up. I would add it to the list and then click the save button but as soon as I left that tab or closed out of the device it would clear all the info. I decided to try deleting the device but accidentally uninstalled the whole app. No problem I thought I'll just reinstall. I went and found version 1.60 and installed that but now I'm having the exact same issue when trying to set up my phone. When I enter in my info and save it it doesn't actually save. Any ideas?

I must admit the install is somewhat confusing. I just have published a step by step installation guide document walking you from the scratch ( a vera without the plugin ) down to a working setup. You will find it in the first post of this thread.   http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 15, 2013, 06:55:55 pm
I must admit the install is somewhat confusing. I just have published a step by step installation guide document walking you from the scratch ( a vera without the plugin ) down to a working setup. You will find it in the first post of this thread.   http://forum.micasaverde.com/index.php/topic,16907.msg130221.html#msg130221

Nice job, @amg0. Will be very helpful for the Newbies that haven't been on board from day 1 - or rather post 1  :). Thank you.
MJ
Title: Re: Plugin - IPhone Locator
Post by: peteinau on November 17, 2013, 02:27:07 am
Huge thanks amg0 for all the hard work! Really really appreciate it, it's made my house function a lot better!

I only have one question, I have an iMessage interface on my mac and when I'm calling the GetLocation function using the web function, the CurrentLocation always comes back as 0. I'm using v1.59b5 at the moment. 
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 17, 2013, 08:51:15 am
Huge thanks amg0 for all the hard work! Really really appreciate it, it's made my house function a lot better!

I only have one question, I have an iMessage interface on my mac and when I'm calling the GetLocation function using the web function, the CurrentLocation always comes back as 0. I'm using v1.59b5 at the moment.

you found a bug. please upgrade to 1.60 ( public version on the store ) , then upload this new Service file ( attached here ).  Tested & works for me now too. I ll add in next releases
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 18, 2013, 01:50:26 pm
V1.60 is public on the store.
V1.61 is a private version that you can install from http://apps.mios.com/test-plugin.php?id=4686&show=versions and which includes the fix for @peteinau


Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 20, 2013, 01:54:45 pm
@amg0
As usual, great updates and work on the plugin. I think this is working pretty well. I've narrowed down the distances and polling distances to be just right to enable my location to be found when I get home in time to silence the alarm, and properly when leaving to arm the house as well.

One quick question I have for an optimization I'm going to make with PLEG: I vaguely recall somewhere in this thread a mention of enabling a forced refresh when the device is unmated, is that correct? If it is, then I guess no need to do anything with PLEG, but if not, I'm going to enable this based on a door opening.
Title: Re: Plugin - IPhone Locator
Post by: Chris H. on November 20, 2013, 07:32:14 pm
OK, I saw were someone else asked about changing which phone gets set to the parent device vs child device but I never saw where it got answered. I have the same question, right now it has one of my kids phones as the parent and my wife's and mine as the child. I would like to change it to where my phone is the parent device.

Also it would be nice to be able to group them but with the parent one using a * before the name that isn't possible, any chance this can be corrected in the future.
Title: Re: Plugin - IPhone Locator
Post by: groundglass on November 20, 2013, 08:21:43 pm
Is there LUA code to force a refresh of the iphone locator device?   thanks
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 20, 2013, 08:25:38 pm
@amg0
As usual, great updates and work on the plugin. I think this is working pretty well. I've narrowed down the distances and polling distances to be just right to enable my location to be found when I get home in time to silence the alarm, and properly when leaving to arm the house as well.

One quick question I have for an optimization I'm going to make with PLEG: I vaguely recall somewhere in this thread a mention of enabling a forced refresh when the device is unmated, is that correct? If it is, then I guess no need to do anything with PLEG, but if not, I'm going to enable this based on a door opening.

@shmixx,

I'm using 1.61 and it refreshes the data whenever I click unmute (or PLEG unmutes for me).

Has been doing that for quite a few releases. (Although I _think_ there may possibly be an issue in one or more of the 1.59 Beta release(s). I was not seeing the address info being updated while running v1.59bX prior to my upgrade to v1.61.)

Title: How to use light level to keep light off when its bright outside
Post by: pdoughty on November 20, 2013, 08:58:01 pm
Hello,

I'm a new to this and I still don't know how to create a new post.  I spent years programing building automation which was simple modified basic with If-Then-Else statements.

I want a motion detector to tun on a light , but only if my Aeotec 4 in 1 light sensor is below 600. I create a scene that is triggered from the unarmed motion sensor. I also created a trigger when the brightness is below 600.

Can anyone let me know how to use the light sensor to keep light off when I make a scene?

Thanks.

Paul
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 20, 2013, 10:00:21 pm
Hello,

I'm a new to this and I still don't know how to create a new post.  I spent years programing building automation which was simple modified basic with If-Then-Else statements.

I want a motion detector to tun on a light , but only if my Aeotec 4 in 1 light sensor is below 600. I create a scene that is triggered from the unarmed motion sensor. I also created a trigger when the brightness is below 600.

Can anyone let me know how to use the light sensor to keep light off when I make a scene?

Thanks.

Paul


Hi Paul, welcome to the forum.

You asked this question in a topic unrelated to your needs.
The forum is organized into boards & sub-boards for specific matters.
You need to go to the appropriate forum board and start a new topic.
To do this got to http://forum.micasaverde.com/index.php (http://forum.micasaverde.com/index.php) then you probably want to select the [Lighting & Load Control] board. There you start a new topic by clicking on the [NEW TOPIC] button and state your request.

MJ
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 20, 2013, 10:02:10 pm
Is there LUA code to force a refresh of the iphone locator device?   thanks

You achieve this by creating a scene which refreshes the IPhone Locator.
Title: Re: Plugin - IPhone Locator
Post by: groundglass on November 20, 2013, 10:35:05 pm
Is there LUA code to force a refresh of the iphone locator device?   thanks

You achieve this by creating a scene which refreshes the IPhone Locator.

Thank you.    I was hoping to embed the Refresh command for my devices in some Startup Lua functions I had. Is there a way to directly trigger the refresh in Lua? thanks kris
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 20, 2013, 11:07:57 pm
Thank you.    I was hoping to embed the Refresh command for my devices in some Startup Lua functions I had. Is there a way to directly trigger the refresh in Lua? thanks kris

I'm sure there is. Though the answer has to come from more Lua experienced coders.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 21, 2013, 02:09:18 am
Thank you.    I was hoping to embed the Refresh command for my devices in some Startup Lua functions I had. Is there a way to directly trigger the refresh in Lua? thanks kris

I'm sure there is. Though the answer has to come from more Lua experienced coders.

as you can see in S_IPhone.xml , ForceRefresh is a UPNP action that you can call with a lua line of code. see http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_call_action
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 21, 2013, 02:13:18 am
Is there LUA code to force a refresh of the iphone locator device?   thanks

You achieve this by creating a scene which refreshes the IPhone Locator.

Thank you.    I was hoping to embed the Refresh command for my devices in some Startup Lua functions I had. Is there a way to directly trigger the refresh in Lua? thanks kris

I confirm that the implementation of the function setMute() in the L_IPhone.lua triggers a refresh of the plugin device location.  However, the refresh frequency/period will only be recalculated ( by the pollingmap logic ) the next time the refresh timer triggers an automatic refresh ( because there is not way to cancel a running timer and program a new one instead )

bottom line: the UnMute command will trigger a refresh of the device so the position will be accurate
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 21, 2013, 02:15:53 am
OK, I saw were someone else asked about changing which phone gets set to the parent device vs child device but I never saw where it got answered. I have the same question, right now it has one of my kids phones as the parent and my wife's and mine as the child. I would like to change it to where my phone is the parent device.

Also it would be nice to be able to group them but with the parent one using a * before the name that isn't possible, any chance this can be corrected in the future.

I am afraid that feature is not implemented (yet). the way I use to group them is to put them in a virtual room that I call "IPhones". 
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 21, 2013, 09:52:31 am
Is there LUA code to force a refresh of the iphone locator device?   thanks

I confirm that the implementation of the function setMute() in the L_IPhone.lua triggers a refresh of the plugin device location.  However, the refresh frequency/period will only be recalculated ( by the pollingmap logic ) the next time the refresh timer triggers an automatic refresh ( because there is not way to cancel a running timer and program a new one instead )

bottom line: the UnMute command will trigger a refresh of the device so the position will be accurate

@amg - one clarification I'd like to understand. In my scenario I didn't realize my phones would automatically be unmuted. So if my iphone is unmuted, and the unmuted command is sent, will it ignore this and not refresh? Or would it take the action of setting mute status to unmuted (which it already is) and in turn perform that refresh as well? I'm looking to essentially enable the door being opened as a refresh action to more quickly identify my present state in my PLEG. Since I've already got something unmuting the phone when the door is opened, I don't know if I need an additional action to refresh the location too.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 21, 2013, 09:57:00 am
... Or would it take the action of setting mute status to unmuted (which it already is) and in turn perform that refresh as well?...

Just tested that. If you unmute the device if it's already unmuted, it refreshes again.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 21, 2013, 10:06:05 am
... Or would it take the action of setting mute status to unmuted (which it already is) and in turn perform that refresh as well?...

Just tested that. If you unmute the device if it's already unmuted, it refreshes again.

Thank you sir!! I was going to try it but wouldn't be able to until much later, figure I could poll the audience in my anticipation of testing.  ;)
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 21, 2013, 04:11:48 pm
Is the auto-update function of the plugin working?
For some reason i still seem to be using version 1.50
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 21, 2013, 07:04:07 pm
Is the auto-update function of the plugin working?
For some reason i still seem to be using version 1.50

Did you check whether the [Auto update] flag is set in [Apps] [IPhone Detector Plugin].

I for one do not - or don't want to - rely on auto updates and therefore disabled all [Auto update] for my plugins. I'd like to have control when a plugin is updated. Experience has shown me that after an auto update some things all in a sudden didn't work as expected anymore.
Never touch a running system!!! If you update manually you have control and see (mostly) instantly whether your setup is still working the way you want.

Just my two cents ...
MJ

Edit: Go to http://apps.mios.com/test-plugin.php?id=4686&show=versions (http://apps.mios.com/test-plugin.php?id=4686&show=versions) for the plugin archive. You might need to log-in to the app store first and then click this link again. From there you can install any current or previous version you want.
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 22, 2013, 04:13:46 pm
Auto-Update Flag is On, but doesn't seem to be working.

Anyhow went to http://apps.mios.com/test-plugin.php?id=4686&show=versions, and pressed update to latest version, that did the trick.
Don't understand why autoupdate is not working..
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 23, 2013, 05:16:27 pm
Is there support for more than one icloud account?
Title: Re: Plugin - IPhone Locator
Post by: emtschei on November 23, 2013, 05:21:30 pm
Is there support for more than one icloud account?

Yes, there is. Just install another indepent IPhone Locator device and configure it accordingly.
In your Vera UI go to [Apps], click on the [IPhone Detector Plugin] and then click [Create another].

MJ

Title: Re: Plugin - IPhone Locator
Post by: bucko on November 24, 2013, 06:24:57 am
After a few weeks of use, all of a sudden I get this error in Luup when I do a reload in the Vera GUI.....

IPhoneLocator : startupDeferred, called on behalf of device:257

(device 257 is my iPhone device)

Any ideas???
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 24, 2013, 06:44:03 am
I get this error in Luup when I do a reload in the Vera GUI.....

IPhoneLocator : startupDeferred, called on behalf of device:

Any ideas???

Same here!
But i made the following changes in between:

- Updated iPhone Locator to latest version by apps.mios.com
- Installed UPNP Proxy
- Installed Sonos Plugin
Title: Re: Plugin - IPhone Locator
Post by: bucko on November 24, 2013, 06:59:48 am
Same here!
But i made the following changes in between:

- Updated iPhone Locator to latest version by apps.mios.com
- Installed UPNP Proxy
- Installed Sonos Plugin


I am using V 1.60. It started after I updated as well!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 24, 2013, 08:02:18 am
After a few weeks of use, all of a sudden I get this error in Luup when I do a reload in the Vera GUI.....

IPhoneLocator : startupDeferred, called on behalf of device:257

(device 257 is my iPhone device)

Any ideas???
Not an error just a trace. If this confuses users I ll remove it
Title: Re: Plugin - IPhone Locator
Post by: bucko on November 24, 2013, 08:28:08 am
Okie Dokie!
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on November 24, 2013, 08:54:45 am
Not an error just a trace. If this confuses users I ll remove it

Well if it is needed for a reason you probably should leave it in, or implement it only in beta releases and not in public?
Just thinking out loud
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 24, 2013, 02:00:46 pm
I have both my iPhone and my wife's added to my Vera Lite. They are on two different iCloud accounts. Is there a way to have a scene triggered when both of our phones are "away"? I figured out how to have a specific phone trigger a scene but not how to have a scene only be triggered if both phones are away.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 24, 2013, 02:32:37 pm
I have both my iPhone and my wife's added to my Vera Lite. They are on two different iCloud accounts. Is there a way to have a scene triggered when both of our phones are "away"? I figured out how to have a specific phone trigger a scene but not how to have a scene only be triggered if both phones are away.

Using PLEG, I trigger an action ( can we a scene ) when both phones are present. so very similar to what you want to achieve. here is my PLEG config. the condition that would interest you and on which you can associate an action to trigger a scene is : "EverybodyAbsent"


SCHEDULE
MutePhoneTime   Weekly   21:00:00   1,2,3,4,5,6,7   None Weekly   06:00:00   1,2,3,4,5,6,7   None   false   2013-11-23 21:00:00.100

PROPERTIES
iPhoneAlexis   (*)iPhone de Alexis   Present   2013-11-23 19:56:43.213   1
iPhoneFrede   Frederique Guede iPhone   Present   2013-11-23 16:04:22.707   1

CONDITIONS
EverybodyAbsent   (iPhoneAlexis==0 and iPhoneFrede==0)   2013-11-23 13:57:00.682   false
NotEverybodyAbsent   not EverybodyAbsent   2013-11-23 15:11:00.850   true
EverybodyPresent   (iPhoneAlexis==1 and iPhoneFrede==1)   2013-11-23 19:56:43.235   true
MutePhoneSet   (EverybodyPresent and MutePhoneTime) 2013-11-23 21:00:00.117   false
MutePhoneUnset   not MutePhoneTime   2013-11-24 06:00:00.116   true

ACTIONS
Actions for Condition: MutePhoneSet
Device   Action   Arguments
(*)iPhone de Alexis   SetMute    newMuteStatus=1
Frederique Guede iPhone   SetMute    newMuteStatus=1
Actions for Condition: MutePhoneUnset
Device   Action   Arguments
(*)iPhone de Alexis   SetMute    newMuteStatus=0
Frederique Guede iPhone   SetMute    newMuteStatus=0
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 24, 2013, 02:35:26 pm
Using PLEG, I trigger an action ( can we a scene ) when both phones are present. so very similar to what you want to achieve. here is my PLEG config. the condition that would interest you and on which you can associate an action to trigger a scene is : "EverybodyAbsent"


SCHEDULE
MutePhoneTime   Weekly   21:00:00   1,2,3,4,5,6,7   None Weekly   06:00:00   1,2,3,4,5,6,7   None   false   2013-11-23 21:00:00.100

PROPERTIES
iPhoneAlexis   (*)iPhone de Alexis   Present   2013-11-23 19:56:43.213   1
iPhoneFrede   Frederique Guede iPhone   Present   2013-11-23 16:04:22.707   1

CONDITIONS
EverybodyAbsent   (iPhoneAlexis==0 and iPhoneFrede==0)   2013-11-23 13:57:00.682   false
NotEverybodyAbsent   not EverybodyAbsent   2013-11-23 15:11:00.850   true
EverybodyPresent   (iPhoneAlexis==1 and iPhoneFrede==1)   2013-11-23 19:56:43.235   true
MutePhoneSet   (EverybodyPresent and MutePhoneTime) 2013-11-23 21:00:00.117   false
MutePhoneUnset   not MutePhoneTime   2013-11-24 06:00:00.116   true

ACTIONS
Actions for Condition: MutePhoneSet
Device   Action   Arguments
(*)iPhone de Alexis   SetMute    newMuteStatus=1
Frederique Guede iPhone   SetMute    newMuteStatus=1
Actions for Condition: MutePhoneUnset
Device   Action   Arguments
(*)iPhone de Alexis   SetMute    newMuteStatus=0
Frederique Guede iPhone   SetMute    newMuteStatus=0

I'm afraid you've gone way over my head at this point. I don't even know what PLEG is.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 24, 2013, 02:53:18 pm
I'm afraid you've gone way over my head at this point. I don't even know what PLEG is.

@seannymurrs

What you are seeing here is the Status report of the PLEG screen. PLEG = Program Logic and Event Generator. It's a plugin for Vera that is highly customizable and used by almost anyone doing advanced scenes as you desire per your request above. You can find the plugin under the Apps section in your Vera. Once it's installed on the first tab of the device, you will see Status/Report buttons, and what you see above is a status screen that amg0 pulled of his current config for achieving what you mentioned.

Now, I would suggest you take a look in the forums to understand more about PLEG before just diving in, as it is quite intricate. You can also have a look at the "help" link in the plugin/device which will guide you to RichardT's site which explains the capabilities of the PLEG device. Once you've seen that, most of what amg0 posted will start to make sense. It takes a bit of playing around and trial/error to get the logic just right.

Once you've got a basic understanding, then what you will want to do is create a similar configuration in your PLEG device to mimic what amg0 has posted here. Obviously you will want to customize this to your liking and your scenario, naming, etc. amg0 has provided a groundwork for you of Triggers (on the triggers tab in PLEG device) which includes Schedules and Device Properties, along with the Conditions (logic), and his Actions (same as Actions in a scene). You can ignore the true/false and timestamps posted as these will be on your device.

Everyone here is usually pretty helpful at getting this setup, but you may want to post in the PLEG section of the forum for more particular help around using PLEG scenes vs here which is related specifically to help on the iPhone Locator plugin. Ive included my logic below for your perusal as well, and a link to another associated topic I actually started for Muting the plugin to help save phone battery life.

http://forum.micasaverde.com/index.php/topic,16909.15.html (http://forum.micasaverde.com/index.php/topic,16909.15.html)
Code: [Select]
TRIGGERS
Name Description Last Trigger State
TGarageDoor Zone #11 - Garage Door is tripped 2013-11-24 11:23:45.027 false
TFrontDoor Zone #9 - Front Door is tripped 2013-11-24 10:55:53.260 false
TDisarmed Alarm Panel is DISARMED 2013-11-24 10:53:53.832 true
TShawnAway (*)Destiny is away 2013-11-24 10:02:38.703 false
TShawnHome (*)Destiny is present 2013-11-24 10:53:43.573 true
TTarynAway (*)Taryn?s iPhone is away 2013-11-24 10:02:31.556 false
TTarynHome (*)Taryn?s iPhone is present 2013-11-24 10:54:51.887 true

CONDITIONS
Name Expression Last True State
CPhoneMuteOn1 (TShawnHome AND (TShawnHome; Now > 5:00)) OR (TTarynHome AND (TTarynHome; Now > 5:00)) 2013-11-24 10:59:25.134 true
CPhoneMuteOn2 (TShawnHome AND (CPhoneMuteOff; Now > 5:00)) OR (TTarynHome AND (CPhoneMuteOff; Now > 5:00)) 2013-11-24 11:29:25.139 true
CPhoneMuteOff TFrontDoor OR TGarageDoor OR TArmed 2013-11-24 11:23:45.069 false
CPhoneAway (TShawnAway AND TTarynAway) AND ((TShawnAway; NOW > 1:00) OR (TTarynAway; NOW > 1:00)) 2013-11-24 10:04:25.144 false
CPhoneHome (CPhoneAway;TShawnHome) OR (CPhoneAway;TTarynHome) 2013-11-24 10:53:43.630 true

ACTIONS
Actions for Condition: CPhoneMuteOff

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=0
(*)Taryn?s iPhone SetMute newMuteStatus=0
Actions for Condition: CPhoneMuteOn2

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
(*)Taryn?s iPhone SetMute newMuteStatus=1
Actions for Condition: CPhoneMuteOn1

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
(*)Taryn?s iPhone SetMute newMuteStatus=1
Actions for Condition: CPhoneHome

Immediate

Device Action Arguments
Alarm Panel RequestArmMode State=Disarmed PINCode=undefined
Actions for Condition: CPhoneAway

Immediate

Device Action Arguments
Automation Actions RunScene SceneNameOrNumber=14
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 25, 2013, 05:19:12 am
Something odd is going on...

Running v1.61 and clicked the "UnDebug" button on one of the two iPhone Locator instances I have (2 accounts):
Notice how the debug variable got changed for the 2nd instance as well!

Code: [Select]
08 11/25/13 5:16:31.792 JobHandler_LuaUPnP::HandleActionRequest device: 224 service: urn:upnp-org:serviceId:IPhoneLocator1 action: SetDebug <0x32427680>
08 11/25/13 5:16:31.792 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=224 <0x32427680>
08 11/25/13 5:16:31.793 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:IPhoneLocator1 <0x32427680>
08 11/25/13 5:16:31.793 JobHandler_LuaUPnP::HandleActionRequest argument action=SetDebug <0x32427680>
08 11/25/13 5:16:31.793 JobHandler_LuaUPnP::HandleActionRequest argument newDebugMode=0 <0x32427680>
08 11/25/13 5:16:31.793 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.40666852332651615 <0x32427680>
50 11/25/13 5:16:31.794 luup_log:224: IPhoneLocator: debug: calling uPNP setDebugMode(224,0) <0x32427680>
50 11/25/13 5:16:31.795 luup_log:224: IPhoneLocator: Set DEBUG_MODE to false <0x32427680>
06 11/25/13 5:16:31.796 Device_Variable::m_szValue_set device: 224 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Debug was: 1 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x32427680>
06 11/25/13 5:16:31.797 Device_Variable::m_szValue_set device: 223 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: Debug was: 1 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x32427680>
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 25, 2013, 11:45:07 am
Something odd is going on...

Running v1.61 and clicked the "UnDebug" button on one of the two iPhone Locator instances I have (2 accounts):
Notice how the debug variable got changed for the 2nd instance as well!


Found the problem in the [set|get]DebugMode() functions (you're searching based on the device type). With multiple instances of the same device (not as child devices, but discrete instances), the code that tests for the device type will apply the change to any and all devices on the Vera instance of that type. To me, that's _way_ to broad of a brush.

Maybe it makes more sense to only identify child devices and apply the Debug (or any other device specific actions) to the children?

So, instead of:
Code: [Select]
   for k,v in pairs(luup.devices) do
       if( v.device_type == devicetype ) then
            luup.variable_set(service,"Debug",newDebugMode,k)
        end
    end

You would do (not tested and only included as "pseudocode")
Code: [Select]
   for k,v in pairs(luup.devices) do
       if( (lul_device == k ) or
         ( v.device_num_parent == lul_device )) then
            luup.variable_set(service,"Debug",newDebugMode,k)
        end
    end
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 25, 2013, 12:57:21 pm
Something odd is going on...

Running v1.61 and clicked the "UnDebug" button on one of the two iPhone Locator instances I have (2 accounts):
Notice how the debug variable got changed for the 2nd instance as well!

...
Maybe it makes more sense to only identify child devices and apply the Debug (or any other device specific actions) to the children?


This is not an issue and is in fact behaving exactly as intented and documented in the msg#1 of that thread.

Quote
Debug: Debug mode or not, this affects ALL IPhoneLocator devices, not only this one and generates quite a number of log so, to be used only for troubleshooting purposes

At this point I do not plan to go the extra mile and have debug per device instance. The whole plugin is in debug mode or not, it is good enough, debug is not a user feature anyhow. thx
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 25, 2013, 01:02:04 pm
v1.62 is public on the store and includes these 2 small fixes

Going now to focus as controlling which device gets used as the root device in a iCloud/several device situation
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 25, 2013, 01:31:27 pm
I'm afraid you've gone way over my head at this point. I don't even know what PLEG is.

@seannymurrs

What you are seeing here is the Status report of the PLEG screen. PLEG = Program Logic and Event Generator. It's a plugin for Vera that is highly customizable and used by almost anyone doing advanced scenes as you desire per your request above. You can find the plugin under the Apps section in your Vera. Once it's installed on the first tab of the device, you will see Status/Report buttons, and what you see above is a status screen that amg0 pulled of his current config for achieving what you mentioned.

Now, I would suggest you take a look in the forums to understand more about PLEG before just diving in, as it is quite intricate. You can also have a look at the "help" link in the plugin/device which will guide you to RichardT's site which explains the capabilities of the PLEG device. Once you've seen that, most of what amg0 posted will start to make sense. It takes a bit of playing around and trial/error to get the logic just right.

Once you've got a basic understanding, then what you will want to do is create a similar configuration in your PLEG device to mimic what amg0 has posted here. Obviously you will want to customize this to your liking and your scenario, naming, etc. amg0 has provided a groundwork for you of Triggers (on the triggers tab in PLEG device) which includes Schedules and Device Properties, along with the Conditions (logic), and his Actions (same as Actions in a scene). You can ignore the true/false and timestamps posted as these will be on your device.

Everyone here is usually pretty helpful at getting this setup, but you may want to post in the PLEG section of the forum for more particular help around using PLEG scenes vs here which is related specifically to help on the iPhone Locator plugin. Ive included my logic below for your perusal as well, and a link to another associated topic I actually started for Muting the plugin to help save phone battery life.

http://forum.micasaverde.com/index.php/topic,16909.15.html (http://forum.micasaverde.com/index.php/topic,16909.15.html)
Code: [Select]
TRIGGERS
Name Description Last Trigger State
TGarageDoor Zone #11 - Garage Door is tripped 2013-11-24 11:23:45.027 false
TFrontDoor Zone #9 - Front Door is tripped 2013-11-24 10:55:53.260 false
TDisarmed Alarm Panel is DISARMED 2013-11-24 10:53:53.832 true
TShawnAway (*)Destiny is away 2013-11-24 10:02:38.703 false
TShawnHome (*)Destiny is present 2013-11-24 10:53:43.573 true
TTarynAway (*)Taryn?s iPhone is away 2013-11-24 10:02:31.556 false
TTarynHome (*)Taryn?s iPhone is present 2013-11-24 10:54:51.887 true

CONDITIONS
Name Expression Last True State
CPhoneMuteOn1 (TShawnHome AND (TShawnHome; Now > 5:00)) OR (TTarynHome AND (TTarynHome; Now > 5:00)) 2013-11-24 10:59:25.134 true
CPhoneMuteOn2 (TShawnHome AND (CPhoneMuteOff; Now > 5:00)) OR (TTarynHome AND (CPhoneMuteOff; Now > 5:00)) 2013-11-24 11:29:25.139 true
CPhoneMuteOff TFrontDoor OR TGarageDoor OR TArmed 2013-11-24 11:23:45.069 false
CPhoneAway (TShawnAway AND TTarynAway) AND ((TShawnAway; NOW > 1:00) OR (TTarynAway; NOW > 1:00)) 2013-11-24 10:04:25.144 false
CPhoneHome (CPhoneAway;TShawnHome) OR (CPhoneAway;TTarynHome) 2013-11-24 10:53:43.630 true

ACTIONS
Actions for Condition: CPhoneMuteOff

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=0
(*)Taryn?s iPhone SetMute newMuteStatus=0
Actions for Condition: CPhoneMuteOn2

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
(*)Taryn?s iPhone SetMute newMuteStatus=1
Actions for Condition: CPhoneMuteOn1

Immediate

Device Action Arguments
(*)Destiny SetMute newMuteStatus=1
(*)Taryn?s iPhone SetMute newMuteStatus=1
Actions for Condition: CPhoneHome

Immediate

Device Action Arguments
Alarm Panel RequestArmMode State=Disarmed PINCode=undefined
Actions for Condition: CPhoneAway

Immediate

Device Action Arguments
Automation Actions RunScene SceneNameOrNumber=14

Ok so I installed PLEG and read through some documentation and am trying to set up my scene. How do I export what I have put in so that I can paste it here in the forums to see if I'm on the right track?
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 25, 2013, 01:35:30 pm
@seannymurrs

Glad to hear you are up and running. IF you open the PLEG device on the first tab, there should be buttons for Status and Report. Clicking on Status will open a new window which will have the details we've pasted into the forum here.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 25, 2013, 01:37:29 pm
Ok so I installed PLEG and read through some documentation and am trying to set up my scene. How do I export what I have put in so that I can paste it here in the forums to see if I'm on the right track?

Click the "Wrench" on your PLEG instance and click the "Status" button. Then select & copy the info in the HTML table you'll see pop up in its own window.

To paste it, make sure you do so between a "[ code ]" and "[ /code ]" bracket pair so it's readable for people (i.e. click the "Insert Code" button in the post editor for this forum - it 's the '#' button).

I would, however, recommend you post PLEG questions in the "Program Logic Plugins"  sub-group as the people in that sub-group are _way_ more knowledgeable in the ways of PLEG than most people here are.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 25, 2013, 01:39:51 pm
Here's what I have when I click on the Status. When I click on the button I get three quick pop-ups that say "Error Getting status of: iPhoneSean", "Error Getting status of: iPhoneAmanda", and "Error Getting status of: Everyone_Absent". I'm assuming this isn't supposed to happen but am not sure what would be causing it.

Code: [Select]
Everyone's Absent

Device ID: 532013-11-25 13:38:46.058 PLC Version: 5.4

Device Properties

Name Device Name Device Variable Last Change Value
iPhoneAmanda (*)Amanda Murray?s iPhone Present undefined undefined
iPhoneSean (*)Sean Murray?s iPhone Present undefined undefined
Conditions

Name Expression Last True State
Everyone_Absent iPhoneSean==0 iPhoneAmanda==0 undefined undefined
Actions

Actions for Condition: Everyone_Absent

Immediate

Device Action Arguments
Laundry Room SetTarget newTargetValue=0
WeMo Switch SetTarget newTargetValue=0
Ceiling Lights SetLoadLevelTarget newLoadlevelTarget=0
Chandelier SetLoadLevelTarget newLoadlevelTarget=0
Lamps SetTarget newTargetValue=0
Task Lights SetTarget newTargetValue=0
Entry Lights SetLoadLevelTarget newLoadlevelTarget=0
Home SetOccupancyState NewOccupancyState=Unoccupied
Storage Lamp SetTarget newTargetValue=0
Wicker Lamp SetTarget newTargetValue=0
Fan SetTarget newTargetValue=0
Ceiling Light SetLoadLevelTarget newLoadlevelTarget=0
Bathroom Light SetLoadLevelTarget newLoadlevelTarget=0
Amanda's Side SetTarget newTargetValue=0
Sean's Side SetTarget newTargetValue=0
Front Porch Lights SetTarget newTargetValue=0
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 25, 2013, 01:46:00 pm
@seannymurrs

It looks like you have the basics there setup to work as you were looking for. The reason you probably were getting those messages is since adding those triggers to the PLEG, it doesn't have a defined current status until they are tripped for the first time. If you want to test it out and/or have it update, you can simply click the Away button on both iPhone locator devices. Then wait a moment to see if the action happens. Once you see the actions take place, you can switch back to present. When you open the status again you should no longer get those messages, and you should see the last time/date filled in for when the triggers last changed or conditions were last made true.

Welcome to PLEG!!
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 25, 2013, 02:01:33 pm
@seannymurrs

It looks like you have the basics there setup to work as you were looking for. The reason you probably were getting those messages is since adding those triggers to the PLEG, it doesn't have a defined current status until they are tripped for the first time. If you want to test it out and/or have it update, you can simply click the Away button on both iPhone locator devices. Then wait a moment to see if the action happens. Once you see the actions take place, you can switch back to present. When you open the status again you should no longer get those messages, and you should see the last time/date filled in for when the triggers last changed or conditions were last made true.

Welcome to PLEG!!

Both my wife and I are at work right now so our phones are both already "away". Right now the PLEG device is listed as "bypass" should it switch to "arm" when/if both phones are listed as away?

*EDIT* Nevermind, I think I figured it out. I have to set the device to arm to have it be active correct? I switched it over to arm and then manually set one of the phones to present then away again. It looks like the scene triggered just like it was supposed to which is awesome. Thanks for all the help guys.
Title: Re: Plugin - IPhone Locator
Post by: shmixx on November 25, 2013, 02:08:12 pm
That is correct, usually the first question when things look right, is the PLEG armed. When it is Armed, conditions will fire (evaluate), and so will the associated actions. When it is Bypassed, the conditions will fire (evaluate) but no conditions will fire.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on November 25, 2013, 04:07:21 pm
That is correct, usually the first question when things look right, is the PLEG armed. When it is Armed, conditions will fire (evaluate), and so will the associated actions. When it is Bypassed, the conditions will fire (evaluate) but no conditions will fire.

You guys are awesome! Thanks again for the help.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on November 25, 2013, 08:12:21 pm
I'm getting an "icloud refused access" error now. I reset the vera and reinstalled the app then that error appeared. Please let me know if there is a a fix. I couldn't find anything searching through the thread.
I tried adding my email and password in advanced section but still same error.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 26, 2013, 01:42:56 am
I'm getting an "icloud refused access" error now. I reset the vera and reinstalled the app then that error appeared. Please let me know if there is a a fix. I couldn't find anything searching through the thread.
I tried adding my email and password in advanced section but still same error.

the Message("iCloud refused access, Check credentials ?") is given when a wrong iCloud email/pwd is being used ( or if you do not have iCloud account). You must not add Password directly in the ADVANCED section. You must do it in the SETTINGS section ( because the advanced section only store a encoded version of the password ). You can try to follow very closely the steps documented here: http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on November 26, 2013, 04:38:13 am
I have tried that also, seems to not work either way. I know the username and password I'm using are correct.

I'm getting an "icloud refused access" error now. I reset the vera and reinstalled the app then that error appeared. Please let me know if there is a a fix. I couldn't find anything searching through the thread.
I tried adding my email and password in advanced section but still same error.

the Message("iCloud refused access, Check credentials ?") is given when a wrong iCloud email/pwd is being used ( or if you do not have iCloud account). You must not add Password directly in the ADVANCED section. You must do it in the SETTINGS section ( because the advanced section only store a encoded version of the password ). You can try to follow very closely the steps documented here: http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
Title: Re: Plugin - IPhone Locator
Post by: welchgw on November 26, 2013, 04:50:35 pm
What do the Mute and unmute buttons do? Do they turn off alerting?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 26, 2013, 05:08:48 pm
What do the Mute and unmute buttons do? Do they turn off alerting?

Mute stops polling of your device(s), unmute starts polling
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on November 26, 2013, 05:13:07 pm
Could it be issues regarding symbols in passwords? How can I access the log when I turn on Debug?
Thanks
Title: Re: Plugin - IPhone Locator
Post by: welchgw on November 26, 2013, 05:14:54 pm
What do the Mute and unmute buttons do? Do they turn off alerting?

Mute stops polling of your device(s), unmute starts polling

Thank you also I am using Vera Mobile on Android how do I get the phones and status to show up in there? Currently can only see from the UI5 screen.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 26, 2013, 05:28:24 pm
What do the Mute and unmute buttons do? Do they turn off alerting?

Mute stops polling of your device(s), unmute starts polling

Thank you also I am using Vera Mobile on Android how do I get the phones and status to show up in there? Currently can only see from the UI5 screen.

Sorry, I don't have any android devices. search for a corresponding thread (http://forum.micasaverde.com/index.php/board,12.0.html) instead
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 26, 2013, 05:30:24 pm
Could it be issues regarding symbols in passwords? How can I access the log when I turn on Debug?
Thanks

ssh into your device and:
Code: [Select]
tail -f /var/log/cmh/LuaUPnP.log
or open a web browser and enter url:
Code: [Select]
http://<vera's ip>/cgi-bin/cmh/log.sh?Device=LuaUPnP
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 26, 2013, 05:30:55 pm
What do the Mute and unmute buttons do? Do they turn off alerting?

Mute stops polling of your device(s), unmute starts polling

Thank you also I am using Vera Mobile on Android how do I get the phones and status to show up in there? Currently can only see from the UI5 screen.

i am afraid there is no way that i know of unless the author of these mobile apps specifically code for supporting the iphone plug in device.
Title: Re: Plugin - IPhone Locator
Post by: Ramiii on November 26, 2013, 05:34:38 pm
Hello guys

I get this message a lot with the latest update

IPhoneLocator : startupDeferred, called on behalf of device:186

What is this ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 26, 2013, 05:38:15 pm
Hello guys

I get this message a lot with the latest update

IPhoneLocator : startupDeferred, called on behalf of device:186

What is this ?

it was just an information message, I have removed it in latest public version on the store which is v1.62
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 27, 2013, 03:40:47 pm
Just released a private V1.63 version on http://apps.mios.com/test-plugin.php?id=4686&show=versions which enables to select which iDevice is the parent device chosen in multi iDevice/single iCloud account situations

Please beware of the following, this is a private version and we could have some problem with it, please feedback in case you do encounter problems.

Also please read carefully the below as upgrading to this release could have some implications you need to be aware of:
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 27, 2013, 03:46:32 pm
OK, I saw were someone else asked about changing which phone gets set to the parent device vs child device but I never saw where it got answered. I have the same question, right now it has one of my kids phones as the parent and my wife's and mine as the child. I would like to change it to where my phone is the parent device.

Also it would be nice to be able to group them but with the parent one using a * before the name that isn't possible, any chance this can be corrected in the future.

I am afraid that feature is not implemented (yet). the way I use to group them is to put them in a virtual room that I call "IPhones".

you can try v1.63 ( see prior post , or post #1 for help )
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 27, 2013, 04:24:46 pm
Just released a private V1.63 version on http://apps.mios.com/test-plugin.php?id=4686&show=versions which enables to select which iDevice is the parent device chosen in multi iDevice/single iCloud account situations

Please beware of the following, this is a private version and we could have some problem with it, please feedback in case you do encounter problems.

...

I didn't encounter any problems, everything is still fine after upgrading! 1 question though: is there a possibility to remove an iDevice from the selection (left) list if that iDevice is already selected (present in the right list)? That may be a nice addition, for when you have some spare time... ;-)
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 28, 2013, 02:33:31 pm
Just an idea. I am having a few problems lately, with the phone not updating location often enough (it worked fine for a few weeks, and its always the same trip home from work). I think the polling settings should be ok, but as an idea for a feature in future releases. We could double or triple the polling settings when the phone is coming closer ? Maybe half them when the phone is moving away ? Dont know if that is possible, but i think that would improve accuracy and battery life. I could obviously try programming something like that in PLEG, but i think having something like that in the plugin would be good.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 28, 2013, 03:10:37 pm
Just an idea. I am having a few problems lately, with the phone not updating location often enough (it worked fine for a few weeks, and its always the same trip home from work). I think the polling settings should be ok, but as an idea for a feature in future releases. We could double or triple the polling settings when the phone is coming closer ? Maybe half them when the phone is moving away ? Dont know if that is possible, but i think that would improve accuracy and battery life. I could obviously try programming something like that in PLEG, but i think having something like that in the plugin would be good.

I'm a little confused. Why wouldn't a polling map that does what you're looking for meet the need you're describing?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 28, 2013, 03:16:50 pm
Just an idea. I am having a few problems lately, with the phone not updating location often enough (it worked fine for a few weeks, and its always the same trip home from work). I think the polling settings should be ok, but as an idea for a feature in future releases. We could double or triple the polling settings when the phone is coming closer ? Maybe half them when the phone is moving away ? Dont know if that is possible, but i think that would improve accuracy and battery life. I could obviously try programming something like that in PLEG, but i think having something like that in the plugin would be good.

I'm a little confused. Why wouldn't a polling map that does what you're looking for meet the need you're describing?
I agree with @sjolshagen. also check out the documentation on the #1 post in this thread:

PollingMap: Enables a polling duration based on the Distance reported. The polling duration calculated is the minimal of all polling required between all devices managed from this same iCloud account based on the polling map and their respective base location. if empty, dynamic polling follows a simple algorythm: if (Distance>100) the period is 10 times the based period, if Distance>10 the period is 3 times the based period. if it is filled in, then its format is a COMMA (',') separated list of pairs like dist:polling. Number of pairs/steps is not fixed, up to you. for instance 0:600,1:60,10:300,100:1800 which would mean, if the distance is less than 1, polling will be 600s, if it is between 1 and 10, polling will be 60s, if it is between 10 and 100, polling will be 300s, if it is above 100, polling will be 1800s
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 28, 2013, 05:16:32 pm
I am using this as a polling map: 0:90,0.15:55,0.6:120,1.1:130,2:160,5:450,15:900,50:1800,100:3000. It has worked well for quite a while. But lately on the same daily journey, when i arrive back home, distance is still 'stuck' at 21 miles distance, i do not know why this has worked for a couple of weeks and now 2 days in a row it is stuck. I could obviously increase polling. But that uses up battery and i have the other half complaining already about having to charge every day...
So, my thought was, i could probably decrease polling, if it would increase when moving closer. That way, polling would only increase when neede, hence using less battery. So rather than having a 'static' polling map (which is very good, dont take me wrong !), i think an even more 'dynamic' map would increase efficiency. As i said before, normally my polling map works quite well, i was just thinking of improving it. If i was clever enough to program it i would probably attempt it myself, but i am not... And my thought was it might be easy to program a simple multiply map by 2 when moving closer function in.. with a check box to enable/disable...
I am not saying this is necessary, just trying to give ideas to improve a brilliant plugin even more
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 28, 2013, 05:53:14 pm
I am using this as a polling map: 0:90,0.15:55,0.6:120,1.1:130,2:160,5:450,15:900,50:1800,100:3000. It has worked well for quite a while. But lately on the same daily journey, when i arrive back home, distance is still 'stuck' at 21 miles distance, i do not know why this has worked for a couple of weeks and now 2 days in a row it is stuck. I could obviously increase polling. But that uses up battery and i have the other half complaining already about having to charge every day...
So, my thought was, i could probably decrease polling, if it would increase when moving closer. That way, polling would only increase when neede, hence using less battery. So rather than having a 'static' polling map (which is very good, dont take me wrong !), i think an even more 'dynamic' map would increase efficiency. As i said before, normally my polling map works quite well, i was just thinking of improving it. If i was clever enough to program it i would probably attempt it myself, but i am not... And my thought was it might be easy to program a simple multiply map by 2 when moving closer function in.. with a check box to enable/disable...
I am not saying this is necessary, just trying to give ideas to improve a brilliant plugin even more

Dynamic polling map is indeed the best but stuck at 21 is not expected. I hope apple is not noticing our traffic :-) A trace in debug mode would be useful.  What version are you on?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 28, 2013, 06:36:48 pm
I am using this as a polling map: 0:90,0.15:55,0.6:120,1.1:130,2:160,5:450,15:900,50:1800,100:3000. It has worked well for quite a while. But lately on the same daily journey, when i arrive back home, distance is still 'stuck' at 21 miles distance, i do not know why this has worked for a couple of weeks and now 2 days in a row it is stuck. I could obviously increase polling. But that uses up battery and i have the other half complaining already about having to charge every day...
So, my thought was, i could probably decrease polling, if it would increase when moving closer. That way, polling would only increase when neede, hence using less battery. So rather than having a 'static' polling map (which is very good, dont take me wrong !), i think an even more 'dynamic' map would increase efficiency. As i said before, normally my polling map works quite well, i was just thinking of improving it. If i was clever enough to program it i would probably attempt it myself, but i am not... And my thought was it might be easy to program a simple multiply map by 2 when moving closer function in.. with a check box to enable/disable...
I am not saying this is necessary, just trying to give ideas to improve a brilliant plugin even more

With PLEG you could create 3 conditions for 3 IconCode properties with 3 corresponding scenes to fit your needs. Use luup.variable_set in the scenes to change the PollMap variable accordingly.

- iconcode = 0    --Away and not moving
- iconcode = 25   --Away and going away
- iconcode = 75   --Away but coming home

I did try this too, but found out that this doesn't really make sense because it all depends on the moment when you change directions and when the last/next poll occurs in the device.

When you, for example, go for a drive to get some fuel around the corner. If the device polls your location right before you arrive at the fuel station (Away and going away) and then drive back home, the next poll will be too late because you will arrive at home earlier than thought. If the device polled your iPhone a little bit later, directly after paying and while you were starting to drive home again (Away but coming home), then it would work because the poll time would be lower in that case. Therefor I decided to end up with only 1 (static) poll map for now, still thinking about other possibilities...

Too bad there's no API for the 'Find my Friends' app where there's an ability to setup one ore more geofence(s) and the ability to use it per device (don't unneccessarily drain other device's batteries that you don't need to poll anyway), that really would solve all our problems.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 29, 2013, 02:53:38 am
@duiffie
Quote
Use luup.variable_set in the scenes to change the PollMap variable accordingly
That sounds like a good solution, did not know it was possible. How exactly do i do that ? I dont really know much about luup, i have used it but only really copy pasted from here...

@amg0
I have upgraded to 1.62 a couple of days ago. I will enable debug, and if it happens again will send you the log
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 06:38:01 am
@duiffie
Quote
Use luup.variable_set in the scenes to change the PollMap variable accordingly
That sounds like a good solution, did not know it was possible. How exactly do i do that ? I dont really know much about luup, i have used it but only really copy pasted from here...

@amg0
I have upgraded to 1.62 a couple of days ago. I will enable debug, and if it happens again will send you the log

As said in my previous post: changing the poll map doesn't really make sense. If you still want to try this, follow these steps:

- In PLEG, create a device property for your iPhone device (field: IconCode), let's name it: iphoneA_iconcode
- Create 3 PLEG conditions:
  - (iphoneA_iconcode == 0)      name: iphoneA_steady
  - (iphoneA_iconcode == 25)      name: iphoneA_goaway
  - (iphoneA_iconcode == 75)      name: iphoneA_comehome

Next, create 3 scenes:
  - Name: steady (triggered by PLEG condition: iphoneA_steady)
  - Name: go_away (triggered by PLEG condition: iphoneA_goaway)
  - Name: come_home (triggered by PLEG condition: iphoneA_comehome)

add the following code to the luup-tab of these 3 scenes and change the NewPollMap variable accordingly:
Code: [Select]
local DEVICE_NO = xx -- your iphone locator device number
local SID = "urn:upnp-org:serviceId:IPhoneLocator1"

local NewPollMap = "0:600,1:60,2:120"

luup.variable_set(SID, "PollingMap", NewPollMap, DEVICE_NO)

return true

Don't forget to click 'Save lua' afterwards!

last but not least: in the advanced tab of the 3 scenes, initiate a refresh of the iphone device to apply the new pollmap
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 29, 2013, 06:59:46 am
@duiffie
Thats brilliant. Thats an easy way of trying different poll maps and see if they work better or make any difference to battery life. Maybe stop the other half complaining about battery usuage...  :)
One thing.
Quote
initiate a refresh of the iphone device to apply the new pollmap
By that you mean force a manual refresh of the device as if pressing refresh on the iphonelocator button in the device, correct ? If thats it thats easy.
That is actually even better than to just double all the poll settings. I could keep the short distance polls all the same, so even if i go out just to come back in a few seconds it would pick it up, but if i go away further i can drastically reduce polls which should help battery.
But if that works, might be a good idea to have that possibility of having 3 poll maps in the device.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 07:09:31 am
@duiffie
...
One thing.
Quote
initiate a refresh of the iphone device to apply the new pollmap
By that you mean force a manual refresh of the device as if pressing refresh on the iphonelocator button in the device, correct ?
...

Correct! No problem if you don't refresh, I assume that the new pollmap will then be active after the next scheduled poll. If you force a refresh it'll be active directly, but that costs battery life again because it's 1 'extra' poll
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 08:02:57 am
...
, but if i go away further i can drastically reduce polls which should help battery.
...

Same situation there... Say you're 100km from home (moving away) and therefor change the pollmap from 1 to 2 hours, pretty drastical as an example ;-). After 2 hours the device will know again if you're moving away from or coming closer to home. But if you 5 minutes later decide to turn around to go back home, you'll be home within 1 hour, not 2. Conclusion: short or long distances, it doesn't really matter...

Please share your experiences though.
Title: Re: Plugin - IPhone Locator
Post by: gusti67 on November 29, 2013, 11:34:19 am
Hi,

I just installed ver. 1.62 on Vera2 with UI5 but after I enter Icloud email & password / saving / refreshing no IPhone name from my account it's displayed. Any ideea why? I've checked and of course I see my IPhone in the ICloud account and from ICloud their locator works.

Thanks for support,
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 29, 2013, 02:19:56 pm
...
, but if i go away further i can drastically reduce polls which should help battery.
...

Same situation there... Say you're 100km from home (moving away) and therefor change the pollmap from 1 to 2 hours, pretty drastical as an example ;-). After 2 hours the device will know again if you're moving away from or coming closer to home. But if you 5 minutes later decide to turn around to go back home, you'll be home within 1 hour, not 2. Conclusion: short or long distances, it doesn't really matter...

Please share your experiences though.

Interesting,  maybe arrange the polling map so that the polling frequency is less than half the time it would take to come back from that distance ( in average ). a bit like the Nyquist-Shannon theorem   :-\  ( happy wiki ) , from my very partial understanding of it you try to sample a signal with a frequency at least the double of the signal frequency itself ...  here the "signal" you are sampling is your phone distance to home, the sampling frequency is the iCloud polling defined by the pollingmap , and you have to estimate your phone speed to come home ( car or walking ), based on that , inssure the polling is half what it would take the phone to come back home...

I honestly have not tried what I am writing about here, but sounded like a thought :) so sharing it.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 29, 2013, 02:21:43 pm
Hi,

I just installed ver. 1.62 on Vera2 with UI5 but after I enter Icloud email & password / saving / refreshing no IPhone name from my account it's displayed. Any ideea why? I've checked and of course I see my IPhone in the ICloud account and from ICloud their locator works.

Thanks for support,

you followed the doc here http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf and have entered the email & password using the SETTING tab and not the ADVANCED tab. right ? 
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 02:32:40 pm
Interesting,  maybe arrange the polling map so that the polling frequency is less than half the time it would take to come back from that distance ( in average ). a bit like the Nyquist-Shannon theorem   :-\  ( happy wiki ) , from my very partial understanding of it you try to sample a signal with a frequency at least the double of the signal frequency itself ...  here the "signal" you are sampling is your phone distance to home, the sampling frequency is the iCloud polling defined by the pollingmap , and you have to estimate your phone speed to come home ( car or walking ), based on that , inssure the polling is half what it would take the phone to come back home...

I honestly have not tried what I am writing about here, but sounded like a thought :) so sharing it.

my 1-2 hour theory above was just a (drastical) example to prove that the use of multiple polling maps is not a right approach. I tested (and thought about) it and stopped using it pretty quickly. :-)  Let's see what mikee123's experience is.

update: I've just read the Nyquist-Shannon theory article on wikipedia, and that's interesting indeed. Actually, this sounds like something that could (better) be hardcoded in the plugin than being put in one or multiple polling map(s) because, as you said already, traveling speed (car/walk, as far as you can calculate that with larger intervals...) does matter too in this case, direction doesn't. Interested? :-)
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on November 29, 2013, 06:08:51 pm
@amg0
I did enable debugging, and of course, when i approached the house - lights were on. The other day i had problems with my PLEG, so turned on debugging, has there been a problem since ? Of course not...  ???
Maybe i should turn on debugging on everything, keep it on and i would never have any problems  ::)
Never mind.

I will experiment with different polling maps and settings (with your PLEG suggestion duiffie), and of course report back here but it could take a few days before i have any idea of the effects, but i promise feedback.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 07:00:04 pm
Interesting,  maybe arrange the polling map so that the polling frequency is less than half the time it would take to come back from that distance ( in average ). a bit like the Nyquist-Shannon theorem   :-\  ( happy wiki ) , from my very partial understanding of it you try to sample a signal with a frequency at least the double of the signal frequency itself ...  here the "signal" you are sampling is your phone distance to home, the sampling frequency is the iCloud polling defined by the pollingmap , and you have to estimate your phone speed to come home ( car or walking ), based on that , inssure the polling is half what it would take the phone to come back home...

I honestly have not tried what I am writing about here, but sounded like a thought :) so sharing it.

I guess the theorem mentioned is way too much... Why not just use a different API: The Google Distance Matrix API (https://developers.google.com/maps/documentation/distancematrix/)

As far as I can see this API is much more realistic as it uses 'real roads' to calculate the actual travel distance/duration instead of a 'radius' between 2 locations.

As an example of the (huge!) difference between the 2 measurements: the plugin currently indicates that I'm 1.35km away from home now, the above API sais it's 2.2km => That last one is exactly the same distance as given on maps.google.com (http://maps.google.com) ;D

Usage:
Code: [Select]
https://maps.googleapis.com/maps/api/distancematrix/xml?origins=<current lat>,<current lon>&destinations=<home lat>,<home lon>&sensor=false
some other (optional) parameters available are:
* mode - specifies the mode of transport to use when calculating directions. Valid values are:
     - driving (default) indicates standard driving directions using the road network.
     - walking requests walking directions via pedestrian paths & sidewalks (where available).
     - bicycling requests bicycling directions via bicycle paths & preferred streets (currently only available in the US and some Canadian cities).
* language - The language in which to return results. See the list of supported domain languages. Note that we often update supported languages so this list may not be exhaustive.
* units - Specifies the unit system to use when expressing distance as text. See the Unit Systems section of this document for more information.

Another advantage is that you can use multiple destinations in 1 request, so in theory you could request this data for multiple 'home' locations (work, mistress etc.) without significant performance loss. Could be a nice one for a v2 or v3 release if there's a demand for that... Or the other way around: request the current address names and distances of all child devices with only 1 API call for all instead of 1 call per child.

The polling map function could be removed completely if this does what the API documentation says! The only thing to keep in mind is that Vera doesn't poll it too much; both Vera and Google won't like it if Vera checks it every second...  ;) Maybe you can replace the polling map with a 'minimum poll time' variable instead, with some security built in that this number can't be lower than 15 seconds or so? Or even better/easier: just build the security in and don't let the user change that number at all. Another problem would be that flying is not included in the results, so there also needs to be a hardcoded maximum poll period (1 or 1.5 hour(s) or so?).
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 29, 2013, 07:37:48 pm
The biggest problem with google, in my experience, is their penchant for suddenly dropping APIs (ref the Google Latitude plugin)
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 29, 2013, 07:40:16 pm
The biggest problem with google, in my experience, is their penchant for suddenly dropping APIs (ref the Google Latitude plugin)

I think another google api is currently used in the plugin to get the address name of the current location, so that won't really make a difference...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 30, 2013, 05:09:40 am
V1.64 displays the polling period selected by the plugin if that helps

I will look at Google api but a) there are some thresholds after which is stops responding to your ip address. 2 500 elements per 24 hour period across all your root devices and that also includes the addrsess reverse geolocation call I am already using ( alternative is to buy a key and use google business api)  and b) I would like to avoid to specialize the device in specific interest too much. for instance we could imagine to encapsulate a whole automotive logic & taking care of special calculation & polling needs into a seperate plug in which would work in concert with the iPhone plugin. 2 plugins can communicate using the UPNP interface. Thus keeping iPhone plug relatively simple and dedicated to its task : getting the distance and polling regularly iCloud
Title: Re: Plugin - IPhone Locator
Post by: duiffie on November 30, 2013, 05:14:56 am
V1.64 displays the polling period selected by the plugin if that helps

I will look at Google api but a) there are some thresholds after which is stops responding to your ip address. 2 500 elements per 24 hour period across all your root devices and that also includes the addrsess reverse geolocation call I am already using ( alternative is to buy a key and use google business api)  and b) I would like to avoid to specialize the device in specific interest too much. for instance we could imagine to encapsulate a whole automotive logic & taking care of special calculation & polling needs into a seperate plug in which would work in concert with the iPhone plugin. 2 plugins can communicate using the UPNP interface. Thus keeping iPhone plug relatively simple and dedicated to its task : getting the distance and polling regularly iCloud

Thanks for looking into it!

I think you can drop the reverse geolocation call completely because address names are included in the results of this API. As said in my previous post this API can handle multiple origin locations (=child devices) in only 1 call, so it's even better than the current reverse geolocation call that's needed per device.

Example:
Code: [Select]
http://maps.googleapis.com/maps/api/distancematrix/xml?origins=50.848714,4.351710|48.864999,2.316602&destinations=52.370989,4.895136&mode=driving&sensor=false
That specific call is for 2 child devices (locations are devided by a vertical bar). 1 person/'locator device' being in Brussels, and another one in Paris. 1 home location as destination is set in Amsterdam. API gives street names for all 3 locations and correct travel times and -distances for both the child devices.

Maybe this is then a nice replacement for the current default polling algorithm, I think this makes more sense. Who doesn't want longer (iPhone) battery life?  ;)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 30, 2013, 12:09:36 pm
That specific call is for 2 child devices (locations are devided by a vertical bar). 1 person/'locator device' being in Brussels, and another one in Paris. 1 home location as destination is set in Amsterdam. API gives street names for all 3 locations and correct travel times and -distances for both the child devices.

Maybe this is then a nice replacement for the current default polling algorithm, I think this makes more sense. Who doesn't want longer (iPhone) battery life?  ;)

Thanks for the information,  I looked at this and it could eventually optimize the number of calls to google but that 's all. not sure this can really help

a) it does not offer the decoding that the other api does and therefore would remove the complete functionality of the AddrFormat field where template can be used to chose which part of the address is shows. for privacy reason people want to see just the town for instance. When AddrFormat starts with a ~ character and the rest is a template string which contains variable names between '{' '}' like this: ~{street_number} {route},{postal_code} {locality}, {country}.   The names of variable are directly documented by google here: https://developers.google.com/maps/documentation/geocoding/?hl=fr#Types

b) it has no influence on phone battery , calls to google are not doing anything to your phone. 2 calls instead of 1 is irrelevant for the phone

maybe in a later version one could imagine a predictive arrival algorithm and to use this in the dynamic polling mode with empty polling map ( the one that is hard coded today ).  The user would have to select car walk or direct in plugin parameters, then the distance would be calculated with this other google API since it uses the actual roads for a car for instance and we would use then shannon rule to poll at more than half time period that it would take the phone to come back at current observed distance/time...

Could take quite a bit of time & effort  but feasible. ... *OR* somebody encapsulates this in a seperate "helper" plugin which talks to iPhoneLocator using its UPNP api and public variable to implement that logic. one day I feel brave,  I could try that

Keep the ideas coming ... that s what makes this forum interesting !

Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 30, 2013, 12:38:26 pm
@amg,

I have 2 discrete instances installed (and functioning) on my Vera. However, clicking on the "IPhone Detector Plugin" under the "Apps" tab in UI5, I'm only seeing the first instance I created (lowest device ID). This would mean that if I, for whatever reason, decided to delete that instance, the plugin would/may self-delete its files from my Vera regardless of whether I have a 2nd instance running.
Title: Re: Plugin - IPhone Locator
Post by: RichardTSchaefer on November 30, 2013, 12:42:08 pm
Deleting a plugin from the dashboard does not usually remove the implementation files.

Vera has a lot of bugs relating to deleting a plugin ... this is not one of them!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on November 30, 2013, 01:04:47 pm
@amg,

I have 2 discrete instances installed (and functioning) on my Vera. However, clicking on the "IPhone Detector Plugin" under the "Apps" tab in UI5, I'm only seeing the first instance I created (lowest device ID). This would mean that if I, for whatever reason, decided to delete that instance, the plugin would/may self-delete its files from my Vera regardless of whether I have a 2nd instance running.

I agree this part of vera is very buggy. I have seen many issues around multiple instance of plugin especially deleting. For instance, when I try to delete an instance, it completely delete all the plug in files and all instances. VERA does not keep track properly of reference counts between plug in files and plug in instances. quite annoying !

However, when I go to Apps tab and IPhone Plugin, it does list the 2 instances I have.  maybe it depends on how you installed them ? I did install initially from the store then from the plugin / create another button/
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on November 30, 2013, 01:38:56 pm
@amg,

I have 2 discrete instances installed (and functioning) on my Vera. However, clicking on the "IPhone Detector Plugin" under the "Apps" tab in UI5, I'm only seeing the first instance I created (lowest device ID). This would mean that if I, for whatever reason, decided to delete that instance, the plugin would/may self-delete its files from my Vera regardless of whether I have a 2nd instance running.

I agree this part of vera is very buggy. I have seen many issues around multiple instance of plugin especially deleting. For instance, when I try to delete an instance, it completely delete all the plug in files and all instances. VERA does not keep track properly of reference counts between plug in files and plug in instances. quite annoying !

However, when I go to Apps tab and IPhone Plugin, it does list the 2 instances I have.  maybe it depends on how you installed them ? I did install initially from the store then from the plugin / create another button/

Could be that it's how they got installed... At the moment I can't remember whether the two instances were installed in different ways (i.e. one through the store and one through an upload of the files).
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 01, 2013, 06:28:06 am
Thanks for the information,  I looked at this and it could eventually optimize the number of calls to google but that 's all. not sure this can really help

a) it does not offer the decoding that the other api does and therefore would remove the complete functionality of the AddrFormat field where template can be used to chose which part of the address is shows. for privacy reason people want to see just the town for instance. When AddrFormat starts with a ~ character and the rest is a template string which contains variable names between '{' '}' like this: ~{street_number} {route},{postal_code} {locality}, {country}.   The names of variable are directly documented by google here: https://developers.google.com/maps/documentation/geocoding/?hl=fr#Types

b) it has no influence on phone battery , calls to google are not doing anything to your phone. 2 calls instead of 1 is irrelevant for the phone

You're welcome.

a) agreed on functionality, but privacy is a big word... Every Vera user is still able to get all info of an iDevice by going to the advanced tab and use the CurLat and CurLong variables to see detailed location info and override this 'privacy' feature if they really want to know. Showing a city name is in my humble opinion still privacy sensitive information, better is to show nothing at all (only a distance) and remove/hide the CurLat and CurLong variables as well.

b) the calls to google don't matter on battery life indeed, but better/less polling to iCloud does help! The current reported distance (straight line between 2 points) is not very usable for polling time calculations, travel times based on max. speed and other algorythms should give much better results.

maybe in a later version one could imagine a predictive arrival algorithm and to use this in the dynamic polling mode with empty polling map ( the one that is hard coded today ).  The user would have to select car walk or direct in plugin parameters, then the distance would be calculated with this other google API since it uses the actual roads for a car for instance and we would use then shannon rule to poll at more than half time period that it would take the phone to come back at current observed distance/time...

That's exactly what I was thinking!

Could take quite a bit of time & effort  but feasible. ... *OR* somebody encapsulates this in a seperate "helper" plugin which talks to iPhoneLocator using its UPNP api and public variable to implement that logic. one day I feel brave,  I could try that

Is there any documentation on creating such a 'helper' plugin? I'd love to help.
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 01, 2013, 10:22:19 am
Deleting a plugin from the dashboard does not usually remove the implementation files.

Vera has a lot of bugs relating to deleting a plugin ... this is not one of them!

Yes, that was a rushed typo on my part. I meant the other plugin instances with their respective state information.

I'd go as far as arguing that here are cases where I'd consider the lack of impl file removal a bug in Vera. However, the odd case where plugins share files (most cases do not, including things like JSON libraries, etc) are probably enough justification to keep the files around.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 01, 2013, 12:05:58 pm
Is there any documentation on creating such a 'helper' plugin? I'd love to help.

Not really more doc than the documentation around in this forum for creating a plugin by hand. But then your plugin could have a variable called IPhonePluginDeviceID ( or something like that ) that the user can enter , and then you plugin code can do the usual luup set variable / get variable or call actions calls ( never tried, I just assume that would work ) using that IPhonePluginDeviceID to communicate with it

There is also a custom handler that IPhoneLocator Plugin implements in order to facilate communication and passing back and forth parameters & results between the javascript world and the lua world.
http://192.168.1.5:3480/data_request?id=lr_IPhone_Handler&command=echo&DeviceNum=xxx

That "handler" could be extended for future needs too and could be invoked by an external plugin. but the best would be to define a clean UPNP interface , however I encounter an issue about returning more than a simple field on a uPNP call request.

Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 01, 2013, 02:03:23 pm
I'm getting an "icloud refused access" error now. I reset the vera and reinstalled the app then that error appeared. Please let me know if there is a a fix. I couldn't find anything searching through the thread.
I tried adding my email and password in advanced section but still same error.

the Message("iCloud refused access, Check credentials ?") is given when a wrong iCloud email/pwd is being used ( or if you do not have iCloud account). You must not add Password directly in the ADVANCED section. You must do it in the SETTINGS section ( because the advanced section only store a encoded version of the password ). You can try to follow very closely the steps documented here: http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf

Just to update everyone and maybe help anyone that has the same problem I had with the icloud refused access error. I changed my icloud password to one without symbols and that fixed the issue. I'm not sure if it was the symbols specifically or the change in password that made it work. Maybe the developer could shed some light.

Thanks again for a great plugin!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 01, 2013, 02:36:42 pm
I'm getting an "icloud refused access" error now. I reset the vera and reinstalled the app then that error appeared. Please let me know if there is a a fix. I couldn't find anything searching through the thread.
I tried adding my email and password in advanced section but still same error.

the Message("iCloud refused access, Check credentials ?") is given when a wrong iCloud email/pwd is being used ( or if you do not have iCloud account). You must not add Password directly in the ADVANCED section. You must do it in the SETTINGS section ( because the advanced section only store a encoded version of the password ). You can try to follow very closely the steps documented here: http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf

Just to update everyone and maybe help anyone that has the same problem I had with the icloud refused access error. I changed my icloud password to one without symbols and that fixed the issue. I'm not sure if it was the symbols specifically or the change in password that made it work. Maybe the developer could shed some light.

Thanks again for a great plugin!

what was the symbol ?

this is how it is being used, the password is used with the email to construct a base64 encoded string
Code: [Select]
local mime = require('mime')
local b64credential = "Basic ".. mime.b64(username..":"..password)

which is then used in the HTML headers of the http request going to iCloud
Code: [Select]
local commonheaders = {
["Authorization"]=b64credential, --"Basic " + b64 encoded string of user:pwd
["Content-Type"] = "application/json; charset=utf-8",
                        etc...
}

anybody has any idea where it could come from ? maybe the mime.b64 encoder of vera ? or maybe string management of lua
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 01, 2013, 02:38:52 pm
V1.66 is posted on store as a private version: objective was to refactor the user interface of the SETTINGS tab in order to create more space for future evolutions/options.

http://apps.mios.com/test-plugin.php?id=4686&show=versions
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 01, 2013, 03:22:38 pm
...
anybody has any idea where it could come from ? maybe the mime.b64 encoder of vera ? or maybe string management of lua

While searching for the base64 character set all sites come up with the following supported characters: [a-zA-Z0-9+/]
* http://www.garykessler.net/library/base64.html (http://www.garykessler.net/library/base64.html)
* http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm (http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm)
* etc.

But the @ in the email address (iCloud username) is encoded properly, else the plugin didn't work for anyone...  :-\
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 01, 2013, 03:25:05 pm
Ampersand(&) and exclamation point (!)

Let me walk you through how the error happened so you can have a clearer picture to track down the problem. I was using a previous version of your plugin successfully with the same password for weeks. I then reset my UI5 (1.5.622) veralite to factory default to start from fresh since I was adding several more z-wave devices. I then installed the newest version with encryption and the error appeared.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 01, 2013, 03:33:12 pm
Sorry to be off topic but I received a few Estimote beacons in and was wondering if you could incorporate ibeacons into this app, making it even more precise and eliminating the battery drainage issue. PM me your mailing address and I'll order a set of 3 to your house for free.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 01, 2013, 03:49:42 pm
Sorry to be off topic but I received a few Estimote beacons in and was wondering if you could incorporate ibeacons into this app, making it even more precise and eliminating the battery drainage issue. PM me your mailing address and I'll order a set of 3 to your house for free.

that's another great idea and totally on topic: in-home location awareness based on bluetooth 4.0. won't replace current functionality, but perfect for switching lights on in the room that you are entering!

But as this is not an iphone specific function but cross platform I can imagine this being a separate plugin, maybe developed by people in this topic (http://forum.micasaverde.com/index.php/topic,16666.0.html)

more info on estimote here (http://estimote.com/api/index.html)

off-topic: I like the bleu-station (http://twocanoes.com/bleu-station/) more because of its size and quick developer response (very willing to interface the device with vera/home automation) in the topic mentioned above. Unfortunately there's no shipping outside the US yet, that's bad...  ;)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 01, 2013, 04:09:15 pm
Ampersand(&) and exclamation point (!)

Let me walk you through how the error happened so you can have a clearer picture to track down the problem. I was using a previous version of your plugin successfully with the same password for weeks. I then reset my UI5 (1.5.622) veralite to factory default to start from fresh since I was adding several more z-wave devices. I then installed the newest version with encryption and the error appeared.

very weird; can you search your vera for file L_IPhoneEnc*.* ; make sire there are no several version, eventually delete them all and reinstall the plugin from the store.

the encryption is nothing more than a b64 now so it is really weird, can you try this code in the test Lua Code window with putting your old password into the pwd table ? and check the log to see if we have any failure logged ?

Code: [Select]
local mime = require('mime')
local iPhoneEnc = require('L_IPhoneEnc')

function log(str)
  luup.log("IPhoneLocator:"..str,50)
end

function Encrypt(str)
  return str
end

function Decrypt(str)
  return str
end

function getPassword(pwd)
  pwd = mime.unb64(pwd)
  return Decrypt(pwd)
end

function setPassword(pwd)
  pwd = Encrypt(pwd)
  pwd = mime.b64(pwd)
  return pwd
end

function unitTestPassword()
local pwd = {
"abcdefgh",
"abcde!:/.;?fgh*%",
"abcde,#{[|`\^@",
"abcde\'ghi\"ljl",
"^??&#??@$???",
"sdfsdlkdsmf!sdf&dfdfs"
}
for k,v in pairs(pwd) do
local enc1 = setPassword(v)
local res2 = getPassword(enc1)
if (res2==v) then
log(string.format("pwdtest Success: %s : %s : %s",v,enc1,res2))
else
log(string.format("pwdtest Failure: %s : %s : %s",v,enc1,res2))
end
end
end

unitTestPassword()
return true
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 01, 2013, 04:21:09 pm
Sorry to be off topic but I received a few Estimote beacons in and was wondering if you could incorporate ibeacons into this app, making it even more precise and eliminating the battery drainage issue. PM me your mailing address and I'll order a set of 3 to your house for free.

Not sure how that would be possible, what is your idea exactly ? from what I could read on the web, the plugin runs on VERA which does not have a bluetooth capability. It seems Estimote provides beacon and simple objectiveC code , but code runs on the iPhone itself and uses the iPhone Bluetooth capability to detect iBeacon's presence

Maybe with some "helper" device with BT capability , one could detect the beacon when they come back home, then send a notification to the VERA plugin, all they would have to do is to call the UPNP action SetPresent on the plugin
Code: [Select]
        <action>
            <name>SetPresent</name>
            <argumentList>
                <argument>
                    <name>newPresentStatus</name>
                    <direction>in</direction>
                    <relatedStateVariable>Present</relatedStateVariable>
                </argument>
            </argumentList>
        </action>
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 02, 2013, 01:43:34 pm
...
anybody has any idea where it could come from ? maybe the mime.b64 encoder of vera ? or maybe string management of lua

While searching for the base64 character set all sites come up with the following supported characters: [a-zA-Z0-9+/]
* http://www.garykessler.net/library/base64.html (http://www.garykessler.net/library/base64.html)
* http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm (http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm)
* etc.

But the @ in the email address (iCloud username) is encoded properly, else the plugin didn't work for anyone...  :-\

yes and if you look at the code I posted in http://forum.micasaverde.com/index.php/topic,16907.msg138719.html#msg138719 you can see all crazy combination of strange characters I tested sucessfully. Really puzzled by this one. I hope @BillyBob919 can put his password inside the snipset of code I sent so we see if b64 encode/decode works
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 02, 2013, 02:13:22 pm
As said in my previous post: changing the poll map doesn't really make sense. If you still want to try this, follow these steps:

- In PLEG, create a device property for your iPhone device (field: IconCode), let's name it: iphoneA_iconcode
- Create 3 PLEG conditions:
  - (iphoneA_iconcode == 0)      name: iphoneA_steady
  - (iphoneA_iconcode == 25)      name: iphoneA_goaway
  - (iphoneA_iconcode == 75)      name: iphoneA_comehome

Next, create 3 scenes:
  - Name: steady (triggered by PLEG condition: iphoneA_steady)
  - Name: go_away (triggered by PLEG condition: iphoneA_goaway)
  - Name: come_home (triggered by PLEG condition: iphoneA_comehome)

add the following code to the luup-tab of these 3 scenes and change the NewPollMap variable accordingly:
Code: [Select]
local DEVICE_NO = xx -- your iphone locator device number
local SID = "urn:upnp-org:serviceId:IPhoneLocator1"

local NewPollMap = "0:600,1:60,2:120"

luup.variable_set(SID, "PollingMap", NewPollMap, DEVICE_NO)

return true

Don't forget to click 'Save lua' afterwards!

last but not least: in the advanced tab of the 3 scenes, initiate a refresh of the iphone device to apply the new pollmap

I have not had time to play with this the weekend, but i have implemented this now and will be testing these settings:

Steady   0:90,0.3:50,1.2:60,2.5:150,5:450,10:600,15:800,30:1200,50:1800,100:3000
Going Away   0:90,0.3:60,1.2:80,2.5:180,5:500,10:800,15:1100,30:1500,50:2000,100:3200
Coming close   0:90,0.3:30,1.2:50,2.5:120,5:300,10:450,15:600,30:1000,50:1600,100:2800

I will keep you updated of how I get on...
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 02, 2013, 04:03:10 pm
...
anybody has any idea where it could come from ? maybe the mime.b64 encoder of vera ? or maybe string management of lua

While searching for the base64 character set all sites come up with the following supported characters: [a-zA-Z0-9+/]
* http://www.garykessler.net/library/base64.html (http://www.garykessler.net/library/base64.html)
* http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm (http://email.about.com/od/emailbehindthescenes/l/blbase64enctabl.htm)
* etc.

But the @ in the email address (iCloud username) is encoded properly, else the plugin didn't work for anyone...  :-\

yes and if you look at the code I posted in http://forum.micasaverde.com/index.php/topic,16907.msg138719.html#msg138719 you can see all crazy combination of strange characters I tested sucessfully. Really puzzled by this one. I hope @BillyBob919 can put his password inside the snipset of code I sent so we see if b64 encode/decode works


Sorry, I haven't been in front of a computer yet. I should be able to give you an update in a few hours.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 03, 2013, 04:13:51 am
There wasn't a duplicate L_IPhoneEnc*.* file and the test ran successfully with the old password.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 03, 2013, 06:38:08 pm
I have a first working prototype with the google matrix api and a new parameter for distance calculation mode ( driving, walking, ... or direct ). when direct will be used , it will behave like today ( same code ) , when something else like driving is used, it will use the google matrix api in "driving" mode and therefore distance will be reported using the google matrix api ( taking roads into account ) instead of the direct line calculation of today.

I still have to debug and add error control to it before releasing.  I do see a little bit less precision in small distances but will soon post it to community for playing with it. I intend to make a V1.70 public release after this beta phase for receiving bugs & feedbacks
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 04, 2013, 02:51:18 am
I have a first working prototype with the google matrix api and a new parameter for distance calculation mode ( driving, walking, ... or direct ). when direct will be used , it will behave like today ( same code ) , when something else like driving is used, it will use the google matrix api in "driving" mode and therefore distance will be reported using the google matrix api ( taking roads into account ) instead of the direct line calculation of today.

I still have to debug and add error control to it before releasing.  I do see a little bit less precision in small distances but will soon post it to community for playing with it. I intend to make a V1.70 public release after this beta phase for receiving bugs & feedbacks

Great news! Let me know if I can help.

Edit: Besides driving and walking, don't forget to add bicycling as an option (for Dutch people like me  ;))
Title: Re: Plugin - IPhone Locator
Post by: Thiemen on December 04, 2013, 03:07:39 pm
don't forget to add bicycling as an option (for Dutch people like me  ;))

+1
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 04, 2013, 04:56:19 pm
I released a beta version V1.67 on http://apps.mios.com/test-plugin.php?id=4686&show=versions

if you upgrade from a version that is older than V1.63 then please make sure you read the post about implication of the root device selection feature : http://forum.micasaverde.com/index.php/topic,16907.msg138331.html#msg138331

V1.67 features

This is a beta version, so you could expect some bugs so beware and thanks for the feedbacks.
once stable it ll probably become a public V2.0 on the store
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 05, 2013, 01:38:11 am
...
This is a beta version, so you could expect some bugs so beware and thanks for the feedbacks.
once stable it ll probably become a public V2.0 on the store

My PollMap setting was still filled in while changing to driving mode. As a result the polling period until the next poll was shown in the plugin, but the time corresponded to the configured PollMap and not to the actual driving time / 2. When I removed the PollMap, the polling period changed to 60 (default polling period from the plugin settings). So it seems that the new calculation result isn't really used yet... Distance is working as expected, it's now reporting the same distance as google maps so that seems to be fine!

Example
my PollMap: 0:600,...,2:299,3:359,...
my current distance from home: 2.4km
driving time according to google matrix: 336 sec.
expected next poll in the device: 336/2 = 168 sec.

the plugin now shows, after reloading vera and refreshing the browser, that the next poll (as added in v1.64) will be in: 299 s
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 05, 2013, 06:10:48 pm
...
This is a beta version, so you could expect some bugs so beware and thanks for the feedbacks.
once stable it ll probably become a public V2.0 on the store

My PollMap setting was still filled in while changing to driving mode. As a result the polling period until the next poll was shown in the plugin, but the time corresponded to the configured PollMap and not to the actual driving time / 2. When I removed the PollMap, the polling period changed to 60 (default polling period from the plugin settings). So it seems that the new calculation result isn't really used yet... Distance is working as expected, it's now reporting the same distance as google maps so that seems to be fine!

Example
my PollMap: 0:600,...,2:299,3:359,...
my current distance from home: 2.4km
driving time according to google matrix: 336 sec.
expected next poll in the device: 336/2 = 168 sec.

the plugin now shows, after reloading vera and refreshing the browser, that the next poll (as added in v1.64) will be in: 299 s

Expected behavior indeed, v1.67 did not include this feature yet.  I just released a private V1.68 with that automatic polling determination feature. Quite experimental yet...

v1.67

v1.68
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 06, 2013, 08:36:25 am
Expected behavior indeed, v1.67 did not include this feature yet.  I just released a private V1.68 with that automatic polling determination feature. Quite experimental yet...

Ok, I already thought so. :) Thanks for releasing new versions this quickly, that's really great!

One question about the PollingAuto mode. Why would we still want to calculate this while the matrix api already gives ETA based on actual speeding limits and obstacles on the route (and possibly even traffic jams)? Why not replace:
Code: [Select]
-- estimated time of arrival, in seconds
function ETA(lul_device)
        ...
end

with a simple loop in the getDistancesAddressesMatrix function, like:
Code: [Select]
                                        for key,value in pairs(obj["rows"]) do
                                                local ETA = value["elements"][key]["duration"]["value"]
                                                durations[key]=ETA  -- in seconds
                                        end
I know it needs more code then this small part above; this is just to present you the idea, you're probably much better in writing code than me...  ;D

Another one: If the iPhone is not moving and not present, wouldn't it then be better to have polling times based on the above logic instead of using the default PollingBase? Using a hardcoded value while not moving and being away is difficult, because you want to include distance in that algorithm and not only the current speed indication. For example: if I'm 100km away from home (not moving) and the PollingBase is 300 sec. that's not very battery friendly because I won't even be near home within those 5 minutes. On the other side, if I'm 2 blocks away from home and not moving then I could be arriving at home within those 5 minutes. Polling will be too late in that case.

What about the following PollingAuto proposal. This seems more 'safe' (always in time), more battery efficient and covers both the examples above:
There has got to be a hardcoded minimum polling time too to prevent Vera from polling too much (always > 10 sec.?); I guess Vera's CPU, the iPhone battery and Google won't like it when we poll every second when we're almost at home. Don't know if that's already included in the code, couldn't find it...
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 06, 2013, 05:00:21 pm
not sure what happened to my previous reply. seems gone. so I re-rereply
One question about the PollingAuto mode. Why would we still want to calculate this while the matrix api already gives ETA based on actual speeding limits and obstacles on the route (and possibly even traffic jams)?

Yes I thought too, I am not sure which is better as with real speed you do get the reality , versus with google you get some unknown assumptions on speed.

Another one: If the iPhone is not moving and not present, wouldn't it then be better to have polling times based on the above logic instead of using the default PollingBase? Using a hardcoded value while not moving and being away is difficult, because you want to include distance in that algorithm and not only the current speed indication. For example: if I'm 100km away from home (not moving) and the PollingBase is 300 sec. that's not very battery friendly because I won't even be near home within those 5 minutes. On the other side, if I'm 2 blocks away from home and not moving then I could be arriving at home within those 5 minutes. Polling will be too late in that case.

What about the following PollingAuto proposal. This seems more 'safe' (always in time), more battery efficient and covers both the examples above:
  • Moving towards home = MatrixETA / 2
  • Not moving = MatrixETA / 1.5
  • Moving away from home = MatrixETA
  • Present (at home) = PollingBase
yes, it is correct. I struggle with one concern nevertheless. if you are at 30mn from home , the phone location not updated until 15mn could be a concern. the google map would not be updated , nor the UI dashboard . Not the best user experience.  maybe we need to split the ETA in 5 or more chunks to get more frequent updates

There has got to be a hardcoded minimum polling time too to prevent Vera from polling too much (always > 10 sec.?); I guess Vera's CPU, the iPhone battery and Google won't like it when we poll every second when we're almost at home. Don't know if that's already included in the code, couldn't find it...
yes added

If you install v1.68 from the store and then override with this file ( here attached ) you can have the new features. for now i keep it simple: home = pollbase , away = Google matrix ETA/5, min polling = 10s.  ( allways install v1.68 from the store before uploading this file )
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 07, 2013, 05:14:28 am
yes, it is correct. I struggle with one concern nevertheless. if you are at 30mn from home , the phone location not updated until 15mn could be a concern. the google map would not be updated , nor the UI dashboard . Not the best user experience.  maybe we need to split the ETA in 5 or more chunks to get more frequent updates
Is a ForceRefresh possible while opening the device configuration/maps page? Then it only does the extra poll when it's needed to preserve the user experience as well as battery life. For updating the location on the dashboard users can use the (manual) Refresh button. Keep in mind that Vera is meant for home automation, not for tracking people and thus always having to know a last location.  ;)

yes added

If you install v1.68 from the store and then override with this file ( here attached ) you can have the new features. for now i keep it simple: home = pollbase , away = Google matrix ETA/5, min polling = 10s.  ( allways install v1.68 from the store before uploading this file )
Thanks! I manually changed the ETA/5 to ETA/2 too for some testing, here are the results.
GoogleMatrix data
Distance: 2.48 km
ETA: 350 sec.

Poll periods
1.68b: 440 sec. (=too late)
1.68c (ETA/5): 70 sec. (=iPhone on charger all day)
1.68c (ETA/2): 175 sec. (=iPhone a little bit less on charger ;))
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 07, 2013, 06:41:09 am
Thanks! I manually changed the ETA/5 to ETA/2 too for some testing, here are the results.
GoogleMatrix data
Distance: 2.48 km
ETA: 350 sec.

Poll periods
1.68b: 440 sec. (=too late)
1.68c (ETA/5): 70 sec. (=iPhone on charger all day)
1.68c (ETA/2): 175 sec. (=iPhone a little bit less on charger ;))

I see one challenge with a polling frequency that operates with 1/2 the expected time until destination. What if (when) Google is wrong on their time estimate?

In more rural areas, they often are in my experience. By as much as 15-30%. As in, their estimate is too conservative by as much as 1/3. For instance:

Being that I live in the more rural states in the US, driving is a "have to" in order to get anywhere. My daily trip to work is, according to Google a 34 minutes drive. However, they do not account for the fact that I'm traveling 75-80mph due to the flow of the traffic (speed limit is 65) and traffic updates in their service are often off (incorrect).

Between the office and my home, it's about 70-75% highway speed and the rest is below highway speed. Google is the most accurate at calculating my travel time, but they're typically off by somewhere between 5 & 10 _minutes_ on that distance.

From my perspective, it may make sense to add a "if moved by less than X% of total distance from range/home AND speed is < Y since last poll, then slow polling to 1/2*ETA". Otherwise, raise it back up to "while traveling at speed rates". Otherwise, those of us using distances to home (within range of X) to trigger "heat on to warm the house", etc may have problems with the new approach to polling)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 07, 2013, 09:12:26 am
Thanks! I manually changed the ETA/5 to ETA/2 too for some testing, here are the results.
GoogleMatrix data
Distance: 2.48 km
ETA: 350 sec.

Poll periods
1.68b: 440 sec. (=too late)
1.68c (ETA/5): 70 sec. (=iPhone on charger all day)
1.68c (ETA/2): 175 sec. (=iPhone a little bit less on charger ;))

I see one challenge with a polling frequency that operates with 1/2 the expected time until destination. What if (when) Google is wrong on their time estimate?

In more rural areas, they often are in my experience. By as much as 15-30%. As in, their estimate is too conservative by as much as 1/3. For instance:

Being that I live in the more rural states in the US, driving is a "have to" in order to get anywhere. My daily trip to work is, according to Google a 34 minutes drive. However, they do not account for the fact that I'm traveling 75-80mph due to the flow of the traffic (speed limit is 65) and traffic updates in their service are often off (incorrect).

Between the office and my home, it's about 70-75% highway speed and the rest is below highway speed. Google is the most accurate at calculating my travel time, but they're typically off by somewhere between 5 & 10 _minutes_ on that distance.

From my perspective, it may make sense to add a "if moved by less than X% of total distance from range/home AND speed is < Y since last poll, then slow polling to 1/2*ETA". Otherwise, raise it back up to "while traveling at speed rates". Otherwise, those of us using distances to home (within range of X) to trigger "heat on to warm the house", etc may have problems with the new approach to polling)

@duiffie thank you for the feedbacks and precise testing.
@sjolshagen,  without fully understanding why I feel a bit like you do; To marry both approaches I propose to make the "divider" a parameter so some of us can chose ETA/2 and some can choose more agressive ETA/n.  Also note that you can continue to use pollingmap in which case none of that discussion applies , the pollingmap takes precedence. this new automatic mode only is when autopolling is selected and pollingmap is empty
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 07, 2013, 10:14:02 am
V1.69 is released as a private version on the store
http://apps.mios.com/test-plugin.php?id=4686&show=versions

Features:

(*): ETA - Estimated Time of Arrival
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 07, 2013, 12:07:08 pm
Just installed v1.69 (fresh install, not an update) and it says v1.62? .....My mistake, if your not already logged into MIOS and you click the link to download the beta it takes you to the v1.62 page. If your already logged into MIOS it takes you to the page with the listed versions. I have v1.69 installed now. Will do some testing today and tomorrow.

@amg0 I like the polling divider factor as I'm in LA and traffic estimates are usually off as @sjolshagen said.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 07, 2013, 02:04:25 pm
I have the Home Range set to .05 Statute Mile and every now and then it thinks my iPhone is more than a half mile away. Usually occurs on a IU5 Reload.
Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on December 07, 2013, 04:09:13 pm
to all testing in the USA:

I just upgraded from v1.62 to v1.69 and thought I'd try the distance from home using the new Distance Mode: "Driving"

I noticed it was way off, so I manually entered the coordinates in Google Maps & calculated directions to double check. Google Maps is calculating distance correctly.

It seems that the distance in the plugin is calculating km no matter whether the user setting is kilometer, nautical mile, or statute miles.

I don't use any polling. Is there another setting I'm missing?

Thanks,

Chris
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 07, 2013, 05:11:13 pm
to all testing in the USA:

I just upgraded from v1.62 to v1.69 and thought I'd try the distance from home using the new Distance Mode: "Driving"

I noticed it was way off, so I manually entered the coordinates in Google Maps & calculated directions to double check. Google Maps is calculating distance correctly.

It seems that the distance in the plugin is calculating km no matter whether the user setting is kilometer, nautical mile, or statute miles.

I don't use any polling. Is there another setting I'm missing?

Thanks,

Chris
good catch, I need to fix the bug , here is a quick fix for now ...
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 07, 2013, 07:03:02 pm
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.
Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on December 07, 2013, 09:49:43 pm
good catch, I need to fix the bug , here is a quick fix for now ...

Thanks amg0, that did the trick

Chris
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 08, 2013, 10:08:58 am
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.

I wonder if this is one of these situation that in places where the phone loses sight to GPS satellite it switches to 3G cell or wifi based location and then it loses a lot accuracy, not sure we can do anything about that
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 08, 2013, 11:44:42 am
Just released a private version on the store V1.69c
http://apps.mios.com/test-plugin.php?id=4686&show=versions

This is the release candidate for a public v1.70 so you can let me know if you encounter any new issues

It  includes:
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 08, 2013, 11:51:18 am
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.

I wonder if this is one of these situation that in places where the phone loses sight to GPS satellite it switches to 3G cell or wifi based location and then it loses a lot accuracy, not sure we can do anything about that

It may be, with the previous version (before 1.62) I had the home range set to .05 Statute miles and it worked great, when I lost signal it wouldn't drop me more than .03 miles away.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 08, 2013, 12:00:33 pm
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.

I wonder if this is one of these situation that in places where the phone loses sight to GPS satellite it switches to 3G cell or wifi based location and then it loses a lot accuracy, not sure we can do anything about that

It may be, with the previous version (before 1.62) I had the home range set to .05 Statute miles and it worked great, when I lost signal it wouldn't drop me more than .03 miles away.
what is your distance calculation mode ( DistanceMode variable ) ?
Did you apply the fix for units ( included in latest private version 1.69c ) ?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 08, 2013, 12:02:06 pm
what is your distance calculation mode ( DistanceMode variable ) ?
Did you apply the fix for units ( included in latest private version 1.69c ) ?

0.3mn is 0.48 km
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 08, 2013, 01:29:11 pm
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.

I wonder if this is one of these situation that in places where the phone loses sight to GPS satellite it switches to 3G cell or wifi based location and then it loses a lot accuracy, not sure we can do anything about that

It may be, with the previous version (before 1.62) I had the home range set to .05 Statute miles and it worked great, when I lost signal it wouldn't drop me more than .03 miles away.
what is your distance calculation mode ( DistanceMode variable ) ?
Did you apply the fix for units ( included in latest private version 1.69c ) ?

It's set to Driving. I haven't applied the fix yet. I believe in the earlier versions the range shown on the map was .03 miles.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 08, 2013, 01:40:01 pm
I'm having issues when I put the phone in my pocket and/or it looses reception it estimates my iPhone's location about .3 miles away. It seems like it happens every 10 minutes. The only way to remedy is to set the Home Range to .5 Statute Miles, which is way to large of a range.

I wonder if this is one of these situation that in places where the phone loses sight to GPS satellite it switches to 3G cell or wifi based location and then it loses a lot accuracy, not sure we can do anything about that

It may be, with the previous version (before 1.62) I had the home range set to .05 Statute miles and it worked great, when I lost signal it wouldn't drop me more than .03 miles away.
what is your distance calculation mode ( DistanceMode variable ) ?
Did you apply the fix for units ( included in latest private version 1.69c ) ?

It's set to Driving. I haven't applied the fix yet. I believe in the earlier versions the range shown on the map was .03 miles.

Prior to v1.67 we did not have google distance calculation.
First thing I suggest is install latest v1.69 from the store, then go into SETTING/POLLING and switch back to "direct" in the DistanceMode parameter.  this makes the plugin use the old distance calculation algorythm.  Any other mode will use the distance, as calculated by Google and there is a degree on uncertainty here. you could also try the walking or bicycling mode , because the driving mode depends on roads and that could some issues for google...
Title: Re: Plugin - IPhone Locator
Post by: parkerc on December 09, 2013, 02:38:29 am
Hi @amg0

Wow..  500 posts in 2 month is good going, well done..

Now while I can't do it myself it was discussed/agreed with MCV that any plugin posts with more 500 responses would get promoted to its own child board. Giving you (and your community of contributors (CoC)) more options to create related threads and find information more easily.

@mcvflorin or and other @mcvxxxxx or anyone with suitable forum privileges. If you are reading this -  Please can this plugin be promoted to it's old child board? Plus (if possible) it might  be good to bring the original thread over from scene scripting too.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 09, 2013, 06:25:18 am
Can someone explain to me how dynamic polling works? Does it poll more often the closer I get to home? I'm trying to figure out if it makes sense to enable this. I currently use the plug in to turn on lights when either my wife or I arrive home after dark.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 09, 2013, 06:32:41 am
Can someone explain to me how dynamic polling works? Does it poll more often the closer I get to home? I'm trying to figure out if it makes sense to enable this. I currently use the plug in to turn on lights when either my wife or I arrive home after dark.

yes, the closer you come to your home, the more it polls. please check the 1st post in this thread, everything is explained there.

Quote
?Dynamic Polling: enables to chose a polling duration based on the distance of the device, but the Polling considered is the minimal of all required polling between all devices managed from this same iCloud account

You can test several scenario's. I hope this covers them all:
- disable dynamic polling, the PollingBase variable will then be used (a static time, not distance related)
- enable dynamic polling with a custom PollingMap. you can create your own polling map, polling is done based on distance but doesn't take actual speed limits into account
- enable dynamic polling without a PollingMap (keep it empty) and the 'direct' calculation mode. this mode calculates the distance between your home and the current location and calculates a polling time based on that distance (straight line between those 2 points, no roads are involved)
- enable dynamic polling without a PollingMap and another option than 'direct' (walking, bicycling, driving). this mode contacts google maps, and lets google calculate distance and the time (based on the chosen mode) until you're home. you can optionally use PollingDivider here to chop that time in chunks so that it'll check more often. formula: estimated time arrival by google / PollingDivider
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 09, 2013, 12:34:13 pm
Just to report back on my usage of the custom polling maps which i set with PLEG, depending on me being stationary, moving away or moving close. So far it is working well, i am not sure if i gained much in accuracy or battery life. But it feels more accurate, so far it is better in picking up that i am coming home, where before it did not always, now since the change it has not failed once. I have seen the new version, which probably makes what i am trying redundant, and ultimately is probably better. I am still on 1.66 though, and i think i will wait a little before i try the new features in 1.69.
On the new version, I wonder what happend if i would set that to walking, and then instead drive home by car, would that then screw up the polling as you come close far quicker than it would expect ? How are people getting on with it ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 09, 2013, 01:43:57 pm
Just to report back on my usage of the custom polling maps which i set with PLEG, depending on me being stationary, moving away or moving close. So far it is working well, i am not sure if i gained much in accuracy or battery life. But it feels more accurate, so far it is better in picking up that i am coming home, where before it did not always, now since the change it has not failed once. I have seen the new version, which probably makes what i am trying redundant, and ultimately is probably better. I am still on 1.66 though, and i think i will wait a little before i try the new features in 1.69.
On the new version, I wonder what happend if i would set that to walking, and then instead drive home by car, would that then screw up the polling as you come close far quicker than it would expect ? How are people getting on with it ?

@Mikee123, it would indeed seriously screw up the result.  a) google would take roads ( or not ) depending on the mode it think you use and would calculate the ETA based on that assumption.

So I have kept the "direct" mode which garantees the plugin behaves as prior version and I am thinking of adding a variable like "real time speed" so we can maybe adjust mode based on observed speed with a PLEG... that really starts to become complex.  :-\ not sure it is worth it. lots of different users & use cases, not sure there is one that fits every body.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 09, 2013, 02:40:35 pm
No you cannot please everybody, as you said, too many different needs. But it is great already. At the moment it does what i want. I love the idea of google calculating, but i cannot always change mode if i change from walking to driving. And my way home for example is train then walking... fairly impossible to cover that. Even if I could, the other half is a different story...
The only way to cover that properly is to work out average speed coming home, and adjusting polling accordingly. But i agree, thats probably very complicated. It would be possible in PLEG i am sure, but quite tricky. I'd like to do it as it would give even more accuracy and save battery, i have the other half moaning that her battery only lasts a day while it used to last 3 or 4 days... but i am not sure i have the time and the knowledge to do that properly in PLEG.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 09, 2013, 03:04:04 pm
No you cannot please everybody, as you said, too many different needs. But it is great already. At the moment it does what i want. I love the idea of google calculating, but i cannot always change mode if i change from walking to driving. And my way home for example is train then walking... fairly impossible to cover that. Even if I could, the other half is a different story...
The only way to cover that properly is to work out average speed coming home, and adjusting polling accordingly. But i agree, thats probably very complicated. It would be possible in PLEG i am sure, but quite tricky. I'd like to do it as it would give even more accuracy and save battery, i have the other half moaning that her battery only lasts a day while it used to last 3 or 4 days... but i am not sure i have the time and the knowledge to do that properly in PLEG.

did she upgrade to iOS7 ? ;) usually, it does not help... so many settings and apps doing stuff in background which you have to control apps per apps in the menu...

with the configuration "direct mode , with auto polling and no polling map", the plugin will calculate distance,  calculate average speed from last polling, calculate the ETA ( diff of distance / diff of time ) from these parameters and divide the ETA by the divider to determine the next polling.  if diff of distance was too small ( device not moving ) it will take the polling base . this could be a good mode to try out. After all we do not really care if ETA is accurate ( using roads or not ) we care more if we can accurately predict arrival...
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 09, 2013, 04:20:08 pm
No she is still on 5.12, havent updated to IOS7 as there is no jailbreak yet...
The direct mode, is that in 1.69 or is that in 1.66 ? And could (if i do not like it) have my PLEGs still set polling maps ? Then i could have hers on direct mode, while i stay on different polling maps (or the other way round)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 09, 2013, 04:41:59 pm
No she is still on 5.12, havent updated to IOS7 as there is no jailbreak yet...
The direct mode, is that in 1.69 or is that in 1.66 ? And could (if i do not like it) have my PLEGs still set polling maps ? Then i could have hers on direct mode, while i stay on different polling maps (or the other way round)

yes it should work the same.  but I just fixed a bug in child devices so you should consider upgrade to the version I am going to post in a few minutes
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 09, 2013, 05:00:37 pm
Published v1.69d with the following improvements

Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 10, 2013, 05:24:22 am
I have just updated to 1.69d. Question, if i want the direct mode, do i leave the polling map empty, or what happens if i have anything in the polling map ?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 10, 2013, 05:31:07 am
I have just updated to 1.69d. Question, if i want the direct mode, do i leave the polling map empty, or what happens if i have anything in the polling map ?

Leaving the polling map empty will use the default algorithm as explained by amg0 before. If you have anything in the polling map, it'll use those values.
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 10, 2013, 05:32:18 am
Published v1.69d with the following improvements

  • New variable: RTSpeed to keep track of last observed real time speed ( calculated ) in unit/h
  • New line in UI5 dashbard to indicate distance+speed
  • Color coded markers on google map
  • Draggable marker for Home base on google map, moving the marker will set your Home base location
  • Optimization of ETA algorythm : reduction of polling random delay ( from 0..10s to 0..4s ) and reduction of indicated ETA by a  ETA_LATENCY=30 s value to compensate for iCloud latency
  • fix a bug for child device in driving mode not using the right home base lat,long value

again: great improvements! this version still works fine for me.
Title: Re: Plugin - IPhone Locator
Post by: mikee123 on December 10, 2013, 05:39:30 am
OK, so

Quote
current location and calculates a polling time based on that distance (straight line between those 2 points, no roads are involved)

Is there a way to find out what these polling intervals are ? So basically if i have it as direct with using my custom polling maps it does exactly what it did in 1.66

Quote
?Optimization of ETA algorythm : reduction of polling random delay ( from 0..10s to 0..4s ) and reduction of indicated ETA by a  ETA_LATENCY=30 s value to compensate for iCloud latency

This only applies if i use the google calculations ?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 10, 2013, 06:09:14 am
Is there a way to find out what these polling intervals are ?
these are dynamic, related to distance. in the plugin you should be able to see when the next poll occurs

So basically if i have it as direct with using my custom polling maps it does exactly what it did in 1.66
exactly

Quote
?Optimization of ETA algorythm : reduction of polling random delay ( from 0..10s to 0..4s ) and reduction of indicated ETA by a  ETA_LATENCY=30 s value to compensate for iCloud latency

This only applies if i use the google calculations ?
not sure. previously ETA was used for google matrix related stuff, but I guess the reduction of polling random delay is an overall plugin setting and that  may also apply to the reduction to compensate iCloud latency (sounds reasonable)
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 10, 2013, 06:37:55 am
Quote
?Optimization of ETA algorythm : reduction of polling random delay ( from 0..10s to 0..4s ) and reduction of indicated ETA by a  ETA_LATENCY=30 s value to compensate for iCloud latency

This only applies if i use the google calculations ?
not sure. previously ETA was used for google matrix related stuff, but I guess the reduction of polling random delay is an overall plugin setting and that  may also apply to the reduction to compensate iCloud latency (sounds reasonable)

The polling random delay is a fudge factor added to ensure every plugin instance doesn't hit the iCloud at the exact same time (which would start  happening after a Luup/Lua reload, for instance).

The iCloud latency gets subtracted from the ETA to account for any movement due to the time it takes for the iCloud to poll the device and return the information to the calling function. Don't know that a value of 30 is scientific and 100% accurate(?), but it's probably good enough.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 10, 2013, 07:50:20 am
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 10, 2013, 01:11:43 pm
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?

without more details / log file it is hard to answer for sure. but yes the driving option could have an impact , as a slight gps position change, could be seen by google as a more drastic change of address and therefore google may calculate the distance using a different path and put you OFF your range. since GPS location tends to move a little bit, conceptually this could happen. Another possiblity is a vera reboot during the night & maybe it fires some trigger but I doubt.

suggestions:
a) enable debug / track in LOGs when that happen , you can search for IPhoneLocator string or "Present" string which will show you when the variable "Present" is being changed
b) try to increase the home range to be a little bit more on the safe side , eventually move off the HomeBase position ( using the new google map drag and drop feature that is easy ) to a more central location compared to where your devices are positions
c) try direct mode

hope this will help
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 10, 2013, 01:19:27 pm
Quote
?Optimization of ETA algorythm : reduction of polling random delay ( from 0..10s to 0..4s ) and reduction of indicated ETA by a  ETA_LATENCY=30 s value to compensate for iCloud latency

This only applies if i use the google calculations ?
not sure. previously ETA was used for google matrix related stuff, but I guess the reduction of polling random delay is an overall plugin setting and that  may also apply to the reduction to compensate iCloud latency (sounds reasonable)

The polling random delay is a fudge factor added to ensure every plugin instance doesn't hit the iCloud at the exact same time (which would start  happening after a Luup/Lua reload, for instance).

The iCloud latency gets subtracted from the ETA to account for any movement due to the time it takes for the iCloud to poll the device and return the information to the calling function. Don't know that a value of 30 is scientific and 100% accurate(?), but it's probably good enough.

All this is correct. The ETA_LATENCY is an empiric trial of 30s , deducted from calculated (direct mode) or indicated ( google modes) ETA and only applies to configurations where auto polling mode is on & no polling map is specified.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 10, 2013, 03:30:01 pm
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?

I would create a scene to MUTE the iPhone locator plugin when you are home. For example I use the Ping Sensor plugin and motion detectors to determine if I'm home. When I'm home my battery drain is normal and no sporadic scene's running (I think the reason is iCloud drops me .3 miles away when I lose reception.)
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 10, 2013, 03:48:20 pm
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?

without more details / log file it is hard to answer for sure. but yes the driving option could have an impact , as a slight gps position change, could be seen by google as a more drastic change of address and therefore google may calculate the distance using a different path and put you OFF your range. since GPS location tends to move a little bit, conceptually this could happen. Another possiblity is a vera reboot during the night & maybe it fires some trigger but I doubt.

suggestions:
a) enable debug / track in LOGs when that happen , you can search for IPhoneLocator string or "Present" string which will show you when the variable "Present" is being changed
b) try to increase the home range to be a little bit more on the safe side , eventually move off the HomeBase position ( using the new google map drag and drop feature that is easy ) to a more central location compared to where your devices are positions
c) try direct mode

hope this will help

From doing a bit more reading it sounds like the most likely situation is for whatever reason my phone is showing up as being outside the .2 KM designated as "Present" in the middle of the night. I've taken your suggestion and increased the threshold distance to .5 miles. There is nowhere within .5 miles of my house that I would ever be so increasing it to that distance shouldn't trigger any false positives. I'll give it a couple nights and see if the issue happens again. If it does I'll move on to the next suggestion. Thanks so much for the help everyone.
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 10, 2013, 03:51:55 pm
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?

I would create a scene to MUTE the iPhone locator plugin when you are home. For example I use the Ping Sensor plugin and motion detectors to determine if I'm home. When I'm home my battery drain is normal and no sporadic scene's running (I think the reason is iCloud drops me .3 miles away when I lose reception.)

Do you use the ping sensor plugin to sense when your iPhone is connected to your home wifi? If so can you give some more details on how you do that? Thanks!
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 10, 2013, 04:09:43 pm
Just noticed another issue. I think it started this morning when I updated to the latest version of the plugin (1.69d). From the main UI5 devices screen it is reporting my phone's location as my work address, which is where I was this morning. I'm no longer at work however. When I click on the settings for the device and click on the map it is showing the correct location but it still lists the wrong address on the main screen. The two locations (where I am now and where I work) are miles apart. Also, the "Control" tab of my phone is looking a little funny. I've attached a screenshot to show what I'm talking about. Any suggestions?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 10, 2013, 04:45:34 pm
Just noticed another issue. I think it started this morning when I updated to the latest version of the plugin (1.69d). From the main UI5 devices screen it is reporting my phone's location as my work address, which is where I was this morning. I'm no longer at work however. When I click on the settings for the device and click on the map it is showing the correct location but it still lists the wrong address on the main screen. The two locations (where I am now and where I work) are miles apart. Also, the "Control" tab of my phone is looking a little funny. I've attached a screenshot to show what I'm talking about. Any suggestions?
wow, not seen this in a while; usually this is indication of a incomplete installation or plugin crash somewhere in the code. the device refresh code fails , then the loop code recovers from the exception and add the /period to the string.  it keeps repating this over and over and since the plug in crashed the text message is not refreshed.

please try this: a) reinstall from the store b) make sure you RELOAD lua ( blue reload button in top right ) , c) make sure you do a clean refresh of your browser ( ctrl+F5 or shift+F5 depending on browser )
if this happens again, please go in control tab and press the DEBUG button, then let it run for a while and you can send a private message to me with your log file ( luaUPnp.log file in /var/log/cmh/ folder on vera ) so I can look at it
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 10, 2013, 05:39:19 pm
Just noticed another issue. I think it started this morning when I updated to the latest version of the plugin (1.69d). From the main UI5 devices screen it is reporting my phone's location as my work address, which is where I was this morning. I'm no longer at work however. When I click on the settings for the device and click on the map it is showing the correct location but it still lists the wrong address on the main screen. The two locations (where I am now and where I work) are miles apart. Also, the "Control" tab of my phone is looking a little funny. I've attached a screenshot to show what I'm talking about. Any suggestions?
wow, not seen this in a while; usually this is indication of a incomplete installation or plugin crash somewhere in the code. the device refresh code fails , then the loop code recovers from the exception and add the /period to the string.  it keeps repating this over and over and since the plug in crashed the text message is not refreshed.

please try this: a) reinstall from the store b) make sure you RELOAD lua ( blue reload button in top right ) , c) make sure you do a clean refresh of your browser ( ctrl+F5 or shift+F5 depending on browser )
if this happens again, please go in control tab and press the DEBUG button, then let it run for a while and you can send a private message to me with your log file ( luaUPnp.log file in /var/log/cmh/ folder on vera ) so I can look at it

I uninstalled v 1.69 then installed v1.69d and am getting a -911 device not ready error. Doing a re-install now.

12/10/13 14:30:37.263    <0x2b5b5680>
08   12/10/13 14:30:39.500   JobHandler_LuaUPnP::HandleActionRequest device: 197 service: urn:upnp-org:serviceId:IPhoneLocator1 action: ForceRefresh <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=197 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:IPhoneLocator1 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument action=ForceRefresh <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument PresentStatus=0 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.24461934528709484 <0x2f7f6680>
02   12/10/13 14:30:39.502   Device_LuaUPnP::HandleActionRequest 197 not ready 0xaadd48 <0x2f7f6680>
02   12/10/13 14:30:39.503   JobHandler_LuaUPnP::RunAction device 197 action urn:upnp-org:serviceId:IPhoneLocator1/ForceRefresh failed with -911/Device not ready <0x2f7f6680>
50   12/10/13 14:30:40.100   luup_log:197: IPhoneLocator: Entering loop <0x2dfb5680>
50   12/10/13 14:30:40.101   luup_log:197: IPhoneLocator: forceRefresh action is called on behalf of device:197 <0x2dfb5680>
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 10, 2013, 06:09:22 pm
I've been running into an issue with the plug-in and I'm not sure if the issue is with how I set up the scene or if it's an issue with the plug-in itself. I'm currently using the plug-in to trigger a scene that turns on my lights whenever either my wife or I arrive home after sunset. I already had the scene set up and had been using my z-wave deadbolt to trigger the scene. Once I found this plug-in I decided to use it to trigger the scene instead. The issue is that the scene seems to randomly trigger in the middle of the night. I had thought it would only be triggered if one of our phones went from being "away" to being "present" but when it's going off in the middle of the night both of our phones haven't moved. Is there a reason why the scene would be triggering itself like this? I have the trigger set up like this...

Device: My iPhone
Type of event: A device is present or away
Which mode: Device is present

I have an identical one set up for my wife's phone.

*edit* One other thing I thought of is that I recently enabled dynamic polling with the "driving" option. Would that have affected things?

I would create a scene to MUTE the iPhone locator plugin when you are home. For example I use the Ping Sensor plugin and motion detectors to determine if I'm home. When I'm home my battery drain is normal and no sporadic scene's running (I think the reason is iCloud drops me .3 miles away when I lose reception.)

Do you use the ping sensor plugin to sense when your iPhone is connected to your home wifi? If so can you give some more details on how you do that? Thanks!

Yes, my phone is set to check for mail every 15 minutes, when it does this the wifi kicks on. The Ping Sensor Poll Period is set to 15 seconds and Device Timeout set to 1200 seconds. If it doesn't ping my phone successfully in 20 minutes a scene will UNMUTE the iPhone Locator plugin (just in case I didn't press my "Leaving Home" scene). If it does ping it successfully then it will MUTE the plugin. I am using the iPhone Locator plugin to only sense when I ARRIVE home. If your using it to sense when you LEAVE Home then this might not be the ideal solution. I have a "Leaving Home" scene that I press every time I leave (to close the garage door) so I set that to UNMUTE the iPhone locator plugin as well, so the 20 minute gap isn't a problem for me.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 10, 2013, 06:43:13 pm
Just noticed another issue. I think it started this morning when I updated to the latest version of the plugin (1.69d). From the main UI5 devices screen it is reporting my phone's location as my work address, which is where I was this morning. I'm no longer at work however. When I click on the settings for the device and click on the map it is showing the correct location but it still lists the wrong address on the main screen. The two locations (where I am now and where I work) are miles apart. Also, the "Control" tab of my phone is looking a little funny. I've attached a screenshot to show what I'm talking about. Any suggestions?
wow, not seen this in a while; usually this is indication of a incomplete installation or plugin crash somewhere in the code. the device refresh code fails , then the loop code recovers from the exception and add the /period to the string.  it keeps repating this over and over and since the plug in crashed the text message is not refreshed.

please try this: a) reinstall from the store b) make sure you RELOAD lua ( blue reload button in top right ) , c) make sure you do a clean refresh of your browser ( ctrl+F5 or shift+F5 depending on browser )
if this happens again, please go in control tab and press the DEBUG button, then let it run for a while and you can send a private message to me with your log file ( luaUPnp.log file in /var/log/cmh/ folder on vera ) so I can look at it

I uninstalled v 1.69 then installed v1.69d and am getting a -911 device not ready error. Doing a re-install now.

12/10/13 14:30:37.263    <0x2b5b5680>
08   12/10/13 14:30:39.500   JobHandler_LuaUPnP::HandleActionRequest device: 197 service: urn:upnp-org:serviceId:IPhoneLocator1 action: ForceRefresh <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=197 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:IPhoneLocator1 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument action=ForceRefresh <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument PresentStatus=0 <0x2f7f6680>
08   12/10/13 14:30:39.501   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.24461934528709484 <0x2f7f6680>
02   12/10/13 14:30:39.502   Device_LuaUPnP::HandleActionRequest 197 not ready 0xaadd48 <0x2f7f6680>
02   12/10/13 14:30:39.503   JobHandler_LuaUPnP::RunAction device 197 action urn:upnp-org:serviceId:IPhoneLocator1/ForceRefresh failed with -911/Device not ready <0x2f7f6680>
50   12/10/13 14:30:40.100   luup_log:197: IPhoneLocator: Entering loop <0x2dfb5680>
50   12/10/13 14:30:40.101   luup_log:197: IPhoneLocator: forceRefresh action is called on behalf of device:197 <0x2dfb5680>

Getting the same error, "Device not ready". I've installed and uninstalled several times. Does it have anything to do with the fact I have 2 Vera's running as master and slave in both directions?
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 10, 2013, 07:19:02 pm
Just noticed another issue. I think it started this morning when I updated to the latest version of the plugin (1.69d). From the main UI5 devices screen it is reporting my phone's location as my work address, which is where I was this morning. I'm no longer at work however. When I click on the settings for the device and click on the map it is showing the correct location but it still lists the wrong address on the main screen. The two locations (where I am now and where I work) are miles apart. Also, the "Control" tab of my phone is looking a little funny. I've attached a screenshot to show what I'm talking about. Any suggestions?
wow, not seen this in a while; usually this is indication of a incomplete installation or plugin crash somewhere in the code. the device refresh code fails , then the loop code recovers from the exception and add the /period to the string.  it keeps repating this over and over and since the plug in crashed the text message is not refreshed.

please try this: a) reinstall from the store b) make sure you RELOAD lua ( blue reload button in top right ) , c) make sure you do a clean refresh of your browser ( ctrl+F5 or shift+F5 depending on browser )
if this happens again, please go in control tab and press the DEBUG button, then let it run for a while and you can send a private message to me with your log file ( luaUPnp.log file in /var/log/cmh/ folder on vera ) so I can look at it

I'm afraid I've only managed to make things worse. I tried uninstalling the plugin and reinstalling 1.69d but now I'm having new issues. I reinstalled the plugin and reconfigured the created device to connect to my iPhone. I logged in using iCloud and re-set my homes coordinates. However even though it's showing my phone's location as my home address it's still showing the device as "away". Clicking on the "refresh" button gives me a pop up error box that says "Device not ready". Not really sure what to do at this point. I've tried uninstalling and reinstalling a few times but keep hitting the same road block.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 10, 2013, 11:32:23 pm
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 11, 2013, 06:08:04 am
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?

I uninstalled the latest and then installed the one before that (v1.69c) and it seems to be working. Only thing I'm noticing now is the icon for my two devices never turn green. It's showing both phones as present, which they are, but the icon for both of them is still the white rectangle and the red circle. Should it be turning green? I was never 100% sure what the color signified.

*UPDATE* Nevermind, still running into issues with both 1.69c and the one before that. Same thing happening like the screenshot I posted earlier. Is it possible there are bits left behind when I uninstall the plugin that could be messing stuff up when I reinstall a different version? Is there anyway to make sure I've completely uninstalled it?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 11, 2013, 07:55:50 am
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?

I uninstalled the latest and then installed the one before that (v1.69c) and it seems to be working. Only thing I'm noticing now is the icon for my two devices never turn green. It's showing both phones as present, which they are, but the icon for both of them is still the white rectangle and the red circle. Should it be turning green? I was never 100% sure what the color signified.

*UPDATE* Nevermind, still running into issues with both 1.69c and the one before that. Same thing happening like the screenshot I posted earlier. Is it possible there are bits left behind when I uninstall the plugin that could be messing stuff up when I reinstall a different version? Is there anyway to make sure I've completely uninstalled it?

something really hapenning here... if you could send me the logs in debug mode, I could try to see what it is. use the SETTINGS tab ( instead of the ADVANCED tab ) for parameters. it avoids many mistakes as some of the fields have pretty strict formatting rules that the SETTINGS tab verifies for you
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 11, 2013, 08:17:52 am
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?

I uninstalled the latest and then installed the one before that (v1.69c) and it seems to be working. Only thing I'm noticing now is the icon for my two devices never turn green. It's showing both phones as present, which they are, but the icon for both of them is still the white rectangle and the red circle. Should it be turning green? I was never 100% sure what the color signified.

*UPDATE* Nevermind, still running into issues with both 1.69c and the one before that. Same thing happening like the screenshot I posted earlier. Is it possible there are bits left behind when I uninstall the plugin that could be messing stuff up when I reinstall a different version? Is there anyway to make sure I've completely uninstalled it?

something really hapenning here... if you could send me the logs in debug mode, I could try to see what it is. use the SETTINGS tab ( instead of the ADVANCED tab ) for parameters. it avoids many mistakes as some of the fields have pretty strict formatting rules that the SETTINGS tab verifies for you

I tried one more time to start from scratch with the latest version (v1.69d). Can you talk me through the process to turn on and then send you the logs? After I turn on the debug mode do I have to do anything to get the logs to generate or just leave it alone for a while? Since both my wife and I are at work right now our phones won't be moving much until this evening. Should I wait until then to turn on debug mode?
Title: Re: Plugin - IPhone Locator
Post by: hgj on December 11, 2013, 10:43:33 am
Hello,

  I have a question when I'm trying to setup iphone locator app I put in my icloud user name and password it lists my iphone and ipad that are connected to my icloud acct. I try to select iphone to be used as device to track. When I press the save button I get error message on the save button. I tried to enter user password and selecting device and then save but same error. I get error when I try to select device. Can anybody tell me what I'm doing wrong. I'm using latest iphone locator app downloaded dec 11,2013.

thank for your help
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 11, 2013, 10:48:01 am
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?

I uninstalled the latest and then installed the one before that (v1.69c) and it seems to be working. Only thing I'm noticing now is the icon for my two devices never turn green. It's showing both phones as present, which they are, but the icon for both of them is still the white rectangle and the red circle. Should it be turning green? I was never 100% sure what the color signified.

*UPDATE* Nevermind, still running into issues with both 1.69c and the one before that. Same thing happening like the screenshot I posted earlier. Is it possible there are bits left behind when I uninstall the plugin that could be messing stuff up when I reinstall a different version? Is there anyway to make sure I've completely uninstalled it?

something really hapenning here... if you could send me the logs in debug mode, I could try to see what it is. use the SETTINGS tab ( instead of the ADVANCED tab ) for parameters. it avoids many mistakes as some of the fields have pretty strict formatting rules that the SETTINGS tab verifies for you

I tried one more time to start from scratch with the latest version (v1.69d). Can you talk me through the process to turn on and then send you the logs? After I turn on the debug mode do I have to do anything to get the logs to generate or just leave it alone for a while? Since both my wife and I are at work right now our phones won't be moving much until this evening. Should I wait until then to turn on debug mode?

Depends on what problem you see. Try to enable debug mode right before you regenerate the problem. After that, sftp into your vera, transfer file /var/log/cmh/LuaUPnP.log to your desktop and upload it here. Before you do that, check the file and mask your email-address/passwords if needed. Use 'root' as logon user, the password should be on the bottom of your vera on a sticker (don't know if that's always the case, it is on my vera2)
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 11, 2013, 12:52:36 pm
Hello,

  I have a question when I'm trying to setup iphone locator app I put in my icloud user name and password it lists my iphone and ipad that are connected to my icloud acct. I try to select iphone to be used as device to track. When I press the save button I get error message on the save button. I tried to enter user password and selecting device and then save but same error. I get error when I try to select device. Can anybody tell me what I'm doing wrong. I'm using latest iphone locator app downloaded dec 11,2013.

thank for your help

you can try to follow this : http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
images can be a bit obsolete if you use latest versions but it should be quite similar.

use the "==>" buttons to move a iDevice from the list on the left ( list of devices in your account ) into the list on the right ( list of devices you want to track )
Title: Re: Plugin - IPhone Locator
Post by: hgj on December 11, 2013, 10:02:26 pm
Hello,

  I have a question when I'm trying to setup iphone locator app I put in my icloud user name and password it lists my iphone and ipad that are connected to my icloud acct. I try to select iphone to be used as device to track. When I press the save button I get error message on the save button. I tried to enter user password and selecting device and then save but same error. I get error when I try to select device. Can anybody tell me what I'm doing wrong. I'm using latest iphone locator app downloaded dec 11,2013.

thank for your help

you can try to follow this : http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
images can be a bit obsolete if you use latest versions but it should be quite similar.

use the "==>" buttons to move a iDevice from the list on the left ( list of devices in your account ) into the list on the right ( list of devices you want to track )


I tried to follow instruction and was able to log into icloud and it shows my iphone I moved it to the right column to be able to track this device
I added my coordinates for my latitude and longitude using google maps
When I press the save button it displays error occurred have not been able to go past this step
It shows me the home control window to input my user and password for vera which I do but it never saves my data keep on popping the window for user and password for vera
If anybody else has had this problem please let me know how to proceed
I appreciate your help
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 12, 2013, 12:17:04 pm
I am out for a few days so  I will not be able to look into this more for a little while. maybe try an older version ?

I uninstalled the latest and then installed the one before that (v1.69c) and it seems to be working. Only thing I'm noticing now is the icon for my two devices never turn green. It's showing both phones as present, which they are, but the icon for both of them is still the white rectangle and the red circle. Should it be turning green? I was never 100% sure what the color signified.

*UPDATE* Nevermind, still running into issues with both 1.69c and the one before that. Same thing happening like the screenshot I posted earlier. Is it possible there are bits left behind when I uninstall the plugin that could be messing stuff up when I reinstall a different version? Is there anyway to make sure I've completely uninstalled it?

something really hapenning here... if you could send me the logs in debug mode, I could try to see what it is. use the SETTINGS tab ( instead of the ADVANCED tab ) for parameters. it avoids many mistakes as some of the fields have pretty strict formatting rules that the SETTINGS tab verifies for you

I tried one more time to start from scratch with the latest version (v1.69d). Can you talk me through the process to turn on and then send you the logs? After I turn on the debug mode do I have to do anything to get the logs to generate or just leave it alone for a while? Since both my wife and I are at work right now our phones won't be moving much until this evening. Should I wait until then to turn on debug mode?

Depends on what problem you see. Try to enable debug mode right before you regenerate the problem. After that, sftp into your vera, transfer file /var/log/cmh/LuaUPnP.log to your desktop and upload it here. Before you do that, check the file and mask your email-address/passwords if needed. Use 'root' as logon user, the password should be on the bottom of your vera on a sticker (don't know if that's always the case, it is on my vera2)

The issue I'm having most recently with the latest version (v1.69d) is that after I add the device and configure it I can't actually click on any of the buttons (present, away, mute, etc...). When I do I get a popup that tells me that the device isn't ready. Unfortunately this happens when I try and turn on debug mode as well. Should I install the previous version (v1.69c) and send the debug info from that one since the issue is slightly different there?
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 12, 2013, 01:44:13 pm
The issue I'm having most recently with the latest version (v1.69d) is that after I add the device and configure it I can't actually click on any of the buttons (present, away, mute, etc...). When I do I get a popup that tells me that the device isn't ready. Unfortunately this happens when I try and turn on debug mode as well. Should I install the previous version (v1.69c) and send the debug info from that one since the issue is slightly different there?
it's probably best to do a debug with the latest version. try to set Debug to 1 in the advanced tab of the iphone locator device, and save your changes afterwards (the famous red button)
Title: Re: Plugin - IPhone Locator
Post by: ChrisTheC on December 12, 2013, 03:03:33 pm
The issue I'm having most recently with the latest version (v1.69d) is that after I add the device and configure it I can't actually click on any of the buttons (present, away, mute, etc...). When I do I get a popup that tells me that the device isn't ready. Unfortunately this happens when I try and turn on debug mode as well. Should I install the previous version (v1.69c) and send the debug info from that one since the issue is slightly different there?

I just had this error last night. It happened to the first new device I tried to create since upgrading to 1.69d. (I was already running 10 iDevices) But after adding an 11th, the 11th device exhibited this same behavior. Multiple restarts, reloads, refreshes didn't help. I stared at the settings for this device and everything appeared correct, just kept getting the device not ready message.

Well, since I had 10 devices working correctly, I just looked in the Advanced tab to see if something was different. I found something different in the problem device.

The impl_file setting in the working devices read I_IPhone.xml - but the impl_file in the problem device read . . . (I can't remember, I didn't write it down) but, I manually changed it to I_IPhone.xml and reloaded. The problem device started working and no longer gave the device not ready error.

Now I may have screwed something up, since I don't know enough to know what these files do (perhaps someone else more knowledgable can help), but all of my devices are still working.

Regards,

Chris
Title: Re: Plugin - IPhone Locator
Post by: duiffie on December 12, 2013, 04:56:49 pm
Now I may have screwed something up, since I don't know enough to know what these files do (perhaps someone else more knowledgable can help), but all of my devices are still working.
You didn't screw something up, I think you just found the bug and delivered a quick fix till amg0 is back.  ;)
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 12, 2013, 05:43:09 pm
The issue I'm having most recently with the latest version (v1.69d) is that after I add the device and configure it I can't actually click on any of the buttons (present, away, mute, etc...). When I do I get a popup that tells me that the device isn't ready. Unfortunately this happens when I try and turn on debug mode as well. Should I install the previous version (v1.69c) and send the debug info from that one since the issue is slightly different there?

I just had this error last night. It happened to the first new device I tried to create since upgrading to 1.69d. (I was already running 10 iDevices) But after adding an 11th, the 11th device exhibited this same behavior. Multiple restarts, reloads, refreshes didn't help. I stared at the settings for this device and everything appeared correct, just kept getting the device not ready message.

Well, since I had 10 devices working correctly, I just looked in the Advanced tab to see if something was different. I found something different in the problem device.

The impl_file setting in the working devices read I_IPhone.xml - but the impl_file in the problem device read . . . (I can't remember, I didn't write it down) but, I manually changed it to I_IPhone.xml and reloaded. The problem device started working and no longer gave the device not ready error.

Now I may have screwed something up, since I don't know enough to know what these files do (perhaps someone else more knowledgable can help), but all of my devices are still working.

Regards,

Chris

I just checked what the impl_file is for my device and it says L_IPhoneJson.lua. I'll try changing it to I_IPhone.xml and see what happens.

UPDATE: That fix seemed to work for me as well. Will be curious what amg0's thoughts are.
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 12, 2013, 06:07:42 pm
The issue I'm having most recently with the latest version (v1.69d) is that after I add the device and configure it I can't actually click on any of the buttons (present, away, mute, etc...). When I do I get a popup that tells me that the device isn't ready. Unfortunately this happens when I try and turn on debug mode as well. Should I install the previous version (v1.69c) and send the debug info from that one since the issue is slightly different there?

I just had this error last night. It happened to the first new device I tried to create since upgrading to 1.69d. (I was already running 10 iDevices) But after adding an 11th, the 11th device exhibited this same behavior. Multiple restarts, reloads, refreshes didn't help. I stared at the settings for this device and everything appeared correct, just kept getting the device not ready message.

Well, since I had 10 devices working correctly, I just looked in the Advanced tab to see if something was different. I found something different in the problem device.

The impl_file setting in the working devices read I_IPhone.xml - but the impl_file in the problem device read . . . (I can't remember, I didn't write it down) but, I manually changed it to I_IPhone.xml and reloaded. The problem device started working and no longer gave the device not ready error.

Now I may have screwed something up, since I don't know enough to know what these files do (perhaps someone else more knowledgable can help), but all of my devices are still working.

Regards,

Chris

I just checked what the impl_file is for my device and it says L_IPhoneJson.lua. I'll try changing it to I_IPhone.xml and see what happens.

UPDATE: That fix seemed to work for me as well. Will be curious what amg0's thoughts are.

Fixed mine as well. Thanks!
Title: Re: Plugin - IPhone Locator
Post by: hgj on December 12, 2013, 08:02:56 pm
Hello,

  I have a question when I'm trying to setup iphone locator app I put in my icloud user name and password it lists my iphone and ipad that are connected to my icloud acct. I try to select iphone to be used as device to track. When I press the save button I get error message on the save button. I tried to enter user password and selecting device and then save but same error. I get error when I try to select device. Can anybody tell me what I'm doing wrong. I'm using latest iphone locator app downloaded dec 11,2013.

thank for your help


The other question I had where do you download the newer versions of iphone locator that people on this blog are talking about. I have the iphone locator version 1.62 which I down loaded from the ui5 apps tab on my micasverde control page. Is there another place where you can get newer versions since I can't get this version to work. Everytime I press save tab it tells me error occurred so I'm not able to go forward.

thanks for your help


you can try to follow this : http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
images can be a bit obsolete if you use latest versions but it should be quite similar.

use the "==>" buttons to move a iDevice from the list on the left ( list of devices in your account ) into the list on the right ( list of devices you want to track )


I tried to follow instruction and was able to log into icloud and it shows my iphone I moved it to the right column to be able to track this device
I added my coordinates for my latitude and longitude using google maps
When I press the save button it displays error occurred have not been able to go past this step
It shows me the home control window to input my user and password for vera which I do but it never saves my data keep on popping the window for user and password for vera
If anybody else has had this problem please let me know how to proceed
I appreciate your help
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 12, 2013, 08:22:51 pm
http://apps.mios.com/test-plugin.php?id=4686&show=versions

After you click the link and login come back and click the link again.
Title: Re: Plugin - IPhone Locator
Post by: hgj on December 12, 2013, 09:58:05 pm
http://apps.mios.com/test-plugin.php?id=4686&show=versions

After you click the link and login come back and click the link again.

Thanks for you information
I went ahead uninstalled version 1.62 and I installed the 1.69 version. I'm still getting a error occurred when I press the save button. I'm able to put my icloud user name and password. It shows my ipad and iphone so move the iphone to the right column it leaves a space on top and it says iphone. I proceed to place my longitude and latitude using the google maps in digital form after this I press the save button. That is where it displays error occurred but it starts showing me a window for user and password for my ui5 control center so I place this information but keeps on showing me this window even though I press save password. It display this in a cycle over and over and does not let me do anything beyond this.

Sorry for so many questions new to mi casa verde and really trying to get this to work. I appreciate all your help thanks
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 13, 2013, 12:24:30 pm
I just checked what the impl_file is for my device and it says L_IPhoneJson.lua. I'll try changing it to I_IPhone.xml and see what happens.
UPDATE: That fix seemed to work for me as well. Will be curious what amg0's thoughts are.

Sorry for the issues encountered, it does look like it is the root cause and is probably only affecting the users who created a brand new root device ( as opposed to users who just upgraded ). I am not 100% sure but I believe it is a file type selection that I had unvoluntarly changed in the mios publication portal when I published the latest release. I have published a v1.69e version in the mios app store which should not have this issue and I have just tested creating a brand new root device with it, it seems to work. 

Also I fixed a small bug in code initialization which could eventually create some plug issues at startup time and explain the /60s/60s/60s/60s string issues that some had.

again for the braves who do not fear the updates...  ;) feel free to install and let me know how it goes.  once ok , I ll transform it into being the next PUBLIC version
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 13, 2013, 12:26:25 pm
http://apps.mios.com/test-plugin.php?id=4686&show=versions

After you click the link and login come back and click the link again.

Thanks for you information
I went ahead uninstalled version 1.62 and I installed the 1.69 version. I'm still getting a error occurred when I press the save button. I'm able to put my icloud user name and password. It shows my ipad and iphone so move the iphone to the right column it leaves a space on top and it says iphone. I proceed to place my longitude and latitude using the google maps in digital form after this I press the save button. That is where it displays error occurred but it starts showing me a window for user and password for my ui5 control center so I place this information but keeps on showing me this window even though I press save password. It display this in a cycle over and over and does not let me do anything beyond this.

Sorry for so many questions new to mi casa verde and really trying to get this to work. I appreciate all your help thanks

if you do not mind, please delete devices you created and go ahead install the latest V1.69e from the store url... http://apps.mios.com/test-plugin.php?id=4686&show=versions
let us know...
Title: Re: Plugin - IPhone Locator
Post by: IronScott on December 13, 2013, 03:03:15 pm
Hi. I've installed 1.69e (installed the public release yesterday) and have been able to get my iPhone found and configured. I have my home lat/long entered and saved correctly. I am currently away from my home. If I view the map tab it correctly shows the phone's current location and the home location.

The app's main page on the dashboard still shows the address as reported yesterday and status of Present. It seems like the system is working given that the map view shows correctly but why is the app not showing the right status? I've tried the refresh button. Different browsers. Reloaded Vera many times.

I apologize if I'm just missing something obvious. I've tried to go through every page in this long thread but it's very difficult to find specifics around this topic.

And I have read the first post several times but I admit it's a bit overwhelming. I'm fairly a fairly new Vera user and ever newer plugin user so I appreciate any patience you can afford.
Title: Re: Plugin - IPhone Locator
Post by: Ryanoc75 on December 13, 2013, 03:05:33 pm
First thanks kindly to amgO for this amazing plug in - I have been wishing for an app that detects location and can trigger scenes for well over a year now and its great to finally have it. 

I am having a small issue though related to triggers.  Here's the scenario.  I have a keyless go scene that drops the thermostat when we leave the house.  We live in the country so I have used your plugin to trigger the thermostat to return to home levels when distance goes below 20km so the house is warm when we arrive.  Then at .3 km I have it opening the garage door which triggers the I"m home scene and mute's the iphone to avoid the garage door being triggered at random. 

Then I have tried using the distance goes above .5km to unmute the iphone, however as soon as the distance is refreshed the thermostat returns to our home level.  Cell service is very spotty in our area so we have a cell booster in the car which certainly helps with distance accuracy.   I'm concerned that if google's calculation is off it could end up triggering "I'm home" and then the garage door is wide open and the front door unlocked and the alarm disarmed - rather inviting for thieves!  My work around has been to add a 30min delay to my "keyless go" scene and I unmute and refresh the phone to obtain the right polling frequency as we will almost always be more than 20km from home by then.  Other variables worth mentioning is that I am using a dynamic polling map as I need it to refresh quickly as we get close to home because of the weaker signal and potential to miss polls and I am using driving mode for distance calculations

Is this the best way to set up what I would like to do or am I missing something.  My interpretation of the plug in was that it is capable of determining if you are coming from home or going to home which allows for the above/below triggers.  Any advice/clarification would help
Title: Re: Plugin - IPhone Locator V1
Post by: ilikelife on December 13, 2013, 04:21:52 pm
Hi All, Another Newbie here
First, this is a GREAT add-in!  The possibilities are endless.  I agree with the review that said this should be included with Vera.  Thanks to amg0 and all the others that have helped!

But...  I'm still having a similar problem as hgj, with V1.69e

I enter my cloud user and password in the "Settings" tab.  It finds my device(s) and changes to "save needed".  When I click to save, I get a pop up Windows Security box from iexplore  telling me "The server at xx.xx.xx.x  is asking for your user name and password.  The server reports it is from HomeControl."   I've tried both my iCloud and Vera credentials, but the same box keeps popping back up.  After 3 or 4 failed attempts, I can get back to the settings screen.  I have gone to the "Advanced" tab, and by entering info there, I get most things working.  It finds my location, my phone, marks me as Present, etc. In fact, everything seems to work now except that I still can't enter anything in the "Settings" tab.

I really have read all 37 pages of this thread (but didn't understand most) and don't know what is wrong.  I've removed and re-installed about 3 times now, I installed a second instance with my wife's account, and still getting this #%^# security warning.  I have a Vera 3, Verizon iPhone 5 running iOS7.0.4 and a computer running Windows 8.1 (Maybe that's the problem?)
Any suggestions or advice is most welcome.  I'm sure it will get resolved with all the great minds on here, and I understand it's beta.  Please let me know if any logs from me would help.  -Mike
Title: Re: Plugin - IPhone Locator V1
Post by: amg0 on December 13, 2013, 06:13:26 pm
Hi All, Another Newbie here
First, this is a GREAT add-in!  The possibilities are endless.  I agree with the review that said this should be included with Vera.  Thanks to amg0 and all the others that have helped!

But...  I'm still having a similar problem as hgj, with V1.69e

I enter my cloud user and password in the "Settings" tab.  It finds my device(s) and changes to "save needed".  When I click to save, I get a pop up Windows Security box from iexplore  telling me "The server at xx.xx.xx.x  is asking for your user name and password.  The server reports it is from HomeControl."   I've tried both my iCloud and Vera credentials, but the same box keeps popping back up.  After 3 or 4 failed attempts, I can get back to the settings screen.  I have gone to the "Advanced" tab, and by entering info there, I get most things working.  It finds my location, my phone, marks me as Present, etc. In fact, everything seems to work now except that I still can't enter anything in the "Settings" tab.

I really have read all 37 pages of this thread (but didn't understand most) and don't know what is wrong.  I've removed and re-installed about 3 times now, I installed a second instance with my wife's account, and still getting this #%^# security warning.  I have a Vera 3, Verizon iPhone 5 running iOS7.0.4 and a computer running Windows 8.1 (Maybe that's the problem?)
Any suggestions or advice is most welcome.  I'm sure it will get resolved with all the great minds on here, and I understand it's beta.  Please let me know if any logs from me would help.  -Mike

@ilikelife, @hgj
- could you share a screen shot of this error dialog box ? really no idea what that is
- can you confirm what URL you use ? are you connecting vera from your local network using http://<veraipaddress>/cmh
- can you confirm you vera firmware level ( SETUP / Firmware ) ?
- have you tried with chrome browser ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 13, 2013, 06:21:04 pm
Hi. I've installed 1.69e (installed the public release yesterday) and have been able to get my iPhone found and configured. I have my home lat/long entered and saved correctly. I am currently away from my home. If I view the map tab it correctly shows the phone's current location and the home location.

The app's main page on the dashboard still shows the address as reported yesterday and status of Present. It seems like the system is working given that the map view shows correctly but why is the app not showing the right status? I've tried the refresh button. Different browsers. Reloaded Vera many times.

I apologize if I'm just missing something obvious. I've tried to go through every page in this long thread but it's very difficult to find specifics around this topic.

And I have read the first post several times but I admit it's a bit overwhelming. I'm fairly a fairly new Vera user and ever newer plugin user so I appreciate any patience you can afford.

if you feel the plugin is not refreshing  the best is to enable DEBUG mode ( using CONTROL tab ) then run it to get the same issue and then get the luaUPnp.log file from you vera /var/log/cmh folder , cleanify to remove your password from it and share it either here or by private message to me.
also do you confirm PollingBase is a number and is not 0 ?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 13, 2013, 06:24:47 pm
First thanks kindly to amgO for this amazing plug in - I have been wishing for an app that detects location and can trigger scenes for well over a year now and its great to finally have it. 

I am having a small issue though related to triggers.  Here's the scenario.  I have a keyless go scene that drops the thermostat when we leave the house.  We live in the country so I have used your plugin to trigger the thermostat to return to home levels when distance goes below 20km so the house is warm when we arrive.  Then at .3 km I have it opening the garage door which triggers the I"m home scene and mute's the iphone to avoid the garage door being triggered at random. 

Then I have tried using the distance goes above .5km to unmute the iphone, however as soon as the distance is refreshed the thermostat returns to our home level.  Cell service is very spotty in our area so we have a cell booster in the car which certainly helps with distance accuracy.   I'm concerned that if google's calculation is off it could end up triggering "I'm home" and then the garage door is wide open and the front door unlocked and the alarm disarmed - rather inviting for thieves!  My work around has been to add a 30min delay to my "keyless go" scene and I unmute and refresh the phone to obtain the right polling frequency as we will almost always be more than 20km from home by then.  Other variables worth mentioning is that I am using a dynamic polling map as I need it to refresh quickly as we get close to home because of the weaker signal and potential to miss polls and I am using driving mode for distance calculations

Is this the best way to set up what I would like to do or am I missing something.  My interpretation of the plug in was that it is capable of determining if you are coming from home or going to home which allows for the above/below triggers.  Any advice/clarification would help

if you mute the phone, you cannot rely on any trigger to unmute it. you have to unmute it from other triggers from some other devices ( like PLEG ) because in mute mode, distance will not change any more, wherever you are

personally I would start simple : direct mode , simple polling mode and make it work like that, then optimize with polling map , then eventually try to play with driving mode and / or automatic calculation of polling, but starting simple would key to set the triggers you want
Title: Re: Plugin - IPhone Locator
Post by: IronScott on December 13, 2013, 06:32:21 pm
Hi. I've installed 1.69e (installed the public release yesterday) and have been able to get my iPhone found and configured. I have my home lat/long entered and saved correctly. I am currently away from my home. If I view the map tab it correctly shows the phone's current location and the home location.

The app's main page on the dashboard still shows the address as reported yesterday and status of Present. It seems like the system is working given that the map view shows correctly but why is the app not showing the right status? I've tried the refresh button. Different browsers. Reloaded Vera many times.

I apologize if I'm just missing something obvious. I've tried to go through every page in this long thread but it's very difficult to find specifics around this topic.

And I have read the first post several times but I admit it's a bit overwhelming. I'm fairly a fairly new Vera user and ever newer plugin user so I appreciate any patience you can afford.

if you feel the plugin is not refreshing  the best is to enable DEBUG mode ( using CONTROL tab ) then run it to get the same issue and then get the luaUPnp.log file from you vera /var/log/cmh folder , cleanify to remove your password from it and share it either here or by private message to me.
also do you confirm PollingBase is a number and is not 0 ?

Thanks for the response. PollingBase is set to 60. I will be at the house tomorrow so I will grab the log file then.

On a separate but related note. What is the easiest way to test if it's working? Create a scene that looks for a trigger of home or away?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 13, 2013, 06:36:59 pm
Hi. I've installed 1.69e (installed the public release yesterday) and have been able to get my iPhone found and configured. I have my home lat/long entered and saved correctly. I am currently away from my home. If I view the map tab it correctly shows the phone's current location and the home location.

The app's main page on the dashboard still shows the address as reported yesterday and status of Present. It seems like the system is working given that the map view shows correctly but why is the app not showing the right status? I've tried the refresh button. Different browsers. Reloaded Vera many times.

I apologize if I'm just missing something obvious. I've tried to go through every page in this long thread but it's very difficult to find specifics around this topic.

And I have read the first post several times but I admit it's a bit overwhelming. I'm fairly a fairly new Vera user and ever newer plugin user so I appreciate any patience you can afford.

if you feel the plugin is not refreshing  the best is to enable DEBUG mode ( using CONTROL tab ) then run it to get the same issue and then get the luaUPnp.log file from you vera /var/log/cmh folder , cleanify to remove your password from it and share it either here or by private message to me.
also do you confirm PollingBase is a number and is not 0 ?

Thanks for the response. PollingBase is set to 60. I will be at the house tomorrow so I will grab the log file then.

On a separate but related note. What is the easiest way to test if it's working? Create a scene that looks for a trigger of home or away?

yes you can set a scene based on a trigger and switch ON or OFF a light for instance.
you can also do this with distance trigger, and what I usually do is change the homebase location, that changes the distance at the next 'refresh' time and this way I can force the distance less than or above than triggers

or, you can look in the log file and "grep" for IPhoneLocator string...or for "failed" string if you suspect a crash
Title: Re: Plugin - IPhone Locator
Post by: IronScott on December 13, 2013, 06:40:35 pm
Hi. I've installed 1.69e (installed the public release yesterday) and have been able to get my iPhone found and configured. I have my home lat/long entered and saved correctly. I am currently away from my home. If I view the map tab it correctly shows the phone's current location and the home location.

The app's main page on the dashboard still shows the address as reported yesterday and status of Present. It seems like the system is working given that the map view shows correctly but why is the app not showing the right status? I've tried the refresh button. Different browsers. Reloaded Vera many times.

I apologize if I'm just missing something obvious. I've tried to go through every page in this long thread but it's very difficult to find specifics around this topic.

And I have read the first post several times but I admit it's a bit overwhelming. I'm fairly a fairly new Vera user and ever newer plugin user so I appreciate any patience you can afford.

if you feel the plugin is not refreshing  the best is to enable DEBUG mode ( using CONTROL tab ) then run it to get the same issue and then get the luaUPnp.log file from you vera /var/log/cmh folder , cleanify to remove your password from it and share it either here or by private message to me.
also do you confirm PollingBase is a number and is not 0 ?

Thanks for the response. PollingBase is set to 60. I will be at the house tomorrow so I will grab the log file then.

On a separate but related note. What is the easiest way to test if it's working? Create a scene that looks for a trigger of home or away?

yes you can set a scene based on a trigger and switch ON or OFF a light for instance.
you can also do this with distance trigger, and what I usually do is change the homebase location, that changes the distance at the next 'refresh' time and this way I can force the distance less than or above than triggers

or, you can look in the log file and "grep" for IPhoneLocator string...or for "failed" string if you suspect a crash

Cool. Thanks a lot. I will do some debugging this weekend. I can see a lot of possibilities with this. Thanks for all your hard work.
Title: Re: Plugin - IPhone Locator
Post by: ilikelife on December 13, 2013, 06:49:42 pm
amg0

Have a screenshot - can't figure out how to post it    :-[

Yes   http://<veraipaddress>/cmh

You are running the latest version: 1.5.622

No - have not tried Chrome  Using IE 11


Title: Re: Plugin - IPhone Locator
Post by: ilikelife on December 13, 2013, 06:59:28 pm
Well, let's see if this works?

Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 14, 2013, 04:20:32 am
Well, let's see if this works?

I do not know what that is but I suspect some IE11 security strengthening that does not like too much the javascript things I have to do in order to get the google map and various settings into windows. these things at the border of allowed things like dynamically loading google map scripts file after the page HTML ( DOM ) has already been constructed. we kind of have to add things into the HTML page after the facts since it is not us, but VERA UI5 which has control and renders the page

in short I have 2 suggestions:
a) try Chrome, that is probably the best bet, at some point I remember VERA not supporting IE , for instance you do have some device icon issues with it

b) try adding your http://<vera ip address> in the trusted zone or intranet zone of your internet explorer settings and try to lower the security parameters.  i ll do some search on internet but I do not have an environment to fully reproduce this.

Title: Re: Plugin - IPhone Locator
Post by: ilikelife on December 14, 2013, 08:52:44 am
Thanks amg0,

I think you are right that it's IE11 security issue. It worries about my safety way too much. Because changes work in the "Advanced" tab, I thought you were doing something creative with the settings tab. I'll try your suggestions of putting the vera address in trusted, and (temporarily) turning off all the IE security I can find. If I have any success I'll let you know but it will not be until Monday. Sounds like Chrome is the best answer.

Again, thanks for you help and for developing this fantastic plug-in!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 14, 2013, 01:24:57 pm
just posted V1.69f
key change is I use iCloud timestamp, so accuracy of speed & prediction of eta should be more accurate
Title: Re: Plugin - IPhone Locator
Post by: BillyBob919 on December 14, 2013, 03:22:40 pm
just posted V1.69f
key change is I use iCloud timestamp, so accuracy of speed & prediction of eta should be more accurate

I did some testing yesterday with 1.69d. I have it set to Direct mode, Dynamic polling with 60 sec period and polling divider of 2. When I am about 2-3 miles away from home and I check Automator.app it shows polling to be over 600 seconds. This happened on two different occasions.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 14, 2013, 05:57:57 pm
just posted V1.69f
key change is I use iCloud timestamp, so accuracy of speed & prediction of eta should be more accurate

I did some testing yesterday with 1.69d. I have it set to Direct mode, Dynamic polling with 60 sec period and polling divider of 2. When I am about 2-3 miles away from home and I check Automator.app it shows polling to be over 600 seconds. This happened on two different occasions.

expected behavior, if speed was seen as not null , eta is calculated based on speed and could result to polling time longer than the pollingbase. problem with version prior to f is that speed is not reliable too much. try version 'f', it should help as I now take timestamp from iCloud so actual position and actual timestamp are synchronized, thus should lead to more speed accuracy
dynamic polling algorythm is unchanged but should have better results: eta is calculated based on distance / speed and divided by divider

in that version I also put a little bit more debug traces in the log in DEBUG mode so issues can be understood better ( providing logs are captured in debug mode )
Title: Re: Plugin - IPhone Locator
Post by: mrcashback on December 16, 2013, 05:26:13 am
First and foremost, excellent app....  ;D Thankyou for building it!

I have a relatively unstable internet connection, and have noticed that whenever a location update is attempted when the internet is unavailable, the Status changes to AWAY, I get a message on the device saying that "No Devices for this account, check network/credentials", and the distance from home defaults to some astronomical figure, and the ui5 message is something along the lines of not being able to connect to apple... (the child devices seem unaffected, just the parent)

The problem comes when the Status and distance is altered, it sets of scene triggers that have been scheduled to activate when the iPhone passes 1km away, or when the Status changes to 'away'

Is there a way I can set the app to ignore 'incomplete' or 'unsuccessful' updates on the location so that it doesn't change the Status or distance unless it actually gets a successful result from icloud??
Otherwise I've got TV's and lights going off every time the net drops out  :-\

Thanx, Rob
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 16, 2013, 06:46:09 pm
I just published V1.69g to fix a few problems now that speed accuracy is better.

- fixed @mrcashback problem ( I hope )
- the Dashboard displays shows 2 time stamps so it reads like this : <the iCloud one> / <the Vera Refresh one> / <the refresh period>
- add the concept of MIN_PERIOD and MAX_PERIOD for polling. whatever happens MIN_PERIOD = 10 sec , MAX_PERIOD = 3600 sec
- when the device speed is below 5km/h, it is considered as not moving
- in direct mode where ETA is calculated ( as opposed to google mode where we take ETA from google estimates ) , several considerations are taken : a not moving device will be considered to have a default speed of 20km/h so that ETA is calculated to a reasonable value ( to avoid missing when the device moves again ).  Also a ETA/divider polling period calculation will never be greater than the MAX_PERIOD ( = 3600 s ) in the worst case
- The refresh and unmute action will immediately create a new timer with the new polling frequency as calculated by device parameters & situation. This requires a little bit of explanation herebelow.

Obviously the polling loop is based on a timer in VERA. however there are no ways to cancel a timer already set , so, to avoid consuming all vera resources & timers, I adopted a protective attitude so that when the user changed the polling parameters ( mode, base, whatever ) and / or when refreshing the device or unmuting it , the device position was refreshed but the very first opportunity to actually change the polling period was at the time the previous timer was expiring where I was calculating the period for the next time to retrigger the timer.  Therefore, let s imagine you were under a long polling period , even if you changed mode or polling map or whatever,  that new frequency of polling could only be adopted sometime much later.

Now I found a different way of doing it and UnMute , Refresh actions will actually create a new timer with the new polling parameters immediately and the old one will simply be ignored and not renewed. thus it is instantaneous and yet not consuming precious VERA resources. This should work great for instance for people who are calling refresh at the time a door is open and they leave the house.

please report any issue and possibly with logs in DEBUG mode... still hoping to make a public V1.70 someday :)
Title: Re: Plugin - IPhone Locator
Post by: hgj on December 17, 2013, 09:18:39 am
Hello,

  I have a question when I'm trying to setup iphone locator app I put in my icloud user name and password it lists my iphone and ipad that are connected to my icloud acct. I try to select iphone to be used as device to track. When I press the save button I get error message on the save button. I tried to enter user password and selecting device and then save but same error. I get error when I try to select device. Can anybody tell me what I'm doing wrong. I'm using latest iphone locator app downloaded dec 11,2013.


thank for your help


The other question I had where do you download the newer versions of iphone locator that people on this blog are talking about. I have the iphone locator version 1.62 which I down loaded from the ui5 apps tab on my micasverde control page. Is there another place where you can get newer versions since I can't get this version to work. Everytime I press save tab it tells me error occurred so I'm not able to go forward.

thanks for your help


you can try to follow this : http://code.mios.com/trac/mios_iphone-detector/export/147/trunk/iPhoneLocator/Install%20Doc.pdf
images can be a bit obsolete if you use latest versions but it should be quite similar.

use the "==>" buttons to move a iDevice from the list on the left ( list of devices in your account ) into the list on the right ( list of devices you want to track )


I tried to follow instruction and was able to log into icloud and it shows my iphone I moved it to the right column to be able to track this device
I added my coordinates for my latitude and longitude using google maps
When I press the save button it displays error occurred have not been able to go past this step
It shows me the home control window to input my user and password for vera which I do but it never saves my data keep on popping the window for user and password for vera
If anybody else has had this problem please let me know how to proceed
I appreciate your help

Thank you for your help
I downloaded chrome browser and was able to get everything working seems my internet browser security was keeping me from saving my information when setting up app. I'm now going to attempt to set up app to do my home scene when present and away.
Thanks for your help appreciate it
Title: Re: Plugin - IPhone Locator
Post by: ilikelife on December 17, 2013, 03:48:09 pm
Well, let's see if this works?

I do not know what that is but I suspect some IE11 security strengthening that does not like too much the javascript things I have to do in order to get the google map and various settings into windows. these things at the border of allowed things like dynamically loading google map scripts file after the page HTML ( DOM ) has already been constructed. we kind of have to add things into the HTML page after the facts since it is not us, but VERA UI5 which has control and renders the page

in short I have 2 suggestions:
a) try Chrome, that is probably the best bet, at some point I remember VERA not supporting IE , for instance you do have some device icon issues with it

b) try adding your http://<vera ip address> in the trusted zone or intranet zone of your internet explorer settings and try to lower the security parameters.  i ll do some search on internet but I do not have an environment to fully reproduce this.

Hey amg0, just to report back, I turned off all the IE security settings I could find, and still get the security screen.  Going to convert to Chrome.

Thanks for your help!
Title: Re: Plugin - IPhone Locator
Post by: seannymurrs on December 17, 2013, 08:34:04 pm
I've recently started getting the following message popping up on my dashboard. "IPhoneLocator : Google Quota exceeded".
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 17, 2013, 08:52:14 pm
I've recently started getting the following message popping up on my dashboard. "IPhoneLocator : Google Quota exceeded".

Probably that your plugin instance is polling too often or that you have too many devices being tracked and as a result you're polling too often. It's an API limit imposed by Google and not something @amg0 can code around.
Title: Re: Plugin - IPhone Locator
Post by: Ryanoc75 on December 18, 2013, 12:19:42 pm
Hi AmgO

Thanks for your input regarding my last question and observations on calculating the  speed issue.  I just downloaded the lastest update so I will keep an eye on things and let you know of any relevant feedback.

I have noticed a few minor issues and wanted to ask for your input/help

1) I have two triggers as I mentioned when we are coming home. One when the phone falls below 17km to turn up the heat and the second at 2km with a delay in the scene to run the I'm Home scene.  I figured that picking a distance a bit further away and adding a delay would be more reliable as the cell service is spotty in our area
   The problem that keeps occuring is that when  the phone refreshes and is below the trigger  threshold it runs the scene again, however its sporadic.  Yesterday it ran the thermostat scene 6 times before we got home and then tried opening the garage 3 times.  Is there any easy way to prevent the scene from triggering multiple times? 

2) There have been 2 situations where the phone triggers the scene even while on mute.  It opened the garage doors at 2:15 am and I only have the phone set to unmute 30min after we lock the front door which triggers our keyless go. (I did this to prevent scenes from firing until we got past the 17km trigger for the tstat because it kept putting the heat back up while we were heading out for the day   I originally thought I could unmute once the phone passes .5 km and set that trigger up but forgot about it when you indicated I shouldn't use a distance trigger to unmute, however today the phone was at home and reported its location as .66km away and it unmuted itself and then the garage doors opened and the tstat triggered again. 

I'm hoping you can help cause I love your plug in and what it can do but the boss is starting to become less patient with my tinkering when doors are opening and closing at random etc.  What I did do after the 2am opening was to put luup conditions in the scene so that it won't even open the door between 12:30am and 8am which will help but won't stop the daytime random triggering.  Any ideas?   
Title: Re: Plugin - IPhone Locator
Post by: parkerc on December 18, 2013, 02:03:30 pm
Hi All

Considering this great plugin has been promoted to it's own child board on the forum, @amg0 and I are working together to create a structure to help people find the information they need.

To get things started we've created a dedicated thread for the new v1.69 release -> http://forum.micasaverde.com/index.php/topic,18814.0.html

Please could those of you who are using this version, please  look to post their questions/issues there going forward.
[/size]
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 18, 2013, 03:39:17 pm
Hi AmgO

Thanks for your input regarding my last question and observations on calculating the  speed issue.  I just downloaded the lastest update so I will keep an eye on things and let you know of any relevant feedback.

I have noticed a few minor issues and wanted to ask for your input/help

1) I have two triggers as I mentioned when we are coming home. One when the phone falls below 17km to turn up the heat and the second at 2km with a delay in the scene to run the I'm Home scene.  I figured that picking a distance a bit further away and adding a delay would be more reliable as the cell service is spotty in our area
   The problem that keeps occuring is that when  the phone refreshes and is below the trigger  threshold it runs the scene again, however its sporadic.  Yesterday it ran the thermostat scene 6 times before we got home and then tried opening the garage 3 times.  Is there any easy way to prevent the scene from triggering multiple times? 

2) There have been 2 situations where the phone triggers the scene even while on mute.  It opened the garage doors at 2:15 am and I only have the phone set to unmute 30min after we lock the front door which triggers our keyless go. (I did this to prevent scenes from firing until we got past the 17km trigger for the tstat because it kept putting the heat back up while we were heading out for the day   I originally thought I could unmute once the phone passes .5 km and set that trigger up but forgot about it when you indicated I shouldn't use a distance trigger to unmute, however today the phone was at home and reported its location as .66km away and it unmuted itself and then the garage doors opened and the tstat triggered again. 

I'm hoping you can help cause I love your plug in and what it can do but the boss is starting to become less patient with my tinkering when doors are opening and closing at random etc.  What I did do after the 2am opening was to put luup conditions in the scene so that it won't even open the door between 12:30am and 8am which will help but won't stop the daytime random triggering.  Any ideas?

Ryanoc,  I do not know what it could come from. we need to look at debug trace and grep for string like "IPhoneLocator: debug: updateDevice(" to see what is going on
Title: Re: Plugin - IPhone Locator
Post by: Piwtorak on December 18, 2013, 05:03:38 pm
Hello Amg0

I am very happy using version 1.50...

I would like know if you think in put the resource when I deactivate my location in iphone if the data in vera do not changes...stay the last data read....

actually if I want privacy for a time...and deactivate the locator in iphone....it puts a error message...

thanks in advance for this job...very good !
Title: Re: Plugin - IPhone Locator
Post by: Ryanoc75 on December 18, 2013, 07:58:42 pm
Hi amgO

    I figured that you might need to look at the logs so I set the locator on debug yesterday and we were in and out a few times which generated multiple triggers. I also have the info viewer plugin installed but I'm not sure how to extract and send the debug log files to you to review?  Thanks again for your time and quick replies - you're great!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 19, 2013, 01:58:35 am
Hi amgO

    I figured that you might need to look at the logs so I set the locator on debug yesterday and we were in and out a few times which generated multiple triggers. I also have the info viewer plugin installed but I'm not sure how to extract and send the debug log files to you to review?  Thanks again for your time and quick replies - you're great!

Several ways possible:

a) classic way
1) turn on DEBUG 2) open http://Your.Vera.IP.Address/cgi-bin/cmh/log.sh?Device=LuaUPnP 3) let it run for a while so the problem happens 4) in your browser save the file on your disk  5) open with an editor (notepad or whatever ) and search for your iCloud email , change email/pwd so I do not see it , save the file 6) send it to me using PM on this forum

b) using infoviewer
1) open InfoViewer, put the pattern to "IPhoneLocator"
2) open Infoviewer page then View Logs
3) same as above a.4 a.5 a.6

c) using WinSCP / Windows
1) use WinSCP
2) chose SCP as file protocol
3) Hostname = your vera ip address , username=root , Password= your vera password
4) once logged in , go to folder /var/log/cmh/
5) select file LuaUPnP.log , drag and drop it on your desktop
6) same as a.5, a.6
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on December 22, 2013, 02:41:13 am
amg0, this plugin developed very well since the last upgrade!

I have rather an odd use case, but maybe there is a trick around this. My wife's iPhone does not have a 3G subscription, thus only reports her correct location when she is at home (wifi). Is there any way to identify she is not at home because the lastupdate failed, or the time of the last known location is over an hour old?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 22, 2013, 05:52:34 am
amg0, this plugin developed very well since the last upgrade!

I have rather an odd use case, but maybe there is a trick around this. My wife's iPhone does not have a 3G subscription, thus only reports her correct location when she is at home (wifi). Is there any way to identify she is not at home because the lastupdate failed, or the time of the last known location is over an hour old?

Not directly.  the "last update" does not fail even if the device is not connected to a network. But the "LastUpdate" variable of the device is now coming from the unix timestamp given by iCloud  ( in the past / old versions it was the time at which I was polling but I changed that in 1.69 and above version ) , so this "LastUpdate" can be a timestamp 2h old in some situations. you can therefore have a scene/scripting which checks if the device is "present" but the "LastUpdate" is older than let's say 1 hour, and make a decision about it based on your needs
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on December 22, 2013, 06:00:56 am
thx that would help, the only thing is that it has a funny format in the device properties of PLEG -> 1387705020.906
Title: Re: Plugin - IPhone Locator
Post by: amg0 on December 22, 2013, 06:07:35 am
thx that would help, the only thing is that it has a funny format in the device properties of PLEG -> 1387705020.906
Just to be clear, that "LastUpdate" feature is already in V1.70 public version.
The value you see is standard lua/unix format.  If t1 is the value of LastUpdate in the device,  the code "os.difftime(os.time(), t1)" will give you the difference in seconds between the 2

http://lua-users.org/wiki/OsLibraryTutorial
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on December 23, 2013, 01:57:29 pm
thx that would help, the only thing is that it has a funny format in the device properties of PLEG -> 1387705020.906
Just to be clear, that "LastUpdate" feature is already in V1.70 public version.
The value you see is standard lua/unix format.  If t1 is the value of LastUpdate in the device,  the code "os.difftime(os.time(), t1)" will give you the difference in seconds between the 2

http://lua-users.org/wiki/OsLibraryTutorial

If you were to use PLEG  should be able to do the following:

Inputs - Device Properties:
LastUpdate_iPhone    (*)iPhone           LastUpdate
CurrentTime              PLEG_Instance   LastConditionChange

Conditions
ForceCheck:    NOW
NotMovedFor1Hour:   (LastUpdate_iPhone + 3600) <= CurrentTime

This should make "NotMovedFor1Hour 'true' if the LastUpdate_iPhone timestamp hasn't changed in 3600 seconds (1 hour).

AFIK, the NotMovedFor1Hour condition will only be true if the PLEG instance tracks some other other input or condition that causes the status of the PLEG instance to get updated.

I believe one way to ensure that happens is to have a condition that uses 'NOW', which is why I included (the possibly unnecessary) the second condition.
Title: Re: Plugin - IPhone Locator
Post by: Crismaison on December 23, 2013, 02:39:29 pm
Solution was PrevUpdate ; Now > 01:00:00

Lastupdate is not usefull, since it will be refreshed everytime. The Prev update remains with the last successfull update
Title: Re: Plugin - IPhone Locator
Post by: SM2k on January 09, 2014, 10:09:14 am
Hi amg0, thanks for this amazing plugin. I did notice something (version 1.7.1) with respect to the device list in the settings of the main device. One of the phones on my account had never been synched with a computer so it was still named "iPhone". When I selected that, that ended up matching several devices, e.g. "Music iPhone", "Clock iPhone". I would suggest that since each of those entries is referring to a specific device, regex anchors e.g. "^iPhone$" would be appropriate. It was a little disorienting as I tripped over that while still getting familiar with the plugin.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on January 09, 2014, 01:51:50 pm
Hi amg0, thanks for this amazing plugin. I did notice something (version 1.7.1) with respect to the device list in the settings of the main device. One of the phones on my account had never been synched with a computer so it was still named "iPhone". When I selected that, that ended up matching several devices, e.g. "Music iPhone", "Clock iPhone". I would suggest that since each of those entries is referring to a specific device, regex anchors e.g. "^iPhone$" would be appropriate. It was a little disorienting as I tripped over that while still getting familiar with the plugin.

I think I understand. I made that change in the SETTINGS tab: when you click on a specific iDevice name ( the left hand side list ) , it encapsulates it within regex anchors as it copies it into the list of patterns to monitor ( the right hand side list ).

Here is a test version that will be in the next release if all is going ok.
Title: Re: Plugin - IPhone Locator
Post by: n0ir on January 11, 2014, 07:15:27 am
I've recently started getting the following message popping up on my dashboard. "IPhoneLocator : Google Quota exceeded".

Probably that your plugin instance is polling too often or that you have too many devices being tracked and as a result you're polling too often. It's an API limit imposed by Google and not something @amg0 can code around.

I am new to the more advanced features of Vera but have tried to make iPhone Locator work. After a day or two I also get this error message and understand it has something do to with the polling settings. However, I can not understand what to change. I have the "Polling period" set to default (60) and I have checked "dynamic". Could someone please share some better settings that does not break Googles API limit?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on January 12, 2014, 06:48:44 am
I've recently started getting the following message popping up on my dashboard. "IPhoneLocator : Google Quota exceeded".

Probably that your plugin instance is polling too often or that you have too many devices being tracked and as a result you're polling too often. It's an API limit imposed by Google and not something @amg0 can code around.

I am new to the more advanced features of Vera but have tried to make iPhone Locator work. After a day or two I also get this error message and understand it has something do to with the polling settings. However, I can not understand what to change. I have the "Polling period" set to default (60) and I have checked "dynamic". Could someone please share some better settings that does not break Googles API limit?

With Dynamic mode checked in , it then depends on the "Mode" Parameter. this table summarize the behavior.

More information about auto polling mode
ModeDistanceSpeedEtaPolling
Directcalculated from gps coordinate from the last and previous positionscalculated from ratio distance/polling. if speed is less than MIN_SPEED it is considered null.calculated from distance/speed. if speed is null, it assumes a default speed (NOMOVE_SPEED) to make sure polling does not get too infrequentWith polling map: it uses the polling map, based on device distance.
Without polling map, it takes the ETA, remove from it a default LATENCY parameter to compensate for lateness of iCloud compared to reality, divide the eta by the PollingDivider set by the user.  Then the result is normalized to allways be between a MIN_PERIOD and MAX_PERIOD.
Driving, Bicycling, WalkingReceived from Google Matrix APIsame as above.ETA is not calculated, it is simply received from the google matrix API and therefore is subject to google calculation and estimation what your speed is based on the mode you selected.same as above.


as a recommendation I would try dynamic + mode = Direct and either no polling map , if you want to control polling more, a polling map like "0:600,1:60,10:300,100:1800" , you fine tune the distance steps ( first number before the ':' according to your pattern )

as another recommendation, use a scene to mute the phone during the night for instance, that will be that much google request done in a day and wont impact your daily quota so fast

hope this helps
Title: Re: Plugin - IPhone Locator
Post by: n0ir on January 12, 2014, 07:04:17 am
Thanks! I really do not understand the concept of a polling map but I will try the settings you recommend and evaluate. Should I change the Polling Divider to something other than 3?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on January 12, 2014, 08:04:32 am
Thanks! I really do not understand the concept of a polling map but I will try the settings you recommend and evaluate. Should I change the Polling Divider to something other than 3?

Polling map is a comma separated list of pairs like distance:value. The plugin uses this to determine the polling frequency ( in sec) based on the reporte device distance. The polling divider is not use if you use a polling map.

If you do not use a polling map then the plug in calculate the time it would take the device to come home and divide that time by the divider in order to split the time in chunks for better accuracy. The higher the divider the more frequEnt it will poll and therefor influence your phone battery life and count against your google quota. So 3 seems a sensible value but your mileage may vary
Title: Re: Plugin - IPhone Locator
Post by: ronniech on January 13, 2014, 01:37:14 am
I'm getting this error with a dynamic polling and using one device only "IPhoneLocator : Google Quota exceeded".

Is it affecting cause there's some setting that's still polling the old removed devices. I had 3 iCloud account with their own devices then removed it using ui5
Title: Re: Plugin - IPhone Locator
Post by: amg0 on January 13, 2014, 06:30:40 am
I'm getting this error with a dynamic polling and using one device only "IPhoneLocator : Google Quota exceeded".

Is it affecting cause there's some setting that's still polling the old removed devices. I had 3 iCloud account with their own devices then removed it using ui5

It  is because you poll too often. Do the calculation over a period of 24h to see. Google impose a limit of 1500 per day I think it will self recover and work again when you stop polling so frequently. Change your settings and mute during night are explained above for instance

Note that this error just prevent the plugin from displaying the address of the device but is fully functional in mode "direct"
Title: Re: Plugin - IPhone Locator
Post by: n0ir on January 13, 2014, 07:02:02 am
I'm getting this error with a dynamic polling and using one device only "IPhoneLocator : Google Quota exceeded".

Is it affecting cause there's some setting that's still polling the old removed devices. I had 3 iCloud account with their own devices then removed it using ui5

It  is because you poll too often. Do the calculation over a period of 24h to see. Google impose a limit of 1500 per day I think it will self recover and work again when you stop polling so frequently. Change your settings and mute during night are explained above for instance

Note that this error just prevent the plugin from displaying the address of the device but is fully functional in mode "direct"

Does the mute setting means the app do not poll the phone? If I set a scene to "mute" the app at times when I know I am home (or at work), it will not poll?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on January 13, 2014, 07:59:45 am
Does the mute setting means the app do not poll the phone? If I set a scene to "mute" the app at times when I know I am home (or at work), it will not poll?

Correct.

Muted means there are no polls.

I'm using PLEG and door sensors to trigger "start polling" for our iPhones. It also will stop polling within 5 minutes of us arriving and staying "in range" (i.e. home). There are a few examples of how to configure this in the PLEG forum thread, for instance.
Title: Re: Plugin - IPhone Locator
Post by: n0ir on January 13, 2014, 08:11:57 am
Ah, great! That should make some difference about the battery decline I have been experiencing!

Have you shared your PLEG in the PLEG forum thread? Tried to search but did not find anything. I am new to PLEG as well so some examples would really help.
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on January 14, 2014, 09:05:03 am
Iphone locator no longer works once I upgraded to latest version. Get this message No Devices for this account, check network/credentials. Credentials are correct and network is working.
Title: Re: Plugin - IPhone Locator
Post by: s4nup on January 17, 2014, 05:07:05 am
Iphone locator no longer works once I upgraded to latest version. Get this message No Devices for this account, check network/credentials. Credentials are correct and network is working.
Very strange. I downloaded and installed this and its working perfectly for me. Added both mine and my wifes phone. Just need to think of the best way to Arm the alarm once BOTH phones are away from the house.

Thanks
Title: Re: Plugin - IPhone Locator
Post by: SM2k on January 17, 2014, 10:57:15 am
Very strange. I downloaded and installed this and its working perfectly for me. Added both mine and my wifes phone. Just need to think of the best way to Arm the alarm once BOTH phones are away from the house.

Thanks

It's too bad the combo switch plugin doesn't know how to handle the iphone locator plugin, because then that would be trivial. I've managed to monitor two phones to run some away-from-home stuff using some luup code.
Title: Re: Plugin - IPhone Locator
Post by: RichardTSchaefer on January 17, 2014, 11:04:11 am

Quote
It's too bad the combo switch plugin doesn't know how to handle the iphone locator plugin, because then that would be trivial. I've managed to monitor two phones to run some away-from-home stuff using some luup code.

You can always use PLEG it should work with ANY plugin.
Title: Re: Plugin - IPhone Locator
Post by: shotgun29 on February 15, 2014, 08:01:30 pm
hallo
Has anybody any good ideas, if you have two different icload accounts with 2 different iPhones, how to create a scene that makes it possible to only do something if both phones is out of range. Need to use this app to activate my going away scene. But only if all phones in is out of the ranche i have specified. Also do i have to create 2 plugin to have 2 different Icload accounts or is i possible to have 2 Icload accounts in 1 plugin?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on February 15, 2014, 08:55:36 pm
hallo
Has anybody any good ideas, if you have two different icload accounts with 2 different iPhones, how to create a scene that makes it possible to only do something if both phones is out of range. Need to use this app to activate my going away scene. But only if all phones in is out of the ranche i have specified. Also do i have to create 2 plugin to have 2 different Icload accounts or is i possible to have 2 Icload accounts in 1 plugin?

Can't configure 1 plugin instance for 2 accounts, no.

I use PLEG  (Program Logic Event Generator) plugin with the two plugin distance triggers as INPUTs and then create a CONDITION containing plugin1 AND plugin2 as the condition. From that, an ACTION is triggered.
Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on February 18, 2014, 09:51:08 am
I had this app months ago and with an update it quit working. I tried to install the app again just to see if it would work again. Still not working. When I try to specify which devices to track it copies over blanks. Tried to type them in advanced tab and it won't save. I also get "IPhoneLocator : Invalid google return format"
Title: Re: Plugin - IPhone Locator
Post by: BulldogLowell on February 18, 2014, 10:08:38 am
was the update UI6?

Title: Re: Plugin - IPhone Locator
Post by: aaronsquire on February 18, 2014, 10:12:18 am
was the update UI6?

It was an IphoneLocator Update caused it to quit working before. I am on UI6 now though.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on February 18, 2014, 03:51:50 pm
was the update UI6?

It was an IphoneLocator Update caused it to quit working before. I am on UI6 now though.

What browser are you using ? can you send a log file ?
it seems some javascript issue which could be related to browser versions. anyhow with v1.72, in advanced tab, you can type something like ^my iPhone name$  in the IPhoneName variable of the advanced tab to by pass the logic and javascript magic of the settings tab.

UI6: I do not yet support this, too much risk for my VERA, I ll see later if I can upgrade when it is released. or if somebody wants to contribute and test/fix some issue, feel free , the code is readable in the TRAC location http://code.mios.com/trac/mios_iphone-detector/browser
Title: Re: Plugin - IPhone Locator
Post by: adamfox on February 23, 2014, 07:42:33 pm
amg0, wondering if you would be willing to share what you consider an ideal setup for polling (accurate, yet conservative with battery drain). My wife is riding me about battery drain on her iPhone and I'd like to tinker with the settings here to improve that.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on February 24, 2014, 04:51:37 pm
amg0, wondering if you would be willing to share what you consider an ideal setup for polling (accurate, yet conservative with battery drain). My wife is riding me about battery drain on her iPhone and I'd like to tinker with the settings here to improve that.

Here are my personal preferences:
a) first of all, when my wife and my phone are at home, then I mute both phone between 21:00 and 06:00
b) then Polling mode : "direct" , Polling Base : 600,  Dynamic check box checked, Polling divider 3
- is reasonably accurate , although I notice some issue because iCloud tend to give you the last position he knows , while it goes check the phone position, so you kind of allways get the previous instead of the very latest one.  I plan to do something about some days like polling twice ...

c) an alternate setting I have used is Polling mode :"direct", Dynamic check box checked  and Polling Map : 0:600,0.2:30,5:100,10:300,100:1800.   which works find for instance when your external garage gate is a bit far from your home central location.  However, try to see how far is your wife usual location during the day ( work? ) and set a polling map step so that it does not poll too often whe she is at work for instance but increase the frequency when she is coming closer

hope this helps
Title: Re: Plugin - IPhone Locator
Post by: adamfox on February 26, 2014, 07:29:43 am
Most definitely. Thanks for the input!

I need to read up a bit more on the polling map option. However, I was able to use a combination of a door/window sensor on the front door and the ping sensor plugin to toggle mute when we enter/leave the house. Which works out really well.

Thanks again for your input and all your hard work on this.




Sent from my iPhone using Tapatalk
Title: Re: Plugin - IPhone Locator
Post by: xdotcommer on March 05, 2014, 05:47:16 am
hallo
Has anybody any good ideas, if you have two different icload accounts with 2 different iPhones, how to create a scene that makes it possible to only do something if both phones is out of range. Need to use this app to activate my going away scene. But only if all phones in is out of the ranche i have specified. Also do i have to create 2 plugin to have 2 different Icload accounts or is i possible to have 2 Icload accounts in 1 plugin?

Can't configure 1 plugin instance for 2 accounts, no.

I use PLEG  (Program Logic Event Generator) plugin with the two plugin distance triggers as INPUTs and then create a CONDITION containing plugin1 AND plugin2 as the condition. From that, an ACTION is triggered.

Does this mean you were able to install two instances of the plugin?  I am unable to do so.
Title: Re: Plugin - IPhone Locator
Post by: Brientim on March 05, 2014, 11:39:31 am
Does this mean you were able to install two instances of the plugin?  I am unable to do so.
You do not install a second instances but rather create... Goto to APPS > My Apps > the Plug In (click on name) > Create Another. This should create a second device independent of the first.
Title: Re: Plugin - IPhone Locator
Post by: manfaiho on March 29, 2014, 11:02:58 am
Thank your contribution and it works perfectly to trace my kids location. Can we have a luup script from scene to send me email periodically including the location information and the map snapshot when the iphone is away the base until present again? I think it is very help to alert me immediately when my kids are out of my safety area. Besides, can we have more than 1 base station for alert? Should I create a new device for another base configuration? Your feedback will be greatly appreciated. Thanks.

Best regards,
Fai
Title: Re: Plugin - IPhone Locator
Post by: amg0 on March 30, 2014, 11:41:04 am
Thank your contribution and it works perfectly to trace my kids location. Can we have a luup script from scene to send me email periodically including the location information and the map snapshot when the iphone is away the base until present again? I think it is very help to alert me immediately when my kids are out of my safety area. Besides, can we have more than 1 base station for alert? Should I create a new device for another base configuration? Your feedback will be greatly appreciated. Thanks.

Best regards,
Fai

I have not tried but that should be no problem.  You create a scene with an "interval based" schedule ( repeat every x minute )
Then you write in the scene LUUP tab some code using the variable_get
Code: [Select]
-- get value and last changed timestamp
local service = "urn:upnp-org:serviceId:IPhoneLocator1"
local variable = "vvvv"
local value, tstamp = luup.variable_get(service, variable, XXXX)
where you replace XXXX by your iPhone Locator device number and vvvv by the variable name that is interesting to you.  Variables names and content are documented in http://forum.micasaverde.com/index.php/topic,16907.0.html but here are good ones for what you need.


with a couple of calls to luup.variable_get() , you can get what you want and stuff it in a string that you can then sent by an email. you can use the lua method string.format() like this
Code: [Select]
local email_body = string.format("CurLat :%f , CurLong  :%f , Map Url:%s",CurLat ,CurLong,MapUrl  )
pushingbox_notify( email_body )

Then to send email, you need to use one of your favorite methods spoke about in this forum. Either VeraAlert, or the SMTP plugin or something else like the various free internet based service like PushingBox which is what I use.  I personally have a startup.lua method and a PushingBox "service" which expects an input parameter caleld "value" and , when pushing box receives it, it sends a email to my gmail with it in the content.

Code: [Select]
function pushingbox_notify( str )
    local pushingbox_DID="YOUR SECRET DEVICE ID GIVEN TO YOU BY PUSHINGBOX"
    local newstr = url_encode(str)
    -- luup.log("INFO: sending notification with value:" .. str )
    luup.inet.wget("http://api.pushingbox.com/pushingbox?devid=" .. pushingbox_DID .. "&value=" .. newstr .. "" )
    return true
    end

There may be a smarter way to get the image directly embedded into the email but I have not tried that also I think the pushing_box method is probably limitting you to what you pass in the email ( like probably no HTML formatting can be passed in ) but other methods could. happy to hear others way of doing it
Title: Re: Plugin - IPhone Locator
Post by: manfaiho on March 31, 2014, 11:04:40 am
Thanks, amg0. I am trying Pushingbox but I got error on URL_Encode. Can you help? Thanks. Best regards, Fai
Title: Re: Plugin - IPhone Locator
Post by: manfaiho on March 31, 2014, 11:12:55 am
I found the function code:

function urlencode(str)
   if (str) then
      str = string.gsub (str, "\n", "\r\n")
      str = string.gsub (str, "([^%w ])",
         function (c) return string.format ("%%%02X", string.byte(c)) end)
      str = string.gsub (str, " ", "+")
   end
   return str   
end

But I don't know how to put the URL string that can be click on the email to browser to see the map directly or how to embed the map into mail body?

Best regards,
Fai
Title: Re: Plugin - IPhone Locator
Post by: awake33 on April 03, 2014, 05:41:30 pm
How would one create two plugin instances for the same icloud device? When I rename the 'device' in Vera, it resets after the next locator update. So if I were to create a second instance it would have the same name, based on the iphone's name?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on April 03, 2014, 05:56:00 pm
How would one create two plugin instances for the same icloud device? When I rename the 'device' in Vera, it resets after the next locator update. So if I were to create a second instance it would have the same name, based on the iphone's name?

Yes. And as far as I can tell there are namespace collisions causing interesting results as far as the settings go (polling was displayed incorrectly for the 2nd instance and vice versa)
Title: Re: Plugin - IPhone Locator
Post by: awake33 on April 04, 2014, 02:03:57 am
How would one create two plugin instances for the same icloud device? When I rename the 'device' in Vera, it resets after the next locator update. So if I were to create a second instance it would have the same name, based on the iphone's name?

Yes. And as far as I can tell there are namespace collisions causing interesting results as far as the settings go (polling was displayed incorrectly for the 2nd instance and vice versa)

I created a second instance anyway to see what happens. At first I though it was intermittently displaying incorrect polling info as well, but upon closer observation it seems as though maybe the two device interfaces momentarily swap places in the UI.
Title: Re: Plugin - IPhone Locator
Post by: coverthawk on April 04, 2014, 02:49:54 pm
Iphone locator no longer works once I upgraded to latest version. Get this message No Devices for this account, check network/credentials. Credentials are correct and network is working.

I am having the exact same issue - but mine was from an initial install, not an upgrade.  I have multiple devices linked to my iCloud account, and when I select my iPhone, the name of it doesn't click over (a generic "no device" name is assigned, and then the save fails.

Any tips here?
Title: Re: Plugin - IPhone Locator
Post by: agoodman82 on April 07, 2014, 05:08:51 pm
For the first time since installing the iPhone Locator plugin and using a PLEG to mute/unmute the plugin, I just started receiving today the "google quota exceeded" message. I'm utilizing the plugin for two iPhones, and I realize that this means I've exceeded the number of "pings" allowed for my devices and that this is a number set by google and not within the app itself.

But I'm curious, what exactly is the quota for instances of pinging devices? Is there somewhere on a google page you can see what you're at in regards to the quota? When is it reset... daily? weekly? I guess I'll have to look at my polling intervals and modify them so the phones are pinged less but it's too bad google even imposes a quota to begin with.
Title: Re: Plugin - IPhone Locator
Post by: Eldoctor62 on April 08, 2014, 09:41:33 am
Hi,

I found this great plugin! Amg a thank you for this great work!

I use 2 account but I find that if the phone is off, and it does not answer the poll, he always keeps the last position ...

Is it possible to consider absent?

Because if you have more network. or if you have exhausted the telephone package. it no longer receives the answer so why keep the last position? Why not put anything and look away ... Unless he has returned home and wifi back and is present ...

What do you think?
Title: Re: Plugin - IPhone Locator
Post by: agoodman82 on April 08, 2014, 06:00:19 pm
Is there a way to delete an iPhone locator plugin "device" without deleting any other instances of the iPhone Locator plugin? I had to create a new device through the app to try to fix something and now I want to delete the newly created device without deleting any other instances of the plugin.

SOLVED -- I made the device its own parent and it disappeared
Title: Re: Plugin - IPhone Locator
Post by: Piwtorak on April 09, 2014, 06:22:37 pm
I have one case like yours. I would like to remove the device but I do not want setting up all anothers devices again...

I change the parent for itself but the alert says will brick the vera, you click OK even reading this ?
thanks

Title: Re: Plugin - IPhone Locator
Post by: RexBeckett on April 09, 2014, 06:44:26 pm
You can delete an individual plugin device by entering the following in your browser:

Code: [Select]
http://ip_address:3480/data_request?id=device&action=delete&device=123
Where ip_address is the IP address of your Vera and 123 is the device number that you want to delete.
Title: Re: Plugin - IPhone Locator
Post by: amg0 on April 13, 2014, 09:38:41 am
Hi,

I found this great plugin! Amg a thank you for this great work!

I use 2 account but I find that if the phone is off, and it does not answer the poll, he always keeps the last position ...

Is it possible to consider absent?

Because if you have more network. or if you have exhausted the telephone package. it no longer receives the answer so why keep the last position? Why not put anything and look away ... Unless he has returned home and wifi back and is present ...

What do you think?

Hello, I am not fully understanding your question but iPhone locator does not really control that behavior. it is iCloud which allways keep the last known position and returns this one if the Phone is not connected. 
Variable MsgTxt2 gives you the iCloud timestamp
0.02 Km @ 0.00 Km/h on 2014-04-13 14:58
while Variable MsgTxt gives the timestamp at which we polled iCloud
Poll: 2014-04-13 15:27 / 600 s

you could see ( eventually write script ) that takes into accoutn if the iCloud timestamp is old to see if the Phone appears "offline".  Iwill consider this for a future version to have such a iPhone state in addition to present/absent
Title: Re: Plugin - IPhone Locator
Post by: amg0 on April 13, 2014, 09:40:06 am
For the first time since installing the iPhone Locator plugin and using a PLEG to mute/unmute the plugin, I just started receiving today the "google quota exceeded" message. I'm utilizing the plugin for two iPhones, and I realize that this means I've exceeded the number of "pings" allowed for my devices and that this is a number set by google and not within the app itself.

But I'm curious, what exactly is the quota for instances of pinging devices? Is there somewhere on a google page you can see what you're at in regards to the quota? When is it reset... daily? weekly? I guess I'll have to look at my polling intervals and modify them so the phones are pinged less but it's too bad google even imposes a quota to begin with.
I think it is 2500 per 24 hours.  cf https://developers.google.com/maps/documentation/geocoding/
Title: Re: Plugin - IPhone Locator
Post by: amg0 on April 13, 2014, 12:06:00 pm
How would one create two plugin instances for the same icloud device? When I rename the 'device' in Vera, it resets after the next locator update. So if I were to create a second instance it would have the same name, based on the iphone's name?

Yes. And as far as I can tell there are namespace collisions causing interesting results as far as the settings go (polling was displayed incorrectly for the 2nd instance and vice versa)

can you elaborate to give more details  on this issue ? what naming collision do you see ?
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on April 13, 2014, 02:44:36 pm
can you elaborate to give more details  on this issue ? what naming collision do you see ?

I attempted to create a second iPhone Locator device for the same account to let me track whenever I was at work (and use PLEG to trigger based on leaving work, etc). When doing that, the polling info for the two instances wound up displaying incorrectly for the instances (they would flip and then flip back again). Also, since the device won't preserve the name I'd set manually (it would overwrite it with the name of the iPhone on the next poll() operation) I can't unequivocally state it was namespace collisions that resulted in the changes to the polling data (hard to track the device that is actually being shown once the settings tab is open), but setting the polling information in one instance made the same polling settings appear in the other instance.
Title: Re: Plugin - IPhone Locator
Post by: Eldoctor62 on April 27, 2014, 07:21:20 am
Hello,

I use 2 plug iPhone locator for more than a month without a single problem ...
Since yesterday, whenever I do a "Refresh" on one of the two I have a Luup crash and my vera restart ...
I have not changed anything yet!
Where is that it can come from it?
Title: Re: Plugin - IPhone Locator
Post by: joselvelez on May 05, 2014, 06:28:58 pm
Hello,

I just recently installed version 1.8 and have had no success getting it to work.  It keeps saying, "No Devices for this account, check network/credentials".  I've entered my icloud info over and over and it refreshes and pulls my 3 devices just fine, but when I add them and save nothing sticks.  I've refreshed the browser, reloaded Vera and rebooted and nothing.

What am I doing wrong? 

Thanks!
Title: Re: Plugin - IPhone Locator
Post by: amg0 on May 07, 2014, 04:59:09 pm
Hello,

I just recently installed version 1.8 and have had no success getting it to work.  It keeps saying, "No Devices for this account, check network/credentials".  I've entered my icloud info over and over and it refreshes and pulls my 3 devices just fine, but when I add them and save nothing sticks.  I've refreshed the browser, reloaded Vera and rebooted and nothing.

What am I doing wrong? 

Thanks!

the quote in the device phone name is probably the issue. try to rename the device ( in the IOS settings on your device ) to a name which does not include a quote.
Title: Re: Plugin - IPhone Locator
Post by: blingal on May 26, 2014, 05:41:47 pm
Hi all,

im kinda new here and just got the plugin working  ;D it works great

However, im looking for advice on how to setup a trigger. Ideally I would like to get a notification (email or push) when the phone enters a particular area, say a postcode. I would also like a notification when the phone leaves that area. But I do not want any subsequent messages while the phone stays in that area.

The only trigger I seem to find is relating to distance which calculated from the home distance. Using the distance to home as a trigger doesnt seem like a very accurate mechanism

What kind of trigger would you recommend and how would it be setup?

Thanks for any tips and tricks

Title: Re: Plugin - IPhone Locator
Post by: amg0 on May 27, 2014, 02:49:52 pm
Hi all,

im kinda new here and just got the plugin working  ;D it works great

However, im looking for advice on how to setup a trigger. Ideally I would like to get a notification (email or push) when the phone enters a particular area, say a postcode. I would also like a notification when the phone leaves that area. But I do not want any subsequent messages while the phone stays in that area.

The only trigger I seem to find is relating to distance which calculated from the home distance. Using the distance to home as a trigger doesnt seem like a very accurate mechanism

What kind of trigger would you recommend and how would it be setup?

Thanks for any tips and tricks

here is a suggestion, you could create a different instance of the iPhoneLocator plugins ( even for the same phone iCloud account, so for example, an instance for your home and an instance for your remote location)  and consider "Home" to be the location you are interested in. then use the trigger "a Device is present or away" to get a trigger when it gets close or goes away from the "home" location.
Title: Re: Plugin - IPhone Locator
Post by: blingal on May 27, 2014, 03:38:05 pm

here is a suggestion, you could create a different instance of the iPhoneLocator plugins ( even for the same phone iCloud account, so for example, an instance for your home and an instance for your remote location)  and consider "Home" to be the location you are interested in. then use the trigger "a Device is present or away" to get a trigger when it gets close or goes away from the "home" location.


aaahhhhhhh yes this works too..... why didnt I think of it..... ok so all instances are setup, triggers and actions are also setup. But now I get the error message "IPhoneLocator : Google quota exceeded" how much is the quota?

Im assuming the more instances I create the more I will be sending requests to google. Is the google polling controlled also by the iCloud polling parameter?
Title: Re: Plugin - IPhone Locator
Post by: amg0 on May 28, 2014, 04:30:22 pm

here is a suggestion, you could create a different instance of the iPhoneLocator plugins ( even for the same phone iCloud account, so for example, an instance for your home and an instance for your remote location)  and consider "Home" to be the location you are interested in. then use the trigger "a Device is present or away" to get a trigger when it gets close or goes away from the "home" location.


aaahhhhhhh yes this works too..... why didnt I think of it..... ok so all instances are setup, triggers and actions are also setup. But now I get the error message "IPhoneLocator : Google quota exceeded" how much is the quota?

Im assuming the more instances I create the more I will be sending requests to google. Is the google polling controlled also by the iCloud polling parameter?
google quote is 2500 poll per 24h, it will reset automatically.there is one call to google per call to icloud.

to avoid reaching quota you need to reduce polls to icloud by either muting device during uninterested hours or use a dynamic polling based on google estmations (empty map) or a specific map.  see http://forum.micasaverde.com/index.php/topic,18822.0.html autopolling Q & A.
Title: Re: Plugin - IPhone Locator
Post by: hummer5 on June 12, 2014, 07:35:22 am
joselvelez,

I had the same problem. I resolved it by removing special characters from my icloud password. Give it a try if you were unable to login so far.
Title: Re: Plugin - IPhone Locator
Post by: chrisdixon22 on June 18, 2014, 09:47:30 am
Great App, but tweak the settings. Therefore, I may have some questions later.
Title: Re: Plugin - IPhone Locator
Post by: chrisdixon22 on June 18, 2014, 10:03:51 am
Hello,

I just recently installed version 1.8 and have had no success getting it to work.  It keeps saying, "No Devices for this account, check network/credentials".  I've entered my icloud info over and over and it refreshes and pulls my 3 devices just fine, but when I add them and save nothing sticks.  I've refreshed the browser, reloaded Vera and rebooted and nothing.

What am I doing wrong? 

Thanks!

I have this same problem. Since, I dont have access to other devices on my icloud account at this moment I cannot rename them. Therefore, I just rename mines from Chris's iPhone 5s to Chris iPhone 5s. Does all the iDevices on the icloud account have to be renamed or can just rename the Parent device and add it. I tried it and I'm getting the same results above.
Title: Re: Plugin - IPhone Locator : Google Quota Exceeded
Post by: clippermiami on July 10, 2014, 11:01:17 am
I have one iPhone device configured with a polling cycle of 60 seconds (1440 per day) and I'm getting Google Quote Exceeded. This started the other day when my daughter upgraded her iPhone 4 to an iPhone 5 and for a brief time there were two devices in her iCloud account so I figured it was because of the two devices.

But she has since turned off the original iPhone 4 and the errors have started again.

Any advice?

Title: Re: Plugin - IPhone Locator
Post by: play2lose on July 10, 2014, 11:57:00 pm
I just installed this plugin and when i try to add my phone that shows up in the list it adds the name "^undefined$" instead. When I try to say the changes it tells me an error has occurred. Any help would be greatly appreciated.

Thanks.
Title: Re: Plugin - IPhone Locator
Post by: clippermiami on July 11, 2014, 09:17:47 am
I now have another problem developing since my daughter got her new iPhone: Now the Locator is failing for no device found which I suspect may be due to the existence of two devices of the same name, one old and one new, in the iCloud. I found it in this state this morning and none of the other functions of Vera were working, lights were still on that should have been turned off, motion sensors did not turn on lights, etc. So now I've MUTEd it until I can sort it out.

Title: Re: Plugin - IPhone Locator
Post by: Kryckmeister on July 31, 2014, 10:42:43 am
You can (afaik) only track one device per plugin and iCloud account. But you have to pick the specific one you want. If your daughter got a new phone you must refresh and pick that one if that's the one you wanna "keep track of".
Title: Re: Plugin - IPhone Locator
Post by: clippermiami on July 31, 2014, 11:05:22 am
You can (afaik) only track one device per plugin and iCloud account. But you have to pick the specific one you want. If your daughter got a new phone you must refresh and pick that one if that's the one you wanna "keep track of".

We sorted it out finally. It appears that the "cloud" retains the names of any device that has ever existed. so when she got her new phone she gave it the same name as the old one and the cloud has both of them as still active. so we ended up having to rename the new one to something else and its finally working.
Title: Re: Plugin - IPhone Locator
Post by: rvosatka on August 15, 2014, 11:10:35 pm
Hi all-

I cannot seem to connect to my iCloud account.  I use Apple Two step verification.  Could this be impeding my logon?

Thx
Bob
Title: Re: Plugin - IPhone Locator
Post by: sjolshagen on August 22, 2014, 06:13:09 pm
I cannot seem to connect to my iCloud account.  I use Apple Two step verification.  Could this be impeding my logon?

I'm not finding any Apple functionality similar to what Google's "Application Passwords" provide, so unless there's an API available that can be added to the plugin, two-factor/two-step verification is likely not going to work with it.
Title: Re: Plugin - IPhone Locator
Post by: slytsi on September 09, 2014, 03:58:17 pm
I had the same problem and spent a while figuring it out. I finally got it to work when I configured it with Chrome and not IE.

Best of luck to you!

I just installed this plugin and when i try to add my phone that shows up in the list it adds the name "^undefined$" instead. When I try to say the changes it tells me an error has occurred. Any help would be greatly appreciated.

Thanks.
Title: Re: Plugin - IPhone Locator
Post by: surgeslc on September 09, 2014, 06:35:52 pm
I just installed this plugin and when i try to add my phone that shows up in the list it adds the name "^undefined$" instead. When I try to say the changes it tells me an error has occurred. Any help would be greatly appreciated.

Ditto for me, two months later. I've tried pattern matching which gets my phone's name into the list on the right, but still get an error when I try to save. I changed my iPhone's name to eliminate an underscore (_), and the new name (LCSiPhone4) was retrieved, so apparently the plug-in connects to iCloud, but still can't save to my month-old Vera3.
Title: Re: Plugin - IPhone Locator
Post by: surgeslc on September 10, 2014, 01:30:55 pm
Thanks for the reporting your experience, slytsi. I'm running OS X on a Mac, and wasn't sure if I'd tried Chrome, since I've been using Safari more lately. It was worth a try, but Chrome also moved ^undefined$ into the list on the right, and an error again occurred after I used pattern matching and tried to save.

In the last few days, there's been an update available for my Vera3, but installation has failed. I'll work to resolve that before working with the iPhone Locator again.

I had the same problem and spent a while figuring it out. I finally got it to work when I configured it with Chrome and not IE.

Best of luck to you!

I just installed this plugin and when i try to add my phone that shows up in the list it adds the name "^undefined$" instead. When I try to say the changes it tells me an error has occurred. Any help would be greatly appreciated.
Title: Re: Plugin - IPhone Locator
Post by: cino on September 16, 2014, 11:33:47 am
Any luck? I'm having the same problem with a fully up to date VeraLite.

Thanks for the reporting your experience, slytsi. I'm running OS X on a Mac, and wasn't sure if I'd tried Chrome, since I've been using Safari more lately. It was worth a try, but Chrome also moved ^undefined$ into the list on the right, and an error again occurred after I used pattern matching and tried to save.

In the last few days, there's been an update available for my Vera3, but installation has failed. I'll work to resolve that before working with the iPhone Locator again.

I had the same problem and spent a while figuring it out. I finally got it to work when I configured it with Chrome and not IE.

Best of luck to you!

I just installed this plugin and when i try to add my phone that shows up in the list it adds the name "^undefined$" instead. When I try to say the changes it tells me an error has occurred. Any help would be greatly appreciated.
Title: Re: Plugin -