Localization with eedomus (part 1) : smartphone side

 

Introduction

Localization_widget_eedomusThe eedomus smarthome controller includes an unusual feature which is location tracking. This feature could seem to be an anecdotic one for smart hone. But linked to special rules able to trigger actions regarding this location, it adds multiple automation possibilities.

This first part will focus on smartphone side, how to update location on eedomus transparently.

A second post will describe a scenario using location. The example will speak by itself.

References

I have surfed on internet, into blog to find some information. I have found.

Firstly eedomus online documentation is quite good, this is a good entry point.

Two apps are presented by this one : OpenGPS for Iphone, and Sésame for Android. I have not tested those applications.

A new free app is also available on google play store : eebud. It is promising but in alpha stage, and does’nt match perfectly my needs. You can have some information about this one on french eedomus forum.

Also a french post done by Antor have helped a lot : Désactivation de l’alarme avec Tasker. His solution is also based on the use of Tasker for Android. But he doesn’t use location capability of eedomus by itself.

The goal

On the smartphone side, the goal is to have a completely transparent solution for the user which updates location regularly on eedomus.

I have the following requirements :

  • working when mobile is active or inactive
  • indistinguishable power consumption : for the function described here, you should have less than 4% of the power used by tasker
  • a flexible solution: if my needs are evolving ( location more precise, location at certain moment or certain locations, …) I can update it
  • I don’t need a very precise location : location update done by using cellular network antennas, without using internal GPS, is sufficient. This provides around 100m of precision most of time, with some important gaps sometime (>400m)

    However if my navigation app is in use, and so the GPS, why not using precise coordinates, also speed, by using embedded GPS.

  • certain geographical location have to be detected quickly (home, work)
  • not to send location update if location have not changed to limit traffic and consumption
  • specific management when my smartphone is connected to my personal wifi : update has to be done locally on eedomus controller, and precise location of my house have to be sent.

Eedomus configuration

Before all a GPS tracker peripheral have to be available on controller to be updated. It can be done from configuration panel :

Use Add device button

Select Another type of device

At the bottom select

GPS tracker type

loceedomus1_eedomusadddevice

loceedomus1_eedomusaddother loceedomus1_eedomusaddtracker

When peripheral is created, you have to note down the API code of it. It will be used to update it :

loceedomus1_eedomusapicode

Android configuration

The Tasker for Android application will be configured and used on smartphone side. This app can automatize multiple tasks on it and communicate on network.

Particular smartphone, like my Sony, have consumption optimization features (Stamina mode). Tasker is to be permitted to wake up the device if this mode is activated (which I advise). On Sony devices it can be configure in Power configuration panel :

  • select stamina option (without selecting blue ON/OFF slider)

    loceedomus1_stamina1

  • Add tasker in the exception list

    loceedomus1_stamina2

It is also advisable to keep wifi constantly active, wifi access point that are detected are also used to define location of the mobile when not using GPS chip.

Programming tasker

Proposed configuration import

I provide different configuration in the form of xml files. You can directly import those in your mobile :

  • unzip the files provided below
  • copy xml file on your mobile, if possible in /sdcard/Tasker/tasks/ directory
  • import the task with a long press on task tab

    loceedomus1_taskerimport

Tasker Vars

loceedomus1_taskervars

This chapter is only informative : those  vars will be automatically created by tasks.

Two global vars will be used : %LOCALISATION containing last location value sent to eedomus and %LOCALISATION_OLD containing previous value. By comparing both the task knows if an update have to be done or not on the smarthome controller.

loceedomus1_taskertasks

Tasker Tasks

Two tasks have to be created.

Do Nothing task

It is really doing nothing, then it contains nothing apart a Stop action.

loceedomus1_taskertasknothingI still provide you the corresponding xml :

XML for Do nothing task

Eedomus Localization task

This task is triggered regularly by several profiles to update location on eedomus controller. Here is the configuration xml file to create this task :

XML for Eedomus localization task

However I have modified this file to be generic. It has to be tuned to match your own configuration :

  • you can modify directly the xml file and replace all “xxx” marking with correct values.
  • you can import generic file and modify configuration afterwards.

loceedomus1_taskertasklocalisation

Here is the description how this task is defined :

  1. Update of variable %LOCALISATION_OLD.

    No modification to be done.

  2. Initialize variable %LOCALISATION.

    No modification to be done.

  3. Speed calculation in km/h ( by default %LOCSPD is in m/s). Take care that this speed value is not valuable if embedded GPS is not active.

    No modification to be done.

  4. If Waze profile is active: use of precise location given by GPS chip (%LOC) and calculated speed.

    Waze profile is detecting that my navigation app is active. This profile name have to be modified if necessary.

  5. If connected to personal wifi network : use of precise location of my house which is hard written in the script, and a 0km/h speed.

    %WIFII contains all information about the current wifi connection.

    I search the IP address into this variable (Fixed IP mandatory). This IP address have to be adapted, or replaced by the wifi network name (SSID) of your network.

    The precise location of your house have to be embedded also into the parameters at this step.

  6. If step 4 and 5 have not updated %LOCALISATION : use of location given by cellular network (%LOCN) and null speed.

    The speed is not valuable then. Location is calculated regarding near cellular emitters and wifi network. No modification to be done.

  7. If the new location is identical to the one previously sent to eedomus controller, the task is stopped.

    No modification to be done.

  8. loceedomus1_taskerhttpgetIf smartphone is connected to personal wifi, update is done directly at local eedomus IP address

    Many modifications have to be done there :

    – local IP adress of eedomus controller (Fixed IP address is mandatory).

    – condition on %WIFII (look at step (5.) ).

    – periph_ID to be configured with the one you have noted down at chapter Eedomus configuration.

    – api_user : user name of API interface that you have received.

    – api_secret : secret code of API interface you have received.

  9. If mobile is not connected to personal wifi network, update location at https://api.eedomus.com.

    Same parameters have to be changed compared to step (8.) apart from local IP address.

  10. http or https error management.

    If feedback code is not 200, then something goes wrong. The variable %LOCALISATION is put to 0 to force an update the next time.

Tasker Profiles

loceedomus1_taskerprofilsThose profiles have to be adapted to your own needs. I have 3 different types of profiles.

Profile with condition relative to an App (Waze)

This profile is detecting the use of my GPS navigation app. This profile state is used by the task described before.

The profile is checking if Waze app is active in my case. Because a task link is mandatory into a profile, the Do Nothing task is linked.

Repetition profile (From ..)

This type of profile is activated regularly every x minutes. I have two ones :

  • the first have also a condition on GPS navigation app in use.

    The profile is activated every 2 minutes everytime and trigger the eedomus localization task.

  • the second one have no condition. It is activated every 30 minutes from 6AM to 10PM and trigger also the eedomus localization task

Geographic profiles (Home, Work)

loceedomus1_profilelocationFor each Tasker wakeup, it checks the location. If we enter (or go outside) a defined geographical location the corresponding tasks are immediately triggered. I configure for both case the same behaviour : update location on eedomus. Those profiles enable to update very quickly the location for certain areas.

Geographical zone configuration in Tasker is simple because graphically displayed. Current location can also be used by using the target icon in the top menu bar.

The location detection method is configured at the bottom of the screen : GPS or cellular network. Cellular network mode is less precise but using very small power, this is the one I select. The geographical radius used for detection have to be sufficiently important to match location error of this mode, but also inactivity period of tasker. In my case Tasker is active every 2 minutes, which means a movement of 1km for 30km/h speed. A radius of 500 m is really a minimum value if setting a passage area.

Tasker Configuration

General parameters of  Tasker have also to be checked.

loceedomus1_taskerconf1

loceedomus1_taskerconf2In particular, the different wake-up times have to be updated if necessary. The different rules configured by tasker will be checked regularly following those parameters, smartphone being active or inactive. If the delay is too short, battery autonomy may suffer. If too long, Tasker will take a long time to react.

I propose to take a maximum reaction time of 2 minutes (mean is 1 minute then), having mobile ON or OFF. This is the configuration you can see on the right. Major parameters are :

  • Display On Monitoring parameters

    Default value are mostly correct for this way of use.

    • Wifi Scan Seconds : time to check wifi status
    • GPS Check Seconds : time delay between each embedded GPS check
    • Network Location Check Seconds : time delay between each cellular network location check
  • Display Off Monitoring parameters

    Default value are not correct, they have to be changed.

    • All Check seconds : time delay between each mobile wake-up generated by tasker to check all the rules. In this case this is the minimum time also between two location updates.
    • Timeout Seconds : Maximum time during which mobile is kept active to do all the checks. I have reduced the time to reduce the consumption.
  • General Monitoring parameters
    • Wifi Minimum Timeout Seconds : Minimum time used to verify wifi status. The more important this time is, the more wifi hotspots will be detected. I have also reduced this value to reduce consumption.

 


 Update 2014-06-16 : correction of link to Tasker Localization XML

Vincent Recipon

Propriétaire de ce blog. Owner of this blog.

You may also like...

12 Responses

  1. Aurel says:

    Pareil pour moi, impossible de les importer, les fichiers sont encore valables ?

    Car tasker veut un fichier *.prf.xml

  2. Orel says:

    Bonjour,

    Venant de basculer d’iphone à Galaxy S6, j’ai suivi votre tuto, débutant sur tasker et n’étant pas encore sortit de chez moi, je ne sais pas encore si cela fonctionne.. je vous tiendrai au courant.

    Par contre, je pense que votre solution a beaucoup évoluée, pourriez vous partager vos nouveautés ? J’ai surtout dans l’idée d’économiser au maximum la batterie du téléphone sans pour autant négliger la precision lorsque j’arrive à mon domicile pour l’execution de regles.

    Merci par avance

  3. Concernant l’usage de la batterie ci-joint la réponse que j’ai mise sur le forum eedomus: http://forum.eedomus.com/viewtopic.php?f=13&t=1771&p=17819#p17819

  4. J’ai essayé eebud mais ça ne fonctionnait pas sur mon téléphone.
    J’ai essayé les script sur la version démo de Tasker mais il trouvait des erreurs dans les scripts.
    Du coup j’ai fait ma propre application Android pour envoyer la position GPS au traceur GPS de la box eedomus: eedomus locator
    https://play.google.com/store/apps/details?id=com.guyo.test1

    • Merci pour l’appli, je vais essayer cela de ce pas. Quel est l’impact de l’application sur l’autonomie du téléphone ? Utilises-tu le gps pour la localisation ?
      De mon côté mes scripts Tasker ont beaucoup évolués, il serait franchement temps que je remette à jour mon post 🙁

  5. Merci de votre réponse , les fichiers sont bien dezippé, je navigue sans problème dans arborescence de mon smartphone mais les fichiers n’apparaissent pas la ou je les place, je vois bien le dossier que j’ai ajouté mais il est vide,j’ai essayé plusieurs emplacement sans succés. pour infos tasker est installé sous android 2.3

    • Mea Culpa, le nom du fichier doit se terminer par “.tsk.xml”. J’avais enlevé le “.tsk” par erreur. Je refais une petite archive .zip avec le fichier nommé correctement. Le fichier doit donc s’appeler “localisationeedomus.tsk.xml”

  6. Bonjour,merci pour ce tuto il m’est impossible d’importer les fichiers xml dans tasker il ne voit rien dans le dossier en question même si je les change de place.
    d’avance merci pour votre réponse

    • Étonnant que le fichier ne soit pas vu, le filtre sur tasker est simplement sur l’extension du fichier. Le fichier XML a bien été dezippé dans un répertoire sur la carte SD ? Il vaut mieux également essayer de faire l’import dans tasker avec smartphone déconnecté du PC (pas de pb de carte SD non montée). Sinon essayer peut être de le mettre dans un répertoire mieux connu de la carte SD pour être sûr d’être au bon endroit, style répertoire DCIM. Es-tu capable de naviguer dans l’arborescence du smartphone avec Tasker ?

  7. ma pomme / pikat says:

    Très intéressant merci ….

  1. Wednesday June 25th, 2014

    […] avons vu dans le premier article comment remonter sa position géographique à la box eedomus depuis un téléphone android. Nous […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.