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
Question
Tony270570 92
The objective of this functionality is to determine that your are at home based on your phone connexion to your wifi network and use that information on your Home Center for example to switch off your alarm automatically when you are in and switch it On when you are out...
Most of phones are impossible to be easily found as soon as they are on sleeping mode; therefore a simple ping won’t work.
I’ve done this workaround with the help of a raspberry and fing which is a free powerful network tool that can be run on most of platforms.
The plus of this solution is that it's working on HC lite because there is no LUA or virtual device necessary, works with iPhones with recent IOS version even when wifi looks to be off when device is sleeping and no extra application to be installed, tasker on android is not needed for this purpose , and it's complient with all phones that i had the chance to test: iPhones, Androids, windows phone; it's absolutly transparent, no need to wake up your device, just do nothing
Please login or register to see this image.
/emoticons/default_icon_wink.gif" alt=";-)" /> .. !prerequisite: You must have a server running permanently ( a raspberry or a nas server ...)
Step 1
In the HC create a variable in this example “Presence”with two values “Present” and “Absent”.
If you decide to change the name don’t forget to amend the file named "test_presence.sh" that we are going to talk about on step 7.
Step 2
Install Fing in your server, the command will differ depending on your unix distribution.
In my case a debian on my RPI I used the following:
Please login or register to see this code.
Test that is ok and try:
Sudo Fing
If all is all right you can jump to step 4 else go to next step.
Step 3
If fing don’t execute it’s probably because some libraries are missing or obsolete in this case try the following command:
Please login or register to see this code.
Step 4
In /etc edit the file rc.local add the following command and save :
Please login or register to see this code.
If necessary adapt the network mask in my case 192.168.1.0 is the first IP address fing will start scanning (it will scan your entire network starting by this IP)
Step 5
In /var/www create a new directory called “ping” in order to have this result:
Please login or register to see this code.
Step 6
In /home create a new directory and name it as you want (in my case tony) we will use it on step 7 & 8
Step 7
Create a file "test_presence.sh" and copy the code find below. IPDUSERVEUR must be set with your phone address.
Change user/mot with your HC user/pass and IP with your HC ip address.
Copy that file on the directory that you have created in step 6
Step 8
Create a file « exec_presence »and copy the code find below, change the directory name with the name craeated in step 6 :
/home/XXXXX (/home/tony in my case)
Copy the script « exec_presence » into /etc/init.d. Make sure grants are ok on that file:
Please login or register to see this code.
and execute following command (might change depending on your unix) :
Please login or register to see this code.
(it will allow the scipt to be automatically execute at after the boot)
On your browser try 192.168.X.X/ping/lan.html (where 192.168.X.X is the ip of your server where ping is running). You should see a page with all your network connections.
Check the variable on your HC is correctly reflecting your presence.
For the very first run (only after the server boot) your phone should be in wake up mode to be correctly identified, after it becomes transparent. You can disconnect/reconnect your phone from your network, put it on sleeping mode and check all is all right.
creat a file named "exec_presence" and copy following code:
Please login or register to see this code.
creat a file named "test_presence.sh" and copy following code:
In this loop the sleep is set to 10 it's ok for test purpose but you could be set to 30 for normal run.
Please login or register to see this code.
Have fun.
Link to comment
Share on other sites
Top Posters For This Question
13
5
3
3
Popular Days
Feb 1
6
Jan 30
6
Jan 31
4
Dec 3
4
Top Posters For This Question
HansS 13 posts
lukaszpiech 5 posts
Tony270570 3 posts
Nine 3 posts
Popular Days
Feb 1 2015
6 posts
Jan 30 2015
6 posts
Jan 31 2015
4 posts
Dec 3 2014
4 posts
Popular Posts
HansS
Here's the getthedata code. This is actually copied from someone else's code, probably the code for getting stats from Fibaro and creating Highstock charts from them. Anyway: 83999426b4bbb1076e8dda
49 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.