Geofence for Domoticz

Moderator: leecollings

pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: Geofence for Domoticz

Post by pvklink »

to use the google play services as you mentioned, do i need to install them on my cell phone?
I dont see aa google play app in the store....
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

pvklink wrote:to use the google play services as you mentioned, do i need to install them on my cell phone?
I dont see aa google play app in the store....
You can find them here: https://play.google.com/store/apps/deta ... ndroid.gms
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Misterik »

Thanks Appesteijn for the great app! I am still trying to figure out the right distance for me. So i was wondering in which time interval Geofence is looking for the phone entering the fence? is this one a minute? Because i arrive home by car and have not find the sweet spot that when i park my car the lamps in my house turn on.
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Misterik wrote:Thanks Appesteijn for the great app! I am still trying to figure out the right distance for me. So i was wondering in which time interval Geofence is looking for the phone entering the fence? is this one a minute? Because i arrive home by car and have not find the sweet spot that when i park my car the lamps in my house turn on.
The time interval is something that is managed by the Google Play Services. If you get close to the boundary of your geofence, it will start to measure more accurately and faster. How fast I have never looked into. Personally I use 1500 meters radius, because we live quite remote (very few telephone masts). With this distance my home is always 'on' when we arrive.
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Geofence for Domoticz

Post by heggink »

I noticed that Android is very inconsistent with its position. When at home, my phone regularly puts me either 500m or sometimes even 50km away from where I am until I open the maps app. This appears to be a known android 6 bug affecting lots of devices.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Jewcookie
Posts: 1
Joined: Tuesday 27 December 2016 20:25
Target OS: -
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Jewcookie »

Nice work. Any chance for an iPhone app?


Verzonden vanaf mijn iPhone met Tapatalk
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Jewcookie wrote:Nice work. Any chance for an iPhone app?
No sorry, I don't have an IPhone and to (voluntary) develop with Xcode is too much for me. :)
User avatar
DewGew
Posts: 579
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Re: Geofence for Domoticz

Post by DewGew »

My domofence look like it works but it doesent turn off when I leave the geofence. It turns on when I enter and the test goes weel also.
Any Ideas?

// Pierre
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

DewGew wrote:My domofence look like it works but it doesent turn off when I leave the geofence. It turns on when I enter and the test goes weel also.
Any Ideas?

// Pierre
If the test works (also from outside of your house? With no wifi) a connection can be made, 'on' and 'off' are (almost) the same calls to your server.

Do you see anything happening in the log of your domoticz server?
User avatar
DewGew
Posts: 579
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Re: Geofence for Domoticz

Post by DewGew »

Appesteijn wrote:
DewGew wrote:My domofence look like it works but it doesent turn off when I leave the geofence. It turns on when I enter and the test goes weel also.
Any Ideas?

// Pierre
If the test works (also from outside of your house? With no wifi) a connection can be made, 'on' and 'off' are (almost) the same calls to your server.

Do you see anything happening in the log of your domoticz server?
The test works outside the wifi zone. In the logg I can see if its switching, but it seems like domoticz sometimes don't get the signal to switch off. I get the notification in my cellphone when im entering or exiting the zone.
But today it worked fine. I hope it stays like that :)

// Pierre
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

DewGew wrote:
The test works outside the wifi zone. In the logg I can see if its switching, but it seems like domoticz sometimes don't get the signal to switch off. I get the notification in my cellphone when im entering or exiting the zone.
But today it worked fine. I hope it stays like that :)

// Pierre
Yeah :) keep me posted!
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Misterik »

Does anyone what the following error means ?

Code: Select all

{
"message": "WRONG CODE", 
"status": "ERROR", 
"title": "SwitchLight"
}
Since a couple of days my domofence is not working anymore, and when i use the 'test connection' option it return the above message!
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Misterik wrote:Does anyone what the following error means ?

Code: Select all

{
"message": "WRONG CODE", 
"status": "ERROR", 
"title": "SwitchLight"
}
Since a couple of days my domofence is not working anymore, and when i use the 'test connection' option it return the above message!
Has the IDX code of your virtual switch changed?
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Misterik »

