Geofence for Domoticz

Moderator: leecollings

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

Re: Geofence for Domoticz

Post by IanDury »

It also depends on the phone / GPS radio accuracy. My SGS5 almost never gives false zone results even with a radius of 150 meters. My wife's SGS4Mini needs at least a radius of 500 meter to give acceptable results. Looking at Google's location history I see that her location itself is pretty correct but there is a large circle (radius ~500m) drawn around it that shows the possible inaccuracy. Is this something that can be improved (ignoring the circle and just use the centre) with the Google location API?

N.B. I also tried EgiGeoZone but got similar results. To improve the presence detection at home I combined it with an ip scan. Only if both Domofence and a ping show the same result the status will change.
User avatar
RoadXY
Posts: 278
Joined: Monday 07 April 2014 12:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2331
Location: Near Gorinchem
Contact:

Re: Geofence for Domoticz

Post by RoadXY »

tlpeter wrote: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.
If you have Google Now enabled, you could look at your Google location history and see if you can see the glitch there also.
My guess is, it is...

https://maps.google.com/locationhistory/b/0
phred91
Posts: 8
Joined: Tuesday 04 February 2014 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by phred91 »

The instructions say to "open a port on your router". Which port? I've tried a bunch but each time I get "connection refused". Not by the router, but by the Raspberry Pi that is running Domoticz. How is the port number tied to the Dummy Switch?
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

Re: Geofence for Domoticz

Post by pvm »

phred91 wrote:The instructions say to "open a port on your router". Which port? I've tried a bunch but each time I get "connection refused". Not by the router, but by the Raspberry Pi that is running Domoticz. How is the port number tied to the Dummy Switch?
The outside port does not matter, choose an unused one (for example 5454), preferably not 8080 (used inside your network for domoticz). This makes it a little harder to hack into your system because it is not one of the default ports used.
Configure your router to allow this port and forward it to 8080 on your PI
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

Re: Geofence for Domoticz

Post by joostvanderlinde »

Can it be that Domofence only detects enter/leave events when there is an actual internet connection available. Ie. when my son (who does not have a mobile internet bundle and resides fully on 'free wifi') leaves the house, by the time he passes the fence probably will not have an active internet connection. When the connection is re-established (eg. when passing a wifi-spot when he is on his bike) I kindof expected the fence-pass event is send.
I am not sure if this is the case.
When testing the event of moving out appears to be registered, but the moving in appears not to be registered.
Is this something I need to fine-tune, or would this need some coding in the app?
Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

joostvanderlinde wrote:Can it be that Domofence only detects enter/leave events when there is an actual internet connection available. Ie. when my son (who does not have a mobile internet bundle and resides fully on 'free wifi') leaves the house, by the time he passes the fence probably will not have an active internet connection. When the connection is re-established (eg. when passing a wifi-spot when he is on his bike) I kindof expected the fence-pass event is send.
I am not sure if this is the case.
When testing the event of moving out appears to be registered, but the moving in appears not to be registered.
Is this something I need to fine-tune, or would this need some coding in the app?
At the moment that you cross the geofence boundary a http request is directly done and in your case probably times out in the background. What he could do to test this is use the 'test' button once he is out of wifi range and see what happens, if I'm not mistaken it will give a URL not found error in 4 seconds.
I don't think you can set the geofence so small so that your son still has wifi when he leaves, you could try to set the geofence at a range where he does have internet connectivity, but that might take a lot of tweaking.

Android has a callback for internet connectivity, so it should be possible to listen for it and then send the last status change. I might have a look at this next week (I'm on vacation now :) )
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

I just released a new version to the play store.
When you cross the geofence and you aren't online the call to your server gets saved and is send when your phone gets online. It sends the latest state so crossing the geofence multiple times while offline, should work ok. If your phone is online, the message is send to your server directly.
brandie21474
Posts: 7
Joined: Tuesday 14 July 2015 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: ß
Location: everywhere
Contact:

Re: Geofence for Domoticz

Post by brandie21474 »

Error
Error
Screenshot_2015-07-28-17-53-05.png (240.58 KiB) Viewed 5409 times
I get an error, and its not the handshake, because I tested it. It looks like the command cannot be executed. Any ideas?
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

brandie21474 wrote:
Screenshot_2015-07-28-17-53-05.png
I get an error, and its not the handshake, because I tested it. It looks like the command cannot be executed. Any ideas?
When do you get this error, when crossing the geofence or when you test it?

Possible errors I can think of:
- Temporary network error, so the message can't be send
- Slow network so time-out occurs (time out is set to 3 seconds)
- Username/password error (but then the test shouldn't work, but maybe you accidentally changed it?)
brandie21474
Posts: 7
Joined: Tuesday 14 July 2015 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: ß
Location: everywhere
Contact:

Re: Geofence for Domoticz

Post by brandie21474 »

Appesteijn wrote:
brandie21474 wrote:
Screenshot_2015-07-28-17-53-05.png
I get an error, and its not the handshake, because I tested it. It looks like the command cannot be executed. Any ideas?
When do you get this error, when crossing the geofence or when you test it?

Possible errors I can think of:
- Temporary network error, so the message can't be send
- Slow network so time-out occurs (time out is set to 3 seconds)
- Username/password error (but then the test shouldn't work, but maybe you accidentally changed it?)
I get it while testing. Immediately after pushing the button. In my opinion it's none of the possibilities mentioned above. I get it at home and beyond the geofence border
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

brandie21474 wrote:
Appesteijn wrote:
brandie21474 wrote:
Screenshot_2015-07-28-17-53-05.png
I get an error, and its not the handshake, because I tested it. It looks like the command cannot be executed. Any ideas?
When do you get this error, when crossing the geofence or when you test it?

Possible errors I can think of:
- Temporary network error, so the message can't be send
- Slow network so time-out occurs (time out is set to 3 seconds)
- Username/password error (but then the test shouldn't work, but maybe you accidentally changed it?)
I get it while testing. Immediately after pushing the button. In my opinion it's none of the possibilities mentioned above. I get it at home and beyond the geofence border
Could you try if opening the url in your browser? If you get the 'OK' message there, reinstalling the app might work.
brandie21474
Posts: 7
Joined: Tuesday 14 July 2015 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: ß
Location: everywhere
Contact:

Re: Geofence for Domoticz

Post by brandie21474 »

I reinstalled the app. It works. Thx
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by markk »

Hi. The app works well for me. Just wondered, Is there an option to use this if you haven't set up a username and password in Domoticz? It appears these fields are mandetory.
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
User avatar
Plaagje
Posts: 42
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by Plaagje »

I got the error too after testing.... forgot to put authentication on "basic-auth" :roll:
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

markk wrote:Hi. The app works well for me. Just wondered, Is there an option to use this if you haven't set up a username and password in Domoticz? It appears these fields are mandatory.
Hmm, I'm not sure if I should implement this. As crossing the geofence will (besides of the people living in castles) be outside of your home, you will have to access your Domoticz-server from the internet. If you setup your Domoticz server to be accessible for everyone from the interwebz this might be a big security risk.

Or am I missing a use case here?
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by markk »

Has anyone else experience severe battery drain on their device whilst using this?
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

markk wrote:Has anyone else experience severe battery drain on their device whilst using this?
On my own phone I didn't notice any battery drain. But it might depend on how big your geofence is (mine is 500 meters). If you come near the border of the geofence, your phone will start to measure more accurate and thus use more power. If you set a small radius (for example 20 meters) your phone will almost always measure very accurate and that might cost more battery.
markk
Posts: 267
Joined: Tuesday 14 January 2014 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by markk »

Appesteijn wrote:
markk wrote:Has anyone else experience severe battery drain on their device whilst using this?
On my own phone I didn't notice any battery drain. But it might depend on how big your geofence is (mine is 500 meters). If you come near the border of the geofence, your phone will start to measure more accurate and thus use more power. If you set a small radius (for example 20 meters) your phone will almost always measure very accurate and that might cost more battery.
Thanks for your reply. my wife has a new android phone which is draining battery so the reason is a bit of trial and error at the moment. I've now disabled the domofence app and have started using the ping method. This didn't work well on IOS as iPhones disconnect from wifi when not in use. seems to be working ok on he android though.
Running Domoticz on Pi3 with RFXtrx433e. LWRF power sockets and dimmer switches. Integrated my existing wirefree alarm PIRs and door contacts with domoticz. Geofencing with Pilot. Harmony Hub. Tado for Heating. Now playing with mysensors.
thaui
Posts: 58
Joined: Sunday 15 March 2015 19:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Hamburg
Contact:

Re: Geofence for Domoticz

Post by thaui »

Thank you for this great app. It works fine after I switched to Basic-Auth. I have tried a lot of things before but this time I was succesful very fast and it worked just out of the box. I am using the app from my phone via a VPN connection directly to my ASUS router. Save and comfortable. Curently it seems only possible to switch on and off an IDX. How about using the app to change the status of the secpanel? arm/disarm/status?
I believe there are many users out there looking for this kind of functionality not using a virtual switch. Pls. think about and keep on going. :)
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Thank you, it is nice to hear you like it! I don't have any experience with a securtiy panel, but I'll have a look at it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest