Page 1 of 20
Geofence for Domoticz
Posted: Saturday 11 April 2015 0:05
by Appesteijn
I recently created a small app that flips a virtual switch on your domoticz server. It is a little basic, but it creates a geofence and once created, the geofence survives a possible reboot of your phone.
GeoFence
It is free, just let me know what you think of it
Just created a wiki-page:
http://www.domoticz.com/wiki/GeoFence
Re: Geofence for Domoticz
Posted: Saturday 11 April 2015 13:43
by Derik
Thanks...
Please tell me how this is working?
Or make please a Wiki..
I do not understand how this geo is working...
And basic is what i like..

Re: Geofence for Domoticz
Posted: Sunday 12 April 2015 11:25
by Appesteijn
thanks, I'll try to make a wiki today. The setup is:
When you enter or leave your geofence this app calls a URL on your Domoticz server so you can flip a virtual switch.
Entering sends a 'On' and leaving sends a 'Off'
Setup:
On your Domoticz server:
Create a virtual switch that DomoFence will trigger
Go to 'Setup -> Hardware' and add a 'Dummy device'
Go to 'Switches' and add a 'Manual light/switch'
Select the right 'Hardware' and 'On/Off' the rest doesn't matter.
Add the device
Now go to 'Setup -> Devices' and note the 'Idx' of the switch you just created.
Secure your Domoticz server with a username and password
Go to 'Setup -> Settings'
At 'Website protection' fill in a username, password and select 'Basic-Auth'
Now Save your settings
Open a port on your router and pass it to your internal domoticz server (usually through NAT)
To test the connection to your Domoticz server you can use the button on the bottom right of the app.
You can use
http://www.latlong.net/ to get the coordinates for the center of your geofence. I use a radius of 100 meters myself, but it is also possible to make the geofence smaller. Because of the errors on gps and location services, setting the radius too small (e.g. 10 meters) might give false 'enter' and 'leaves'. This depends on you environment so you should experiment a little to find the optimal setting.
Re: Geofence for Domoticz
Posted: Sunday 12 April 2015 12:24
by Derik
Is there a option to trace the mobile everywhere?
Re: Geofence for Domoticz
Posted: Sunday 12 April 2015 12:58
by Appesteijn
Derik wrote:Is there a option to trace the mobile everywhere?
No there is no option to trace your phone.
Re: Geofence for Domoticz
Posted: Friday 24 April 2015 19:57
by fl1p
The geofence radius, is that in meters, centimeters, kilometers?
I just installed it

Re: Geofence for Domoticz
Posted: Saturday 25 April 2015 1:24
by Skippiemanz
I think it's in meters!
Re: Geofence for Domoticz
Posted: Saturday 25 April 2015 8:24
by tlpeter
It is but i guess it is a good idea to put some text un for the fields.
I use it for a couple of weeks now and it works fine.
Re: Geofence for Domoticz
Posted: Monday 27 April 2015 23:40
by IanDury
Works fine. However I'm reluctant to have a non secure external connection to my domoticz server. The credentials are just encoded, not encrypted and could be intercepted. I'm using the nginx proxy server on my target to create a secure https connection to domoticz but unfortunately DomoFence does not seem to support https. Would this be hard to add?
Re: Geofence for Domoticz
Posted: Saturday 02 May 2015 0:13
by Appesteijn
I will have a look about adding meters to the radius and add https support tomorrow. Thanks for all the feedback!
After cleaning up the code, now it is time to look how to put https in it.
Re: Geofence for Domoticz
Posted: Friday 08 May 2015 11:49
by Appesteijn
IanDury wrote:Works fine. However I'm reluctant to have a non secure external connection to my domoticz server. The credentials are just encoded, not encrypted and could be intercepted. I'm using the nginx proxy server on my target to create a secure https connection to domoticz but unfortunately DomoFence does not seem to support https. Would this be hard to add?
It was more difficult that I thought, but I just put a new version on the Play Store which lets the use choose between http and https.
Re: Geofence for Domoticz
Posted: Friday 08 May 2015 17:13
by IanDury
Looks good. Using the test button https works fine and switches on my virtual device. Will do some real testing by entering/leaving the fence this weekend.
Thanks!
Re: Geofence for Domoticz
Posted: Friday 08 May 2015 19:13
by Derik
great....
Only the what i use is:
https://www.life360.com/tour/
I can see my kids the whole day...
Or maffemuis:
http://www.domoticz.com/forum/viewtopic ... uis#p29448
Where is nicks phone...
Only looks maffemuis is just left Domoticz..

Re: Geofence for Domoticz
Posted: Saturday 09 May 2015 10:55
by tlpeter
After updating it stopped working for me.
I use http and when I press the test button I get an error with the url.
Re: Geofence for Domoticz
Posted: Saturday 09 May 2015 18:59
by Appesteijn
tlpeter wrote:After updating it stopped working for me.
I use http and when I press the test button I get an error with the url.
This is fixed now, right? Ill try to see if 'login page' as authentication can als be implemented.
Re: Geofence for Domoticz
Posted: Sunday 10 May 2015 8:36
by tlpeter
Yes, when i use basic-auth it works.
Using login page doesn't work.
Re: Geofence for Domoticz
Posted: Monday 11 May 2015 19:18
by IanDury
IanDury wrote:Looks good. Using the test button https works fine and switches on my virtual device. Will do some real testing by entering/leaving the fence this weekend.
Thanks!
Real tests work fine too. I'm using https and Basic-Auth
Re: Geofence for Domoticz
Posted: Saturday 16 May 2015 8:58
by tlpeter
I noticed lately that i entered the zone while i did not even left it (i was asleep)
This happened a couple of times yesterday.
I will keep an eye on this.
What could be the reason for this?
Re: Geofence for Domoticz
Posted: Saturday 16 May 2015 21:30
by Appesteijn
tlpeter wrote:I noticed lately that i entered the zone while i did not even left it (i was asleep)
This happened a couple of times yesterday.
I will keep an eye on this.
What could be the reason for this?
Do you have a small geofence radius? I also experienced some false positives latety (but I live on the edge of a few gsm-masts).
The Google Play Service does the geofence measuring, I'm not sure what might have changed there.
Other people noticing this?
Re: Geofence for Domoticz
Posted: Sunday 17 May 2015 8:09
by tlpeter
I have it set to a 100 metres.
What you say about gsm could be the problem.
Because of maintenance I have very little gsm reach at the moment and most of the time I am unreachable.