presence with @owntracks - please help

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
kisiel
Posts: 1
Joined: Tuesday 23 February 2016 11:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

presence with @owntracks - please help

Post by kisiel »

Hi,

Would anyone be able to point out the step-by-step tutorial to configure presence detection in Domoticz using @owntracks?
All the magical Wifi/BT scripts I tried to use with my iPhone tend to kick me out of the home without a reason. They also don't like tracking two or more phones.
@owntracks seem always to know where I am, but I cannot find any tutorial a beginner could use. Or in fact not much of the information at all.

Thanks
Marcin
zandhaas
Posts: 15
Joined: Wednesday 09 November 2016 5:11
Target OS: NAS (Synology & others)
Domoticz version: V3.8805
Contact:

Re: presence with @owntracks - please help

Post by zandhaas »

Hi Marcin,

Have you been able to configure Owntrack for presence detection already?
And if yes do you have short describtion on how you did it?

Regards,

Peter
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: presence with @owntracks - please help

Post by Egregius »

What did you do already?
In 2 minutes I have a logfile of my locations:

Code: Select all

<?php
header("Content-type: application/json");
$payload = file_get_contents("php://input");
file_put_contents('/volume1/web/owntracks.txt',$payload.PHP_EOL, FILE_APPEND | LOCK_EX);
gives:

Code: Select all

{"batt":67,"lon":3.412351689490594,"acc":10,"vel":0,"vac":4,"lat":50.8929250203547,"t":"u","conn":"w","tst":1479300137,"alt":29,"_type":"location","tid":"11"}
{"batt":67,"lon":3.412351689490594,"acc":10,"vel":0,"vac":4,"lat":50.8929250203547,"t":"u","conn":"w","tst":1479300141,"alt":29,"_type":"location","tid":"11"}
{"batt":66,"lon":3.412351689490594,"acc":10,"vel":0,"vac":4,"lat":50.8929250203547,"t":"p","conn":"w","tst":1479300633,"alt":29,"_type":"location","tid":"11"}
Then it's just a mather of parsing the json to an array and do stuff with it. Can't be that hard.
Personally I'm still looking for a way to do presence detection on iOS and Android without the need of apps. Playing with arp table stuff right now...
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: presence with @owntracks - please help

Post by Nautilus »

Egregius wrote: Personally I'm still looking for a way to do presence detection on iOS and Android without the need of apps. Playing with arp table stuff right now...
Interesting, please share your findings if/when you succeed, I'm very interested about the iOS part..:)

Ontopic: Owntracks was not working reliably for me - it consistently located me 5km away from home for a short period of time when in reality I was still home. Well, maybe it is not Owntracks to blame but iOS / iPhone GPS capabilities. Couldn't find any other reliable geofence app either. What works (with a delay though) for me is the "Find my iPhone" script covered on another thread here. It does not give false positives / negatives but the location info seems to be a bit delayed for some reason (5-10 minutes or so). Therefore, cannot use it for anything requiring fast reacting.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: presence with @owntracks - please help

Post by Egregius »

I mostly want to deactivate the alarm as soon as I'm connected to my wifi.
For that I want to check the ARP table of my Pi-Hole DNS.
Detection is pretty good and fast.
Just when leaving the house it doesn't detect. I don't really mind about that, I'm used to set a switch 'Away' manually.
Now just created a script that removes the mac addresses of the ARP table when I press that button. More testing is necescary before publication.
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: presence with @owntracks - please help

Post by Bikey »

kisiel wrote: Tuesday 23 February 2016 11:59 Hi,

Would anyone be able to point out the step-by-step tutorial to configure presence detection in Domoticz using @owntracks?
All the magical Wifi/BT scripts I tried to use with my iPhone tend to kick me out of the home without a reason. They also don't like tracking two or more phones.
@owntracks seem always to know where I am, but I cannot find any tutorial a beginner could use. Or in fact not much of the information at all.

Thanks
Marcin
To kick this topic: I'm also interested in a step by step instruction to get this working and really get this into Domoticz.
I already got MQTT working on Domoticz, but now need to connect this to the Owntracks incoming MQTT-stream with proper reformating to get the data into Domoticz.
I guess I need to install Node-Red and implement a flow for that? That's pretty new stuff for me, so some pointers/scripts to get this working are much appreciated!
wkossen
Posts: 62
Joined: Friday 06 November 2020 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: presence with @owntracks - please help

Post by wkossen »

So i found this old thread searching for a way to get some geo-info into domoticz from owntracks. I would like to use that for presence detection to switch stuff on as soon as i'm home (or close to home). I'm not there yet, but i have been able to get info from owntracks into domoticz. and since this thread ends unresolved, i'll add a bit to it.

I setup my mosquitto on the rpi to use username and password and made it available to the internet on my internet router by sharing it's 1883 port to the outside. maybe one day i'll move to one of these free cloud based mqtt servers so that i don't have to expose my host like that, but then some unknown provider is snooping on my data. choose your evil :/

i then set up node-red with an mqtt-in node, configured to listen to the exact topic found in the owntracks settings, which is something like owntracks/username/someinsanelylonghexadecimalstring. of course, use a username password in mosquitto to do that...

now here is something missing that i havent figured out yet, how to nicely extract the lat/lon values from the string that i get into node-red. for now i just pass it on to domoticz to a dummy text sensor like this:

a simple function node containing:
msg.payload = {"command":"udevice","idx":xxx,"nvalue":0,"svalue":msg.payload};
return msg;
where xxx is the idx number of your dummy text sensor in domoticz

and finally a mqtt out node posting to the domoticz/in topic.

and the device shows the text string owntracks spews out within domoticz.

add debug as you please.

so there is some leftover stuff to do.

i need to extract lat en lon from this string: {"batt":95,"lon":mysecretlocationlon,"acc":65,"p":102.120,"bs":2,"vac":3,"lat":mysecretlocationlat,"t":"u","conn":"m","tst":1605635217,"alt":18,"_type":"location","tid":"8A"}
i don't know how to do that. i don't even know what this string is. i'm no programmer.
i think batt is actually phone battery level. i don't know the other values, there might be something usefull there as well, but i didn't google it.... anyone knows?

and secondly, domoticz needs this as a location, not just text. and i have no idea what sensor to use for that. there isn't (or i didn't spot it) a gps dummy sensor or location dummy sensor. There is a 'distance' sensor, but i don't know what that does, and what to feed it...

and then how to set up anything useful with it. like:

turn on the outside lamp when i'm not-home-yet, but within 200m, turn it off when i'm home (this won't work because of gps-drift)
turn on the heating/airconditioning when i'm home/close to home, turn it off when i'm away
activate an alarm system when i'm away from home, and deactivate it when i'm home (this better not break... how reliable is all this? i need manual overrides).

for now this is just an interesting excercise for me to get to know mqtt, node-red and domoticz. i'm practicing. i'm not sure if i would actually use this later on.

any pointers on getting this to work properly would be appreciated. Thanks!

Cheers
Willem
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest