Geofence for Domoticz

Moderator: leecollings

guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

Today i take some test with 2 script and i have just one problem. When i come back home the geofence is on. But when i put the car in the box i haven't gps signal so the geofence became off for some seconds and after switch to on. I need to repear these gap with a script. Anything can help me???

For the question over iam agree with Appesteijn.

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

guantolento wrote:Today i take some test with 2 script and i have just one problem. When i come back home the geofence is on. But when i put the car in the box i haven't gps signal so the geofence became off for some seconds and after switch to on. I need to repear these gap with a script. Anything can help me???

For the question over iam agree with Appesteijn.
You could use the 'Set ... = ... after ... seconds' to set the virtual switch 'Anybody home' to 'off' after 180 seconds. So when you are in the geofence within 3 minutes 'Anybody home' will still be on.
Toolman
Posts: 23
Joined: Monday 04 July 2016 23:15
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8805
Location: Netherlands
Contact:

Re: Geofence for Domoticz

Post by Toolman »

sweup wrote:
sweup wrote:I want to flip "on/off" commands when both my and my wifes phone is in/outside the geofence - possible?


Personally I use three virtual switches. One for me and one for my wife. These are switched by crossing the geofence.
Then I have a third virtual switch 'Anybody home' and I switch the third one with blockly when both the other switches are off.


Thanks. Domofence switch seams to work but I don't get my alarm switch to be turned on. Does this Blockly seams ok?

I got two geofence, so "when geofence 1 and geofence 2 is on, larm should be switched on". I got a similar one for "off", bad approach?
Image[/quote]
Hi sweup,
I think you need something like this:
Forum antwoord.jpg
Forum antwoord.jpg (44.05 KiB) Viewed 3676 times
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

Hi guys,
this is my script to use 2 geofence with 2 smartphone. if all 2 phone are OUT the system turn off all light. if only 1 phone come home and the time is in night moded the system turn ON the light external and ON the light living. if 1 phone is in house and the 2 phone come home the system turn ON the external light.
i take some test move direclty the custom sensor on the maps and i think the system work ok.
tomorrow i test the system with the geofence on the phone.
bye bye i go to bed now !!!
Attachments
Someone At Home.JPG
Someone At Home.JPG (158.92 KiB) Viewed 3654 times
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: RE: Re: Geofence for Domoticz

Post by guantolento »

guantolento wrote:Hi guys,
this is my script to use 2 geofence with 2 smartphone. if all 2 phone are OUT the system turn off all light. if only 1 phone come home and the time is in night moded the system turn ON the light external and ON the light living. if 1 phone is in house and the 2 phone come home the system turn ON the external light.
i take some test move direclty the custom sensor on the maps and i think the system work ok.
tomorrow i test the system with the geofence on the phone.
bye bye i go to bed now !!!
The script work ok. But the geofence on the phone not work very good. I setting It with a radius of 200 mt. But when iam at home sometimes the switch is always off or the oppositive situation iam out of home and the switch is always on. Why?

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

You should split your blockly into two seperate ones:
Screen Shot 2016-11-16 at 07.57.25.png
Screen Shot 2016-11-16 at 07.57.25.png (215.94 KiB) Viewed 3599 times
And:
Screen Shot 2016-11-16 at 07.57.40.png
Screen Shot 2016-11-16 at 07.57.40.png (243.95 KiB) Viewed 3599 times
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

Why i must separate in two blocky ? The script work already correct. Just for information. Thanks for all.

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Geofence for Domoticz

Post by emme »

Hi,
may I ask for a feature in the next version f Domofence?

The app is simpky grest, but is it possibile to select 2 addresses (internal and external IP) for the server?

I'm asking this because my internet provider (Vodaone) does not allow external connection from the internal LAN, so I cannot access my domoticz server trying to access from the dDNS from my WiFi (THANK YOU VODAFONE... REALLY! :evil: :evil: :evil: )

so, by the time I'll connected to my LAN I can send the signal,
once out of my hone I can send the signal either via dDNS address.... :P

thank you
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

emme wrote:Hi,
may I ask for a feature in the next version f Domofence?
Thank you, but unfortunately I no longer have access to the source code of this app. If you want new features you should send an e-mail to [email protected]
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

Hi, i don't know why the app sometimes work and sometimes no. Iam always entered but really iam out of home. ..

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

just an information. if i have a VPN from the smartphone to the Domoticz server i can't use the geofencing it's ok ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

guantolento wrote:just an information. if i have a VPN from the smartphone to the Domoticz server i can't use the geofencing it's ok ?
I'm not sure. Altough the app can't initiate the VPN connection itself, if you can reach your server 'from the outside' DomoFence should be able to do the same.
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Geofence for Domoticz

Post by guantolento »

thanks for all, but for me geofence is too much inaccurate, i think my smartphone have a gps problem, but sometimes iam at home and all light of home turn Off ..... :shock: :shock: :shock: :shock: :shock: so i pass to a ping presence. bye bye.
and so i don't open any port to the wan direction.
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
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 »

Another feature request: could this work via cell tower recognition?

In use cases where you don't need precision (thermostat in my case) it's the most battery and privacy friendly way of doing things.
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:Another feature request: could this work via cell tower recognition?

In use cases where you don't need precision (thermostat in my case) it's the most battery and privacy friendly way of doing things.
The Google Play services use cell tower recognition when you are not close to the 'fence' of your geofence. Only when you get closer it switches to a more accurate mode (e.g. GPS).
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 »

Yes, but the whole point is to not use Google's services in order to protect privacy. I wrote a longer version of the same feature request here:
viewtopic.php?f=37&t=8884&p=110309#p110134

It explains what I'm after in way too much detail :-)
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Geofence for Domoticz

Post by jannl »

I wonder how you can get a position of of your android phone without using google service. To my opinion this is only possible when you recompile the android part that handles this.
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:Yes, but the whole point is to not use Google's services in order to protect privacy. I wrote a longer version of the same feature request here:
viewtopic.php?f=37&t=8884&p=110309#p110134

It explains what I'm after in way too much detail :-)
Although this is a great idea and possible, you are basically asking to create a location service with the same quality and features as Google did. My (bad) experiences with a 'direct GPS' version of domofence (when I started this app), made me decide to use the Google Location Services because it (usually) just works on all different Android devices and uses less battery. So for this time I'm not going to implement this feature request.
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 »

While I can respect that, I don't agree that this this is asking to re-create Google's system. The whole point of my proposal is that it is relatively simple.
- It just uses cell towers.
- It doesn't even look at their signal strength. It just counts the amount of 'home' ones that are around.

In the end I simplify it even further: define your 1 'home' cell tower, and from then on just check if you are connected to it or not. This make the area that counts as being home a bit bigger, but to me even this would still be preferable to any system that constantly informs Google where I am.

To anyone looking for this: you can create the basic version through the Tasker app. Have a look here:
http://www.domoticz.com/forum/viewtopic ... 3&p=110308
http://tasker.dinglisch.net/userguide/e ... .html#cell

I totally understand what you mean about the pure GPS version by the way, I've worked with GPS a lot. But cell tower recognition is a way more simple and robust technology.
Appesteijn
Posts: 134
Joined: Friday 10 April 2015 23:53
Target OS: Linux
Domoticz version:
Contact:

Re: Geofence for Domoticz

Post by Appesteijn »

I have just released a new update version of domofence (my old company gave me the source code).

I have disabled the hostname <-> Common Name check when you use https, so the app should be easier to use with self signed certificates.

If you have any issue's just let me know.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests