This is a thread for iOSLocator QA that allows for tracking iPhones with the HC3.
It is installed with QAUpdater
The QA has been floating around in various threads in the past and this gives a home for discussions and new versions.
QuickAppVariables
HomeVar
Defaults to 'iOSHome' and is the name of the global variable where home status is stored.
Possible values: 'all_home', 'all_away', 'some_home', 'unknown'
status
Where all location info for users are stored
HomeName
Defaults to 'Home'
Name of the place home. To avoid that home is logged as the HC3 name...
AwayName
Defaults to 'Away'
Name of the place away from a location
The QA uses the defined locations, defined in the general/location panel
Inside the QA a table 'ACCOUNTS' need to be defined
Ex.
ACCOUNTS = { -- Fill in with iOS credentials
{
icloud={user="XXXX1", pwd=".."}, -- iCloud account, user is icloud email account. pwd is icloud account password
devices = {
{
deviceName='iPhone', -- Is used to match against deviceName from icloud to find right phone
deviceType='XS', -- Used to match against the deviceType of from icloud. Defaults to '.*' that match everything
name='Bob', -- Name of user for this device
id=2, -- HC3 user id. If not an HC3 user, assign your own id not conflicting with existing HC3 ids. Leave empty to auto assign an id.
home=true, -- true if user is considered as part of the people living at home.
QA="Bob's iPhone", -- If set will generate a QA child device (binarySensor) representing the user
global="iOS_BOB" -- If set will update fibaro global variable will state of user
},
{ -- This is another user sharing the same icloud account but another device (ex. a child)
deviceName='iPhone', -- It can also be used to track multiple devices for the same account. Note that they need different names. Ex. Bob_iPhone, Bob_watch
deviceType='iPhone 6S',
name='Tim',
home=true,
QA=true, -- Will use name (Tim) as name of QA
global=true -- Will use "iOS_"..name as name of global variable
},
}
},
{
icloud={user="XXXX2", pwd=".."}, -- iCloud account
devices = {
{deviceName='iPhone', name='Ann', id=3, home=true}, -- No QA
}
},
{
icloud={user="XXXX3", pwd=".."}, -- iCloud account
devices = {
{
name='Max', home=false, -- Family member not living at home (not counted in "all at home")
deviceName='Apple Watch',
deviceType='Apple Watch Series 6 %(GPS%)', -- Apple watch of specific model
},
}
},
}
'name' is username - should be without spaces and strange characters (used in global variable name)
'home' is true if user is part of people that live at home - used to decide if all at home etc.
'deviceName' is name of iDevice, matches so "iPhone" matches 'Jan's iPhone'.
'deviceType' is name of iDevice type. Also matches.
'id' is the HC3 user id. If the user is not an HC3 user the id is not needed. This allows the QA to track non-HC3 users too.
QA if not nil creates a child device for the user with the status if the user is home or not
global if not nil will create a global variables with the user's current place
icloud.user is icloud username
icloud.pwd = is icloud password
Besides setting the global variables - that works for any user, not only HC3 users. If the 'id' field is set to a HC3 userID a GeofenceEvent will be emitted when user enter and leave locations, similar to the builtin geolocation function.
If you use ER4 you can use rules to trigger on geo events.
If id is set you can capture it with a rule like
rule("#location{id=2,property=219,value='enter'} => log('User 2 entered home')")
if not you can use the global variables
rule("$BobLoc == 'Home' => log('Bob came home')")
rule("$iOSHome == 'all_away' => log('All away')")
iOSLocator.fqa