presence detector in house using smartphone

6 years 2 months ago #2183 by rajbadri
is it possible to get a tutorial for presence detection from a persons smartphone ip address or mac address. we can use it to trigger other automation scripts.
The following user(s) said Thank You: osalval

Please Log in or Create an account to join the conversation.

6 years 2 months ago - 6 years 2 months ago #2189 by NightOne
Very good idea..... I read your post yesterday and tried to get it to work with EasyIOT.... I am a total newbie at coding so please forgive the code ;)

I have set up as a cron job to run every couple of minutes to ping my phone when my Alarm value is Off.... I suppose I can get it to run all the time and set the Alarm on and off whenever the phone is pingable but I want to to able to set the Alarm to ON at night and the phone will also be pingable so I dont want it to automatically turn the alarm off just beacuse the phone is pingable.

UPDATE: I noticed that sometimes I get false possitives when I am walking around the house cause I have a wifi extender and when my phone hopes to the extender and a ping happens at the same time then I get a false possitive... So I have added a loop to the ping so that it pings 3 times with a 3 second interval between pings to make the system more resilent to movement. I have also added an update where it also sends a notification to my phone that the alarm has been activated.

Here is the second try at the code:

public void Setup()

public void Run()
Console.WriteLine("Ping Test Program was Started");
ModuleParameter p = ModuleHelper.GetProperty(Domains.VIRTUAL, "N18S0", "Sensor.DigitalValue");

if (p.Value == "0")
int pingAttempts = 0;
int maxPingAttempts = 3;

System.Net.NetworkInformation.Ping PingSender = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply pingReply;
Console.WriteLine("Ping Test Program is Running");

// Loop until the first successful call or 3 failed attempts
pingReply = PingSender.Send("");
System.Threading.Thread.Sleep(3 * 1000);
Console.WriteLine("Ping Attempt Number: " + pingAttempts);

while ((pingReply.Status != System.Net.NetworkInformation.IPStatus.Success) && (pingAttempts < maxPingAttempts));

// pingReply is either the first successful one, or the last of
// the loop (all of which would have been false)

if (pingReply.Status != System.Net.NetworkInformation.IPStatus.Success)

DriverHelper.ProcessCommad(Domains.VIRTUAL, "N18S0", "ControlOn", "");
Console.WriteLine("The Alarm has been turned ON");

System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection();
System.Net.WebClient client = new System.Net.WebClient();
values["AuthorizationToken"] = "a super secret token that you need to get for yourself";
values["Body"] = "Automation has turned the Alarm ON";
client.UploadValues("",values );
The following user(s) said Thank You: rajbadri

Please Log in or Create an account to join the conversation.

6 years 2 months ago #2203 by aldobm
HELLO if using IFTTT have detect the presense with GPS COORDS, IFTTT HAVE google maps integration, if the cel in range trigger the accion to easyiot.

Code in Maker recipient:

The following user(s) said Thank You: osalval

Please Log in or Create an account to join the conversation.

Time to create page: 0.248 seconds

Forum latest

  • No posts to display.