FindFriendsMini a new iCloud FindmyFriends Plugin

Posted on
Sat Jan 06, 2018 11:23 pm
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

FindFriendsMini a new iCloud FindmyFriends Plugin

#FindFriendsMini

Image

Background
This plugin wouldn't be possible without Chameleons FindmyStuff indigo plugin which this is heavily based on. Thanks also go to DaveL for GhostXML and to pyicloud for the python icloud library. (Hopefully we see Mike/Chameleon back soon to update FindmyStuff - all the best Mike, regardless)

This plugin is aimed at replacing (hopefully temporarily) findmyStuff, and overcomes the current and ongoing 2-Factor-Authenication issue that it seems all icloud libraries currently have.

As I understand it - The current state of play with 2FA is:
Main - PyiCloud, now Python 3 library
Does not support 2FA, it supports 2SA - which is different.
After some code changes we can get 2FA to work - however it times out after 2 hours and needs re-authentication a new code. Clearly this isn't going to work.

This was initally envisioned as a quick update to iFindStuff enabling bypassing of non-functional 2FA. However updating iFindStuff began a rabbit hole I almost didn't escape out of! And instead went down this path of writing a new plugin.

Hence this new, plugin:

FindFriendsMini
It uses FindmyFriends icloud Service to enable tracking and mapping of enabled friends. It works somewhat differently to FindmyStuff and also has less information available. It does not use your 2FA/Main icloud account. So this main account remains 'save' and you do not need to share details of this main account with the plugin.

The plugin allow location tracking and mapping of device/friend locations. It bypasses 2FA problems (which remain in the base python libraries currently) by not enabling it for the account used. It also allows GeoFences to be created and then lets you know how many are within and for how long.

Setup:

Create an potentially new icloud Account (WITHOUT 2FA turned on)
ie. Your Indigo mac computer. (Some will have this already for imessage etc usage)
Important:
This account unfortunately needs to be also enabled and logged on to a iOS device (ie. ipad/iphone). (at least once)
Turn on FindmyFriends on this iOS device.
Do not turn on 2-Factor-Authentication for this account.

For those Friends/Family you need Indigo to track - send a friend request from this new account/or other way around.

Once accepted those friends and your new icloud/ndigo account will show up on your findmyfriends application in everyone’s device. If the Indigo account is in the findmyfriends account you should be good to go.

You can or your friends - can disable sharing of tracking with this indigo account (which is probably slightly more honest/open way of tracking)
[If tracking is disabled by a Friend the plugin will fail to update that friend (deviceLastUpdated time says old) and old location and mapping is still displayed]

It’s actually pretty simple:

For example

Create new iCloud account indigo@icloud.com
Sign in on IPad/Iphone
Sign in to FindmyFriends app on iphone/ipad
Send a friend request to those you want to share location with.
E.g friend1@icloud.com, friend2@icloud, friend3@icloud.com
If and when they accept you request they will show up in Findmyfriends app.

Install the plugin from Plugin Store:
Setup your indigo@icloud.com account details in plugin config.
Add new FindFriendsMini Device - selecting which friend.
E.g friend1@icloud.com
Create a new FindFriendsMini Device for each friend you wish indigo to locate.
The plugin will populate the custom states and location for each of these devices and create a hybrid google map for all the friends, and one for each friend individually.

Prerequisites:
Indigo 7 only
Needs Module six installed (if not already installed)
Terminal Window:
Code: Select all
sudo easy_install six




Install Plugin from Plugin Store:
http://www.indigodomo.com/pluginstore/139/

In FindFriendsMini Plugin Configuration (Most of the settings are here)
Enter iCloud Account enter these details, confirm. (the plugin only supports one main icloud account)

Image

Plugin Config Options:
Account Details:
Apple Account ID: Your new icloud account, setup on ipad/iphone without 2-factor-authentication enabled.
Apple Account Passport:
Minutes between rechecking status of devices and Geofences: 5 minutes default
Mapping:
Vertical size of Map max allowed by Google is 640, in pixels
Horizontal size of Map max allowed by Google is 640, in pixels
Zoom Size of Map 0-20
Google API: Need this for maps downloads. Create free API as below
http://forums.indigodomo.com/viewtopic.php?f=181&t=14734
Date/Time Format
Allows custom lastUpdate date/times. In pythons strftime format.
eg %c == Mon Jan 15 16:50:59 2018
eg. %b %d %Y %H:%M:%S == Feb 18 2009 00:03:38
eg. %a %d %b %I:%M %p == Mon 15 Jan 4:57 PM
More examples here:
http://strftime.org/
Update Frequency
Hours inbetween update checking.
Checkbox to open Plugin Store in default Webbrowser if update at time of check.
Debugging
Turn On/Off
Debug Level 1-3
& 4 which will open generated maps and url within browser.


Create New FindFriendsMini device

FindFriendDevice - Select the friend from the pull down box
Give it a Unique Name
Rename the Indigo Device as you see fit.
Image

For these friends the following custom states are Displayed:
(some of which are currently not reported at least not for me)
(Interestingly some of these unreported fields do get reported in you have the FindmyFriends app open at the time of the check - altitude for example and potentially others I haven't noticed)

    Address: Formatted with commas
    Altitude:
    batteryStatus: appears to be not reported
    deviceIsOnline
    deviceLastUpdated
    deviceTimeStamp
    horizontalAccuracy
    id
    labels
    latitude
    locationStatus: appears to be not reported
    locationTimeStamp: appears to be always 0
    longitude:
    status:
    timestamp: appears to be also 0


Image


Action Group

There is a single Device action group which immediately refreshes all friend devices and GeoFences (the data is all received together)

Image

PluginConfig Menu Options.

Image

Check for Updates: Checks github for updates and depending on config options will open Plugin Store
Open Plugin Store: Opens Web Browser and takes you to Plugin Store Page
Refresh Data Now: Updates all Friends/Geofences immediately


Mapping


The plugin also creates a google hybrid map for each Friend device and a seperate all_devices map. These are saved at: Users/accountname/Documents/Indigo-FindFriendsMini/

These are updated at the frequency set in the main config.

eg.
Image



Geofences

Added GeoFence Devices:
Create new IndigoPlugin Device from within Indigo.
Selected Type of FindFriendsMini and Device FindFriends GeoFence as in here:
Image

Edit Device Settings:

Image

Name/Name
Latitude/Longitude
Range: Circle of Geofence currently in Metres (sorry!) [1m = 3.28 feet]

GeoFence Device States:

Image

These stats are updated with Devices at same frequency (defaults to 5 minutes)
Stats of use:
friendsinRange = number of friends within the Geofence. Device is Green if more than 1 within, grey if noone
lastArrivalTime = date/time in configured format of Last arrival
lastDeptime = date/time in configured format of last Departure
minutessincelastArrival - minutes since this event. Updated at same frequency of devices
minutessincelastDep -

Allows triggering on state:
eg. if >20 minutes since someone left and 0 friend within Geofence - do something.

Image

With Condition of:

Image

Then -->Action of your choice:


--------------------------------------------------------------------------------------------------------
Changelog:

Latest Version:
0.1.4
Delete unused code/node - much smaller now!
Tidy up uiValue/Values for Geofences
Add Menu to check PluginStore
Change Update code to use PluginStore (seems some changes coming to PluginStore - so best to use I suspect
Change Plugin Config Menus.
Add option to change update checking time/and enable automatic opening of PluginStore
Some more logging advice for not setup correctly issues.
Add icon.png for PluginStore

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

Whilst this doesn't recreate all the functionally of FindmyStuff -- it locates my set devices/enables address display and mapping control page display which was my main usage, and now GeoFences for actions.

To use these you ideally need a Google Maps API setup, as Mike describes well here: (depending on frequency of map refreshing)
viewtopic.php?f=181&t=14734




Glenn
Last edited by GlennNZ on Tue Jan 23, 2018 3:49 pm, edited 7 times in total.

Posted on
Mon Jan 15, 2018 2:14 pm
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

Release 0.1.1

0.1.1

- Change to DateTime User Selectable string within config
eg. In format strftime. See. strftime.org for more options
eg %c == Mon Jan 15 16:50:59 2018
eg. %b %d %Y %H:%M:%S == Feb 18 2009 00:03:38
eg. %a %d %b %-I:%M %p == Mon 15 Jan 4:57 PM

-Update Plugin updater to ghpu format/code/New Menu items
-Code refactoring / deleting unused code
-Updated About website
-Better deal with missing fields

In Plugin Store

Posted on
Tue Jan 16, 2018 10:37 am
midd offline
Posts: 366
Joined: Apr 18, 2010

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

What exactly is the functionality? Is it other than just tracking? Like iFindstuff, I would want it for Geofencing.



Thanks

Indigo 7, Mojave on a 2009 Mac Pro..

Posted on
Tue Jan 16, 2018 2:17 pm
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

midd wrote:
What exactly is the functionality? Is it other than just tracking? Like iFindstuff, I would want it for Geofencing.
Thanks


Perhaps you should explain your usage.

FindmyFriendsMini the plugin access FindmyFriends locations. If you have set a home location, or a work location in your IOS app - then these individually set labels are used as the current status of the individual. If not the address location is used. Either way or the plugin states are accessible by indigo to set actions etc.

Thus it is quite possible to trigger actions on these states changing or equalling something eg. Work. Or an address, or a street name etc.

Happy to have a look at adding ‘geofencing’ devices to plugin. Personally I never used ifindstuff for location awarenesss e.g. arrived home - as it was not quick enough and there are much better solutions. I am currently using geofency IOS app with Beacon http://forums.indigodomo.com/viewtopic.php?t=11935 plugin - and is quick enough to open garage for me on arrival.


Glenn

Posted on
Tue Jan 16, 2018 3:58 pm
midd offline
Posts: 366
Joined: Apr 18, 2010

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

Thanks for replying Glenn. Yes that basically what I want to use it for. I've been using Home Remote but lately its been so flakey. I have a geofence set up with a mile radius for my home. With 4 phones I just want to be ale to use Jay's Advance Thermostat script with it run my schedules and to turn off when all my phones are gone and the last one is gone for more than 20 minutes.

I use a Ecobee 3 now for my thermostat. I'm checking out geofencing for it as well. But for some reason, Homekit doesn't recognize my daughter's iCloud ID as an iCloud id. It's been a reported thing as of late with Apple. I was able to add my wife last night but not my daughter.

Anyhow I'm just looking for options...

Indigo 7, Mojave on a 2009 Mac Pro..

Posted on
Tue Jan 16, 2018 11:09 pm
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

midd wrote:
Thanks for replying Glenn. Yes that basically what I want to use it for. I've been using Home Remote but lately its been so flakey. I have a geofence set up with a mile radius for my home. With 4 phones I just want to be ale to use Jay's Advance Thermostat script with it run my schedules and to turn off when all my phones are gone and the last one is gone for more than 20 minutes.

I use a Ecobee 3 now for my thermostat. I'm checking out geofencing for it as well. But for some reason, Homekit doesn't recognize my daughter's iCloud ID as an iCloud id. It's been a reported thing as of late with Apple. I was able to add my wife last night but not my daughter.

Anyhow I'm just looking for options...


Happy to add Geofence devices to ifindfriendsMini. (I’m sure make Mikes code will be once again a helpful start).
What states would be useful?
- number of friends present in geofence (as number and then can trigger indigo based on greater than/less than)
- lastArrival time
- lastLeave time

Glenn

Posted on
Wed Jan 17, 2018 2:27 am
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

FindFriendsMini a new iCloud FindmyFriends Plugin

Version 0.1.2

Have added GeoFence support to FindFriendsMini. (Once again with great help from iFindStuff)

Setup Friend devices as above.

Then go to devices and create new FindFriendsMini Geofencedevice; configure name and most important enter latitude/longitude and the range of Geolocation (currently in metres only)

These devices will then be updated with current states:
friendsinRange - number of friends within range of this GeoFence
lastArrivaltime - date/time - in format specified in plugin config
lastDeptime - date/time - in format specified in plugin config

You can have multiple overlapping,different sized geoFences without issues. e.g at house level, street level, town level etc.

Then can trigger on state change of friends becoming zero - turn off lights etc. (likely with your delay)

Todo:
Probably needs some more thinking about date/time issues as can display ArrivalTime well but harder to calculate time difference.
Might be more useful to change ArrivalTime and DepartureTime to minutesfromlastArrival & minutesfromlastDepature. Rather than a date-time? Or add these fields for trigger as number. (probably best option will look at this when can)

Happy to take suggestions

Glenn

Posted on
Wed Jan 17, 2018 3:52 am
midd offline
Posts: 366
Joined: Apr 18, 2010

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

Sounds great. Thanks! I'll give it a try when I get home from work.

Indigo 7, Mojave on a 2009 Mac Pro..

Posted on
Thu Jan 18, 2018 9:39 pm
stewkenly offline
Posts: 7
Joined: Dec 28, 2015
Location: Austin TX

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

Is there a way to set up the plugin to support two factor authentication with iCloud?

Posted on
Thu Jan 18, 2018 9:46 pm
ZachBenz offline
Posts: 92
Joined: Feb 08, 2014

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

stewkenly wrote:
Is there a way to set up the plugin to support two factor authentication with iCloud?


Unfortunately, no. 2FA isn't supported by the underlying python libraries being used. See the instructions at the top of this thread for how to deal with this - essentially you need to create a new iCloud account without 2 factor authentication, and make it friends with your other accounts that you actually care about (2FA or otherwise) so it can get their locations to share with Indigo.

Posted on
Thu Jan 18, 2018 11:03 pm
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

ZachBenz wrote:
stewkenly wrote:
Is there a way to set up the plugin to support two factor authentication with iCloud?


Unfortunately, no. 2FA isn't supported by the underlying python libraries being used. See the instructions at the top of this thread for how to deal with this - essentially you need to create a new iCloud account without 2 factor authentication, and make it friends with your other accounts that you actually care about (2FA or otherwise) so it can get their locations to share with Indigo.


Exactly. Thanks for the reply.

This means that for your icloud “account you care about” you are not sharing these details with anyone. No risk of iCloud “hacking”

It also means your family and yourself being tracked with this app can see this account in the findmyfriends app. (As a friend sharing their location). Within this Iphone app you/they can block access or sharing as they seem fit.


Glenn


Sent from my iPhone using Tapatalk

Posted on
Thu Jan 18, 2018 11:16 pm
ZachBenz offline
Posts: 92
Joined: Feb 08, 2014

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

GlennNZ wrote:
Version 0.1.2
Have added GeoFence support to FindFriendsMini. (Once again with great help from iFindStuff)

<snip>
Glenn


Works great! Just got FindFriendsMini all set up, including GeoFences. Very nifty!

Posted on
Fri Jan 19, 2018 1:15 am
GlennNZ offline
Posts: 636
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

ZachBenz wrote:
GlennNZ wrote:
Version 0.1.2
Have added GeoFence support to FindFriendsMini. (Once again with great help from iFindStuff)

<snip>
Glenn


Works great! Just got FindFriendsMini all set up, including GeoFences. Very nifty!


Great to hear! Thanks for the feedback.

New Version: 0.1.3

Add four fields to Geofences - most useful are MinutesSinceLastArrival and Departure.
Hopefully self-explanatory.
Updated at same frequency as check time (may change to minutely updating later)
Both Numbers and can trigger Indigo on less than/greater than

e.g if 0 friends within Geofence and >20 minutes since Lastdeparture - turn off lights/thermostat

Glenn

Posted on
Fri Jan 19, 2018 6:32 am
rapamatic offline
Posts: 238
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

i get this error when try to update the plugin. Any ideas what I'm doing wrong?

Code: Select all
n 19, 2018, 6:27:58 AM
   FindFriendsMini                 Checking for updates...
   FindFriendsMini Warning         A new version is available: https://github.com/Ghawken/IndigoPlugin-iFindFriendMini/releases/tag/0.1.3

Jan 19, 2018, 6:29:59 AM
   FindFriendsMini                 Checking for updates...
   FindFriendsMini Warning         A new version is available: https://github.com/Ghawken/IndigoPlugin-iFindFriendMini/releases/tag/0.1.3
   FindFriendsMini Error           "There is no item named 'Ghawken-IndigoPlugin-iFindFriendMini-5f95d4c/iFindFriends.indigoPlugin/Contents/Info.plist' in the archive"
Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/iFindFriendsMini.indigoPlugin/Contents/Server Plugin/ghpu.py", line 78, in update
    self._installRelease(update)
  File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/iFindFriendsMini.indigoPlugin/Contents/Server Plugin/ghpu.py", line 246, in _installRelease
    pInfo = self._readPluginInfoFromArchive(zipfile)
  File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/iFindFriendsMini.indigoPlugin/Contents/Server Plugin/ghpu.py", line 213, in _readPluginInfoFromArchive
    plistData = zipfile.read(plistFile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 935, in read
    return self.open(name, "r", pwd).read()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 961, in open
    zinfo = self.getinfo(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 909, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'Ghawken-IndigoPlugin-iFindFriendMini-5f95d4c/iFindFriends.indigoPlugin/Contents/Info.plist' in the archive"

Posted on
Fri Jan 19, 2018 9:56 am
stewkenly offline
Posts: 7
Joined: Dec 28, 2015
Location: Austin TX

Re: FindFriendsMini a new iCloud FindmyFriends Plugin

I have created a separate icloud account and the plugin appears to be able to log in. I say that because I get a notification from Icloud about a new login. I see a couple of errors that appear to be preventing an update.
Log.png
Log.png (52.55 KiB) Viewed 4247 times


The device "Stew's Phone" says "waiting" and doesn't update.
Device.jpg
Device.jpg (101.52 KiB) Viewed 4247 times


Thanks for the help!

Who is online

Users browsing this forum: No registered users and 0 guests