Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


iOSLocator


jgab

Recommended Posts

This is a thread for iOSLocator QA that allows for tracking iPhones with the HC3. 

It is installed with

Please login or register to see this link.

 

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.

Please login or register to see this code.

  • '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

Please login or register to see this code.

if not you can use the global variables

Please login or register to see this code.

Please login or register to see this attachment.

Edited by jgab
  • Like 3
  • Thanks 4
Link to comment
Share on other sites

HI @jgab ,I would like to store in a variable also the distance to my home, can you help me with it? I'm trying.....but without success yet, I didn't' realize that moving from hc2 to 3 will be so hard.

 

UPDATE

i did it!!!! maybe in not a good way but works.

Edited by domin12
Link to comment
Share on other sites

Good morning Jan,

Getting an error in:

Please login or register to see this code.

No idea how to solve,

//Sjakie

Link to comment
Share on other sites

  • Topic Author
  • can you post the rules?

    Link to comment
    Share on other sites

    Jan I found it I made mistake with copy log

    Please login or register to see this code.

    This I did't understand 

    Please login or register to see this code.

    but should be result of error.

    Thanks

    Link to comment
    Share on other sites

  • Topic Author
  • The problem is that you can't have ' inside a string defined with '...'

    Please login or register to see this code.

    The string stops before Nee and starts again after. 

    Try another character, like the forward or backward leaning tick.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Jan it's me being lazy copied from trigger in the log.

    I changed all instances.

    Thanks!

    Is there a possibility QAUpdater send email/push/telegram if an update is available?

    //Sjakie

    Link to comment
    Share on other sites

    Good morning Jan,

    I am cleaning up and combing some QA's in the IOS locatorthere is a small problem but cant find the solution.

    I still have in my variables listed your names Allice, Ann, Tim and Bob.

    In the QA those names are replaced by my family names, so no Allice, Ann, Tim and Bob anymore in the QA.

    If I do a search on those names the system can't find them.

    I checked all my devices if I dont have by accident a second IOS locator running. If I remove those names they will come back.

    How to sort this out, what am I overlokking?

     

    In QA Updater I dont see IOS Locator listed

    Thanks in advance,

    //Sjakie

    Link to comment
    Share on other sites

    On 5/27/2022 at 9:12 AM, jgab said:

    This is a thread for iOSLocator QA that allows for tracking iPhones with the HC3. 

    Please login or register to see this attachment.

     v0.3

     

    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' 
    • UserLocVars
      User names and the global variables to store their state in 
      Ex. 'Bon:BobLoc,Ann:AnnLoc'
      will store Bob's status in global 'BobLoc', and Ann's status in global 'AnnLoc'
    • LocationsVar
      Defaults to 'iOSLocInfo'
      Is the name of the global variables 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 'USERS' need to be defined

    Ex.

    Please login or register to see this code.

    • '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.
    • 'device' is name of iDevice, matches so "iPhone" mathes 'Jan's iPhone'.
    • '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.
    • 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

    Please login or register to see this code.

    if not you can use the global variables

    Please login or register to see this code.

    Great share as always ? Thank you

    Would it be possible for you to enhance it to support Android users, getting the location from Yubii App - so they are counted as users for the home?

    of cause getting android location from Google maps could be great as well - I would like to sponsor an Android phone, if you are willing to invest the time :-)

     

    Link to comment
    Share on other sites

  • Topic Author
  • I haven't found a good api that doesn't require api keys and payment (googlemaps api, google play api, google geolocation api)

    Have you seen anything?

     

    Link to comment
    Share on other sites

    7 hours ago, jgab said:

    I haven't found a good api that doesn't require api keys and payment (googlemaps api, google play api, google geolocation api)

    Have you seen anything?

     

     unfortunately I was not aware the api was a subscription service.

    what about getting the data from Yubii app , even though its not as good as the iCloud solution  

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, just merging in the location events from devices not being tracked by the iOSLocator app would probably work - the advantage would be the allAway and someAtHome tracking.

    I'm doing some refactoring of the app so it will work better with the updater (keeping main only for user setting like ER4)

    • Thanks 1
    Link to comment
    Share on other sites

    Jan, names I sorted out. I am mnot used to look in the variables of the  QA, sorry. I changed it overthere and problem solved.

    One other thing is I modified in QA variables HomeName = Thuis it shows also in General- Variablesso fa so good but in the log of my IOS locator it show home is  set to HC3-serienumber.

    What did I forget?

    //Sjakie

    Link to comment
    Share on other sites

    On 6/3/2022 at 6:09 AM, jgab said:

    Yes, just merging in the location events from devices not being tracked by the iOSLocator app would probably work - the advantage would be the allAway and someAtHome tracking.

    I'm doing some refactoring of the app so it will work better with the updater (keeping main only for user setting like ER4)

    I so curious for you refactoring of the App :-) ?

    Link to comment
    Share on other sites

    Jan, can I change the distance?

    1.8 km is a bit far for me, it now disarm my house if I am to far or passing on the route to centrum

     

    Thanks in advance,

    //Sjakie

    Link to comment
    Share on other sites

    • 2 weeks later...

    Jan,

    In the previous set up of my HC3 location was working excellent.

    Wife has new Iphone location works good

    My iphone is resetted I checked userID, IOSID, name  IPhone was changed, in IPhone location setting is on, HC3 is on correct adress.

    In IOS LOcator, 2 users (to check I logged in on ICloud to see if name and password is still correct) and Variables filled in

    IOSLocator does not see my IPhone

    This error comes up for both users

    [19.06.2022] [10:13:42] [ERROR] [QUICKAPP1802]: Error {"type":"error","msg":"Access denied for Sjaak :{\"data\":\"\",\"status\":401,\"headers\":{\"X-Responding-Instance\":\

    Please login or register to see this code.

    Any idea what I forgot??

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • You say that "This error comes up for both users", but Arleta seems to get her position according to your log?

    The 401 error you get is identification error. Check email address and pwd again - and retype it to make sure no "invisible" characters have snuck in...

    Link to comment
    Share on other sites

    Jan, yes Arleta her position home is comming true.

    I did retyped no change

    I uploaded the QA again typeditin >>>no change

    Error for Arleta is still there and mine too.

    Must I leave the house and come back to refrech my location?

     

    Link to comment
    Share on other sites

  • Topic Author
  • It has nothing to do with your current location.

    This error

    [19.06.2022] [10:13:42] [ERROR] [QUICKAPP1802]: Error {"type":"error","msg":"Access denied for Sjaak :{\"data\":\"\",\"status\":401,\"headers\":{\"X-Responding-Instance\":\

    says that you are denied access to iCloud by ....Apple. (status 401)

    Usually that is because of wrong credentials.

     

    I admit that the error you get is strange. The 401 should have generated another type of error. and the data is an empty string too...

    It's almost like you are blocked by Apple. Can you log in again to iCloud and see that it works?

    Maybe you have hit them too many times with bad credentials in the past so they have blocked your IP?

     

    In the code there is a line

    Please login or register to see this code.

    change it to another number by modifying the last digit and see if it changes anything

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...