Goal: Use detection of Android phones on local network to activate/deactivate IP Camera Security System.
Ideally, I want to create it so that this only triggers when BOTH mine and my wife's cell phone are no longer connected to the home access point, and another action trigger to deactivate the cameras when at least 1 is connected.
First issue: Detection.
If possible, I want the PC to do be able to do this somehow, by polling for the hostname or ip address of both phones periodically, and when found, alert Eventghost - still have not found a way to do this easily.
Another way to do this is to have the phones themselves tell the eventghost they are "home" by using Tasker with the Eventghost plugin. Unfortunately, this will require more administration on both phones.
Anybody else have suggestions on multiple user presense via Android to --> Eventghost?
Second issue: Flagging.
In other automation programs, I would use flagging to require multiple triggers to be TRUE before an action would execute.
I need a way to tell Eventghost to only start an action when BOTH phones are NOT present, and to deactivate cameras if at least ONE phone IS present. Is there a way to pull this off with enable/disabling folders in Eventhost?
Once I can get these 2 issues sorted out, I can use EG to send cmds to my IP Camera Software to turn on/off inside cameras. No point in recording inside when people are home as it wastes network, power, and drive space resources =)
Maybe there are other ways to pull this off without Eventghost, but I've become fond of the silly ghost and use it for so many other things in my automation addiction.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Phone Detection and Flagging for home automation
Phone Detection and Flagging for home automation
/Another1Addicted2Automation
Re: Phone Detection and Flagging for home automation
1. I would use the ping plugin if you will have your phones always connected to the network. Otherwise BT or something could be used.
2. This just requires some scripting.
2. This just requires some scripting.
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544" Guid="{25A9A0C5-0D7E-4D93-B04B-1D4C52118B30}" Time="1362099865.79">
<Autostart Name="Autostart" Expanded="True">
<Plugin Identifier="PingPlugin" Guid="{E0E0AFD7-31D5-41FE-B9DA-237234DB07A7}" File="Ping">
gAIpLg==
</Plugin>
</Autostart>
<Folder Name="phone detect" Expanded="True">
<Macro Name="Ping: Add Hosts: Phones 1 and 2 and initialize vars" Expanded="True">
<Event Name="Main.OnInit" />
<Action>
PingPlugin.AddHost(u'192.168.1.151', u'Phone1', 200, 60, u'Phone1Present', u'Phone1Away', 1, 1)
</Action>
<Action>
PingPlugin.AddHost(u'192.168.1.152', u'Phone2', 200, 60, u'Phone2Present', u'Phone2Away', 1, 1)
</Action>
<Action>
EventGhost.PythonScript(u'eg.globals.Phone1Status = "Away"\neg.globals.Phone2Status = "Away"')
</Action>
</Macro>
<Macro Name="Python Script" Expanded="True">
<Event Name="Main.Phone1Present" />
<Event Name="Main.Phone2Present" />
<Event Name="Main.Phone1Away" />
<Event Name="Main.Phone2Away" />
<Action>
EventGhost.PythonScript(u'x = eg.event.suffix[5:]\nprint x\n\nif x == "1Away":\n eg.globals.Phone1Status = "Away"\nelif x == "2Away":\n eg.globals.Phone2Status = "Away"\nelif x == "1Present":\n eg.globals.Phone1Status = "Present"\nelif x == "2Present":\n eg.globals.Phone1Status = "Present"\n \n \nif eg.globals.Phone1Status == "Away":\n if eg.globals.Phone2Status == "Away":\n eg.TriggerEvent("TurnOnCameras")\n else:\n eg.TriggerEvent("TurnOffCameras")\nelse:\n eg.TriggerEvent("TurnOffCameras")')
</Action>
</Macro>
<Macro Name="Ping: Get Hosts Status" Expanded="True">
<Action>
PingPlugin.RemoveHost(u'192.168.1.151')
</Action>
<Action>
PingPlugin.RemoveHost(u'192.168.1.152')
</Action>
</Macro>
</Folder>
</EventGhost>
- Attachments
-
- ping tested.xml
- (2.15 KiB) Downloaded 229 times
Re: Phone Detection and Flagging for home automation
Yes, the detection is the hard part.
Here is how I have done it :
my AP is an Airport Extreme, and it has a nice feature for this purpose : It can output detailled logs of what it is currently doing via Syslog.
Windows doesn't support syslog, but the syslog protocol is really simple : it's jus a plain text broadcast using udp.
So I have written a simple UDP Listenenr in C# that receives all the airport log messages.
When I get a log messages concerning Association/Disassociation, they also contain the mac address of the client.
Using this ionformation, I can forward an event to EG Telling if the phone X has just connected or disconnected.
Previously, I was using the ping plugin. But it has some problems, I don't remember excatly what they were.
So I rewrote it to C#. I am still using it for monitoring various connected devices.
I have also tried with bt. Can't remember were I got some code to do that, but it wasn't really reliable.
Finally, I use Sosumi to locate my wife's iPhone via iCloud.
Here is how I have done it :
my AP is an Airport Extreme, and it has a nice feature for this purpose : It can output detailled logs of what it is currently doing via Syslog.
Windows doesn't support syslog, but the syslog protocol is really simple : it's jus a plain text broadcast using udp.
So I have written a simple UDP Listenenr in C# that receives all the airport log messages.
When I get a log messages concerning Association/Disassociation, they also contain the mac address of the client.
Using this ionformation, I can forward an event to EG Telling if the phone X has just connected or disconnected.
Previously, I was using the ping plugin. But it has some problems, I don't remember excatly what they were.
So I rewrote it to C#. I am still using it for monitoring various connected devices.
I have also tried with bt. Can't remember were I got some code to do that, but it wasn't really reliable.
Finally, I use Sosumi to locate my wife's iPhone via iCloud.
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
Re: Phone Detection and Flagging for home automation
Would you like to share that syslog program?
Re: Phone Detection and Flagging for home automation
...you could use tasker on android with some eventghost plugin, then you can tell tasker "if I'm connected to ssid xyz, send an event to eventghost" 
Re: Phone Detection and Flagging for home automation
viewtopic.php?f=2&t=5955 has some more examples.
-
m19brandon
- Experienced User
- Posts: 177
- Joined: Mon Feb 03, 2014 10:36 pm
Re: Phone Detection and Flagging for home automation
I do something similar with ping plugin and a timer that pings all my IP devices and a py script that tracks everything. I like the stereo or TV to be playing when I get home from work, so when my iPhone joins the network after more than 2 hours and between a set time then EG turns stereo in the living room. It works great.
