Localization with eedomus (part 1) : smartphone side
The 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.
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.
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.
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.
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
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 :
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.
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
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.
Two tasks have to be created.
Do Nothing task
It is really doing nothing, then it contains nothing apart a Stop action.
I still provide you the corresponding xml :
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 :
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.
Here is the description how this task is defined :
- Update of variable %LOCALISATION_OLD.
No modification to be done.
- Initialize variable %LOCALISATION.
No modification to be done.
- 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.
- 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.
- 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.
- 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.
- If the new location is identical to the one previously sent to eedomus controller, the task is stopped.
No modification to be done.
- If 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.
- 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.
- 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.
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)
For 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.
General parameters of Tasker have also to be checked.
In 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