EG and Location Awareness

Tutorials & Guides
Post Reply
User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 1:55 am

This is a tutorial on how to have your phone send Events to EventGhost. This is for Android Devices.


This is going to be quite a few parts due to the limitation of only being able to attach 3 photos. So if one of the forum moderators would care to combine them that would be great.


K
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 1:58 am

Part 1:


there are 2 different sets of plugins. plugins that have been made on the eventghost side, and plugins that have been made on the EGIGeoZone side. EGIGeoZone uses plugins also. so from this point out i will call the plugin that is made for EGIGeoZone EGIPlug to cut down one the cross lingo confusion.


EventGhost Setup:

Add TCPEvents Plugin.jpg
Add TCPEvents Plugin2.jpg


We need to install the TCPEvents Plugin as you can see by the photos above for instruction

Setup TCPEvents Plugin.jpg

A: The port in which we want to have EGI connect to. set this to whatever you like but make note of it. I am going to use 55555 for this tutorial. Remember to allow incoming and outgoing connections to this port in windows firewall. I have not included instructions on how to do this they can be looked up on the internet

B: The password is going to be needed at both ends of the connection for security purposes i am going to use passw0rd for this tutorial.

C: The event prefix field we are not going to use because the event prefix is generated by the EGI program but this is if you have other programs connect to EG using this same port. and if those other programs don't generate their own prefix
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:00 am

Setup TCPEvents Plugin2.jpg
Above is what the setup should look like.


And that concludes the EG setup, pretty easy huh??..



Router Setup:

Obtain Public IP:
Whats My IP.jpg
The above is a simple way to get your "public" or "wan" IP address. Simply do a Google search for "what's my ip". Write down this number.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:02 am

Obtain MAC Address:
CLI Ipconfig Command.jpg
CLI Ipconfig Results.jpg


You need to open a Command Prompt Window(CLI). I am not going to tell you how to do this because if you don't know then all of this is going to be way over your head. And you need to take some classes on computers.
The first image is the command you need to enter. The second is the data we are looking for. So write that data down. we need this because we have to make your local IP static (local: the private side of your router, your home computers). The reason why is we have to make a pointer from your public IP address to your local IP address of the computer running EG. If it is dynamic and your IP address changes on the computer running EG the pointer is lost or points to the wrong device/computer. This can be achieved one of 2 ways. You can make some setting changes on your computer or on the router. I prefer the router for more of a centralized management and it also requires less work and explanation. So for purposes of this tutorial we are going to use my preferred method.

Router Setup Page.jpg
This is the setup page for my router. now all routers differ and you may have to dig about to find the proper menus. But this will give the basic principal of how to set your router up. Every Setup is different and you will have to read your router manual to find out how to access this page.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:06 am

Note on Dynamic DNS:
Dynamic DNS.jpg

I want to make special note of Dynamic DNS(DDNS). A lot of newer routers do have provisions to utilize this. The purpose of DDNS is this. every computer on the internet is given a unique number called an IP address. This number is not user friendly and often can "Dynamically" change. for this reason we use a DDNS provider so that we have a non changing means of locating a resource on the internet. It also provides a nice user friendly name. Your IP address is pointed to this name so if you want to connect to your home you would enter the friendly name. if your router supports DDNS it will automatically refresh or update the pointer if your ip address changes. This does happen quite often for some internet provider and others not as much. But it does happen and having to go to each and every device to change the number you entered is just crazy. so this makes it all happen automatically. You will have to read up on how to do this for your router and for the DDNS provider you would like to use.

Dynamically Assigned Static IP:
Static IP DHCP.jpg

This is the Dynamic Host Configuration Protocol(DHCP) setup page on my router. This is where your router issues those IP addresses to your devices/computers. what we are interested in is either going to be called Static Assignment or something like what my red arrow is pointing at.
We Want to make note of the Start Range and Stop Range. we want to number we are going to set fall inside that range.

Static IP.jpg

This is the page to make that IP address a dynamically assigned static IP address. Meaning that it is still handed to your computer but the number will never change there for making it static if you will but the right term here is never changing.

A: the IP address we want to EG computer to have. remember we want it to fall inside of that range as mentioned above.

B: the MAC address of the computer that is running EG. We got that number from the CLI window with the ipconfig command. This number in the CLI windows is separated my a - some routers you have to enter a : some the - and some a space and some nothing at all just push all the numbers together. (numbers: this is a hex decimal representation of a number, because the number is so long it would be crazy to have to key the whole thing out. put it to you this way. there are 281,474,976,710,656 different possible MAC address combinations, and an IP address has 4,294,967,296 combinations, and we have done run out of public IP addresses. so the new IPV6 has 340,282,366,920,938,000,000,000,000,000,000,000,000 possible combinations and also uses the hex pairings like the MAC address. but this is a whole nothing conversation.

C: Some name you would like to give to this assignment

D: Enable It

E: Add it

and remember to save
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:08 am

Static IP Entered Info.jpg

what it should look like when complete
Static IP Finished.jpg

after it is added and saved
and that completes the making a dynamically assigned static ip section


Port Forwarding:
Port Forward.jpg

This is the page for port forwarding setup. the router stands between your computer and the internet. so we have to make a pointer to tell the traffic where to go. because a router takes many private or local addresses and turns them into one public. So if we want to make a specific dedicated connection request coming in from the internet we have to tell it where to go. and this is what does that. On my router i have to create a new service or rule if you will. this just tell us the port we want to forward and what protocol to use (UDP or TCP) and to give this rule a friendly name.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:10 am

Port Forward Entry.jpg
A: Friendly name we want the rule to have

B: The protocol. We need to have TCP selected

C: this will either be a range or a single port. If it's a range enter the same number that you put in the TCPEvents setup in both fields. The single I think you can figure out.

D: Add it to the list
Port Forward Setup.jpg
What the rule should look like
Port Forward Items.jpg
A: Did that above

B: Where we select the rule

C: The IP address we set in the DHCP section of the router

D: Enable

E: Add it
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:12 am

Port Forward Selected.jpg
End results. Now add it and save

and that completes the Port Forwarding


The Router Setup is complete


EGI GeoZone:

Open the play store and search for EGI GeoZone
Download and install the App as well as the EventGhost plugin. The plugin is an addon that will allow EGI to communicate with EG
Once done installing open the EG plugin.

EGI EG Plugin Setup:
EGI EG Setup.jpg
A: The public IP address obtained from the first step. Or the DDNS name if you have one set up.

B: The port specified in TCPEvents setup

C: The password from the TCPEvents setup

D: Device name, this is useful if you want more then one device communication with EG. More explanation of this further down

E: How long EGI will attempt to communicate with EG for.

F: huh?? i wonder what this does. LOL

G: Options
EGI EG Setup Input.jpg
What the setup should look like.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:14 am

EGI EG Setup Options.jpg
In the options this is what sets the data that will be transmitted to EG in the form of a "Payload". since not all items you will use you can turn them off. Further explaniation is below.


And that concludes the EGI plugin setup.


EGI Geozone Fence Creation:

fence: a virtual fence created on a map this fence is round and used to give notification of entering or leaving a specified area.
EGI Setup.jpg
Open EGI and you will see the screen above.

A: Is the fence menu it shows all of the fences you have programmed in and whether you are inside the area or outside. The menu is already open in this image it is the black bar on the left with the red and gray pointer things on it.

B: this is the program settings menu.

You will select the program settings menu labeled B

EGI Settings.jpg
You will want to check the box Allow broadcasting to plugin as depicted in the image above.

Now head on back to the first screen again where we will select option A to hide the fence menu.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:16 am

EGI Fence Creation.jpg
Once you hide the fence menu you will see the image above. This is where you make the fences.

A: Friendly name you give the fence. This name will be apart of the event in EG. I use the size of the fence for the name. But if you are not familiar with python and do not know how to use the payload data in EG then it would be wise to also put something in this field like "Wife's 1000 Meter". That way you will be able to separate the fences by who's phone it is. the Name of the phone is included in the payload data and can easily be used instead. Using the payload data for the device name is nicer and cuts down on repetitive macros and you would name all of the fences the same on every device. and have a single script separate who is who.

B: This is the radius of the fence. Now remember this is in meters so approx 3 Feet to 1 meter and also remember this is as the crow flies.

C: This is the button to press to select the location of your fence. You can set one up for home and say one for work. and the one for work you can use to send a text letting someone know you arrived, or letting someone know you are leaving. you can have it turn on or off the WiFi or Blueteeth on your phone.

So go ahead and make a name and put in a radius. Now click the button marked C, now before you do this make sure you have your location services turned on in your phone. You need to have this on in order for the app to get your current location this makes it easier for selecting a location. usually best to be where you want to set the fence.
EGI Fence Location.jpg
And here is the map.

A: Go to your current position.

B: Use this position for the fence.

OK pick where you want the fence to be. for this tutorial I would like it if you just created on where you are at the moment.
EGI Fence Creation Entered.jpg
OK here is the fence with all the proper information input.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Fri Jul 15, 2016 2:18 am

Make sure you have EG running with every step finished. Because as soon as you click Register you will get an event in EG if everything is working properly.

SuccessfulEvent.jpg

And that is all there is to it. It really isn't that hard. Once you have all of the router stuff done setting up on other phones is just a matter of following the EGI setup again on each device.


I will post more related to this. and an example tree with some python code done up for handling multiple devices. But this is enough for one day
If you like the work I have been doing then feel free to Image

allalone747
Experienced User
Posts: 81
Joined: Sun May 03, 2015 2:17 pm

Re: EG and Location Awareness

Post by allalone747 » Mon Jul 18, 2016 7:32 am

Hi there brilliant work , I have an iPhone but will pickup a cheap andriod just to set this program up , this is a lovely tutorial , we yarn for more , thank you Cheers :)

jachin99
Experienced User
Posts: 288
Joined: Sat Feb 13, 2016 8:39 pm

Re: EG and Location Awareness

Post by jachin99 » Mon Jul 18, 2016 2:18 pm

Something to consider: Some cellphone carriers like tmobile use ipv6 and not all routers can port forward between ipv6 and ipv4. I say this because my motorolla router cannot. It may be more useful for some to use an lan connection to trigger these events. I havent tried this with egigeozone but its a nice headsup becore buying a new phone

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Tue Jul 19, 2016 6:57 am

huh never thought of that. and using WiFi with EGI GeoZone becomes kind of irreverent because you can just use the ping plugin to determine if you are home or not.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3013
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG and Location Awareness

Post by kgschlosser » Wed Oct 19, 2016 7:08 am

there is no user interaction required past the initial setup. and that is how EG becomes Aware of your location without your interaction.
If you like the work I have been doing then feel free to Image

Post Reply