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!



Smart Home Forum by FIBARO Team

Location Tracker 1.0

   (2 reviews)

2 Screenshots

About This File

Many users are trying to use GPS feature, but the functionality and use of HC2 location data are very confusing and most of the time don't work correctly.

The major advance of this scene that there is no use of HC2 defined locations and localization.

The scene triggered by location change, which received by HC2 and tracks users' presence according to predefined places. The scene sends notification (and could announce on user location in case TTS system has been defined and set) in three conditions:

  1. User arrived to one of the predefined places.
  2. User approaching to one of the predefined places.
  3. User leaves one of the predefined places.

You can define as many favorite places as you need. For example: Shopping Mall, School and etc. to track your family members. It helps to know if your kids are actually at school, and your wife at work and not at shopping mall.

Please note that in most of the time there is a gap of few minutes between user's actually location (physical) to location received by the system. Unfortunately in some cases no update received at all. I'm using this scene for few years and still don't have full understanding how the GPS mechanism works... when, how and why the location is updated by Fibaro mobile application and I believe  if the application closed on your mobile, no updates sent at all.

Based on above facts, I do not suggest to execute any actions based on user location (like to open gate, lights), but I do suggest to turn on heating system (gap of few minutes better than nothing, or you already at home and your system anyway is ON)

--=========================== USER CONFIGURABLE PARAMETERS ===============================
eMailId   = {2}   -- user IDs to send email. To include more users use: eMailId={2,5,20}
eMail     = true  -- if true, email will send
popupNote = true  -- if true, popup notification will send to all users.
pushNote  = true  -- if true, interactive push notification will send to users, which can receive Push notifications as defined at "Access Control" panel at "Mobile devices list" section.
_TTS      = false -- text to speech message. Please before setting to true, make sure to update locationTts() function with your TTS setup.  Default code in function based on Text to Speech - Android phone/Tablet scene and could be downloaded from https://forum.fibaro.com/files/file/180-text-to-speech-android-phonetablet/
--list of users ID and names (the reason to include names, is because the name could be email address in the system). Set scene %%properties accordingly to IDs in list. Please update according to your system
GPSuser = {{2,"Alex"},{190, "Tammy"},{457,"Leon"}}              
--list of points of interest to follow users' arrival, approaching or leave. Please update/add according to your favorite locations. Make sure that place coordinates are few times more accurate than locAcc variable below.
GPSplace = {{"Home","62.1747177;64.8820022"},{"Work","62.244312;64.842668"}}
ignoreGps = 1     -- Amount of hours to consider the location is too old and ignored. Default to ignore over one hour old user location.
locAcc = 300      -- Defined GPSplace area in meters, to assume presence in place.

           distGap=150       -- Distance between current and previous locations to avoid messages in case same location received several times.


By executing the scene manually, table with users' last location and their distance from predefined places will be displayed.

  • Please use this feature to verify that the users' location data is receiving and updating by HC2.  hasGPS column shows if user has GPS (means if location has been ever sent from this user) and how frequently GPS position is collected.



When the scene is triggered, follow information on debug window displayed:

User name, his previous and current location and timestamps. Current distance of the user from all predefined places




I hope it will do the job for you.

What's New in Version 1.0   See changelog


Bug fix

Manually executed scene shows error below

 [DEBUG] 01:30:19: 2019-01-31 01:30:19.852868 [  fatal] Unknown exception: /opt/fibaro/FibaroSceneAPI.lua:116: attempt to concatenate local 'deviceId' (a nil value)

User Feedback

Recommended Comments

Guest cag014

Posted (edited)

I would like to recommend this script as a template, please feel free to modify the code according to your needs.

Edited by cag014
Link to comment
Share on other sites


i like you scene.

there is only one thing i would like to update.


instead of using a "fix" value for the GPSplace = { ..

i am trying to import the locations of my localisation in .

So it is easy to create, localisation with the GUI.


what i have so far to read the locations stored in  the homecenter and to recreate you GPSplace variable:

--========================== Dr-Know new part read locations from home center ===================================================
local Locname = ""
local GPSplace = "{"
local count = 0
local Dorun = 1
response = api.get("/panels/location")
for _,v in ipairs(response) do count = count + 1 end
fibaro:debug("Found: " .. count .. " locations");
for _,v in ipairs(response) do
local Locname = "{\"" .. v.name .. "\",";
local LocLat = v.latitude;
local LocLon = v.longitude;
local LocFull = "\"" .. v.latitude .. ";" .. v.longitude .. "\"";
if (Dorun == count) then
    GPSplace = GPSplace .. Locname .. LocFull .. "}";
    fibaro:debug("Last location")
    GPSplace = GPSplace .. Locname .. LocFull .. "},";
    fibaro:debug("Location: " .. Dorun);
    Dorun = Dorun + 1
GPSplace = GPSplace .. "}";




The script will read all the location in the home-center and recreate the same syntax off the original variable GPSplace.

But the code will not work .. any ideas ?




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.

Add a comment...

×   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...