Appesteijn wrote:Has the IDX code of your virtual switch changed?
Nope...but i changed my switch to protected and this is what it was causing.
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Misterik wrote:
Appesteijn wrote:Has the IDX code of your virtual switch changed?
Nope...but i changed my switch to protected and this is what it was causing.
Aha, ok thanks for sharing the solution :)
blauwebuis
Posts: 331
Joined: Wednesday 21 December 2016 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Contact:

Re: Geofence for Domoticz

Post by blauwebuis »

Interesting. I tried the app again, but it doesn't seem to offer an option that only uses cell-towers? And it still requires location permission when I install it.

Are you planning on making a new app that works with celltowers only by any chance?

I recently started using an Android app called WiFiToggle. It disables WiFi when you're not in the vicinity of celltowers that you have marked as beloning to your 'home' or 'work' location (you can add more). It automatically turns on Wifi when I'm close to home, and automatically disables it when I travel around the city.

https://play.google.com/store/apps/deta ... WifiToggle

If that app could also trigger a call to a URL when the state changes, it would be exactly what I am looking for..

So close!
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

blauwebuis wrote:Interesting. I tried the app again, but it doesn't seem to offer an option that only uses cell-towers? And it still requires location permission when I install it.

Are you planning on making a new app that works with celltowers only by any chance?
No not at the moment. Don't have much spare time at the moment. If I add new functionality I will start with 'add multiple geofences' in the app.
Your use case does sound fun and interesting to build, but I think it will also be difficult and the user value low.
Peterb
Posts: 6
Joined: Friday 27 January 2017 12:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Peterb »

I'm new to Domoticz but very impressed already with the great work done by so many of you. I'm keen on this geofencing concept and would like to use it as a safety feature to switch everything off when I'm away from home. But I think there may be a flaw. If the mobile device fails to get it's message to the server it does not retry and the boundary transition is missed. ( this will depend on the mobile app, but most seem to show this flaw).

Why not make a simple app to just periodically send the mobile location (tracker) and then domoticz can do all the 'heavy lifting'. A virtual device will 'track' the mobile's location and this data can be used to create multiple geofences within domoticz as required.

Any thoughts? Does any app like this exist which can communicate directly with Domoticz?

Thanks for your input.
Peter.
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

Peterb wrote:I'm new to Domoticz but very impressed already with the great work done by so many of you. I'm keen on this geofencing concept and would like to use it as a safety feature to switch everything off when I'm away from home. But I think there may be a flaw. If the mobile device fails to get it's message to the server it does not retry and the boundary transition is missed. ( this will depend on the mobile app, but most seem to show this flaw).

Why not make a simple app to just periodically send the mobile location (tracker) and then domoticz can do all the 'heavy lifting'. A virtual device will 'track' the mobile's location and this data can be used to create multiple geofences within domoticz as required.

Any thoughts? Does any app like this exist which can communicate directly with Domoticz?

Thanks for your input.
Peter.
Thanks for your remark! If DomoFence doesn't have a data connection available at the moment you cross your geofence, the request is cached and send when a data connection comes available. If your server is down, well then there isn't much switching to do anyway :)
Peterb
Posts: 6
Joined: Friday 27 January 2017 12:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Peterb »

That makes a lot of sense. I did have an issue where my own server was not quite down but had a temporary routing problem. Is there any ack message from the server to the app so that if the server is 'off-line' the app will continue to retry? I'm asking but in reality this is not a way forward for me as I own an iPhone :?

To be more specific; I'm using the domoticz app for my iPhone and the geofence feature. I left home the other day and it triggered. At some point while I was away something went awry with my home network and the 'return home' event was never logged. I fixed the routing issue but the app didn't retry so I had to manually go into the app and reconfigure the geofence just to get it to tell the server I was at home. An auto-retry plus ack message would have helped in this case.

I realise that my flakey network is a good place to start looking for solutions ;) but also a more robust comms would help in the event of temporary comms failures (of which there are very many kinds). Hence my question about a 'tracker' app for domoticz....
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest