Geofence for Domoticz

Post Reply
Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Geofence for Domoticz

Post by Appesteijn » Saturday 11 April 2015 0:05

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
Last edited by Appesteijn on Sunday 12 April 2015 13:10, edited 1 time in total.

User avatar
Derik
Posts: 1833
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Geofence for Domoticz

Post by Derik » Saturday 11 April 2015 13:43

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.. :D :D :D :D
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Sunday 12 April 2015 11:25

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.

User avatar
Derik
Posts: 1833
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Geofence for Domoticz

Post by Derik » Sunday 12 April 2015 12:24

Is there a option to trace the mobile everywhere?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Sunday 12 April 2015 12:58

Derik wrote:Is there a option to trace the mobile everywhere?
No there is no option to trace your phone.

User avatar
fl1p
Posts: 57
Joined: Friday 19 July 2013 12:27
Target OS: Raspberry Pi
Domoticz version: beta
Location: Belgium
Contact:

Re: Geofence for Domoticz

Post by fl1p » Friday 24 April 2015 19:57

The geofence radius, is that in meters, centimeters, kilometers? :D

I just installed it :-)

Skippiemanz
Posts: 263
Joined: Sunday 14 July 2013 20:21
Target OS: Raspberry Pi
Domoticz version: 3.5859
Location: Alkmaar, The Netherlands
Contact:

Re: Geofence for Domoticz

Post by Skippiemanz » Saturday 25 April 2015 1:24

I think it's in meters!

tlpeter
Posts: 391
Joined: Wednesday 26 November 2014 19:43
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by tlpeter » Saturday 25 April 2015 8:24

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.

IanDury
Posts: 30
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by IanDury » Monday 27 April 2015 23:40

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?

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Saturday 02 May 2015 0:13

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.

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Friday 08 May 2015 11:49

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.

IanDury
Posts: 30
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by IanDury » Friday 08 May 2015 17:13

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!

User avatar
Derik
Posts: 1833
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Geofence for Domoticz

Post by Derik » Friday 08 May 2015 19:13

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... :D ;)

Only looks maffemuis is just left Domoticz..:-(
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

tlpeter
Posts: 391
Joined: Wednesday 26 November 2014 19:43
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by tlpeter » Saturday 09 May 2015 10:55

After updating it stopped working for me.
I use http and when I press the test button I get an error with the url.

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Saturday 09 May 2015 18:59

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.

tlpeter
Posts: 391
Joined: Wednesday 26 November 2014 19:43
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by tlpeter » Sunday 10 May 2015 8:36

Yes, when i use basic-auth it works.
Using login page doesn't work.

IanDury
Posts: 30
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by IanDury » Monday 11 May 2015 19:18

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

tlpeter
Posts: 391
Joined: Wednesday 26 November 2014 19:43
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by tlpeter » Saturday 16 May 2015 8:58

I noticed lately that i entered the zone while i did not even left it (i was asleep) :mrgreen:
This happened a couple of times yesterday.
I will keep an eye on this.
What could be the reason for this?

Appesteijn
Posts: 106
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn » Saturday 16 May 2015 21:30

tlpeter wrote:I noticed lately that i entered the zone while i did not even left it (i was asleep) :mrgreen:
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?

tlpeter
Posts: 391
Joined: Wednesday 26 November 2014 19:43
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by tlpeter » Sunday 17 May 2015 8:09

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests