This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Presence detection

2

Comments

  • PeaoPeao Member
    Phuturist said:
    This is great stuff. I currently use Tasker on our Android phones which gets this job done as well but will look into this when I have some more time. Gonna try to get the stand alone app running on my Synology NAS as this is running 24/7 anyway.
    @MatjaLipu thanks for this app! 
    @Phuturist did you have success with installing the app on a synology NAS? if so i am very interested to do the same.
  • MatjaLipu said:
    remove the trailing /
    f*ck me... duh.... Thank you!
    I get devices etc now... 
  • Well the cool thing is, it seems to work right now :) 

    however, with an iphone 6 running 9.3.1 (up to date) it doesnt work well -yet-. Basically every x minutes when the phone is on, but locked / asleep i get homey/presence app to find it, lose it, find it, lose it, etc. :) 

    The iphone when locked screen keeps disconnecting its wifi. Now reading into it it seems there are potential solutions to be found in shortening the ping or something like that, but i havent found THE solution yet. When I will find it I will post it here as there must be more iphone users using this ;) 
  • Peao said:
    Phuturist said:
    This is great stuff. I currently use Tasker on our Android phones which gets this job done as well but will look into this when I have some more time. Gonna try to get the stand alone app running on my Synology NAS as this is running 24/7 anyway.
    @MatjaLipu thanks for this app! 
    @Phuturist did you have success with installing the app on a synology NAS? if so i am very interested to do the same.
    No I didnt. The current NodeJS package available for my NAS (Synology DS111) includes version v0.10.41. This is not enough to use the Better Presence app becomes of some dependencies I believe (forgot what the actual issue as).

    I tried updating NodeJS manually on the NAS but this does not go well rendering NodeJS broken. I believe I read somewhere that NodeJS v4.x does not run very well on the architecture of my NAS (ARMv6). So I eventually gave up trying after sending Synology a question if the NodeJS v4.x package ever becomes available for my NAS (which they never answered).

    If you get it working on the same architecture I'd be most interested.
  • Wouldn't it be much more helpfull is @Athom would implement a ping-like command from it's own code? I assume there's disadvantages otherwise they would have done that already but sending a ping to an specified ip doesn't take that much resources, does it? Maybe using the WOL-system or doesn't this command get an ack?
  • however, with an iphone 6 running 9.3.1 (up to date) it doesnt work well -yet-. Basically every x minutes when the phone is on, but locked / asleep i get homey/presence app to find it, lose it, find it, lose it, etc. :) 
    You are using arpscan or ping provider for iPhone?
    Arpscan is convenient since it finds all devices but it's very flaky in reliability. You can tune it using "addedCount" & "removedCount"  configs.
    Ping should be more reliable, but you need static IP for tracked devices.
    Reliable is tcp-connect, but it requires some TCP service running on tracked device.

    @BasVanDenBosch Ping is using ICMP packets which can be sent only with root privileges (root user or su flag on binary). Similar for arpscan.

    Athom could add ping API, but that doesn't solve general issue. We have same issue with arp-scan or any other binary requiring su privileges. Running Homey apps in containers and allowing custom binaries with su would allow this. But current Homey is not at state where apps architecture is top priority.

    @Peao @Phuturist I'll look into if there is a possibility supporting 0.10, but don't have high hopes. Maybe 0.12.
  • MatjaLipu said:
    however, with an iphone 6 running 9.3.1 (up to date) it doesnt work well -yet-. Basically every x minutes when the phone is on, but locked / asleep i get homey/presence app to find it, lose it, find it, lose it, etc. :) 
    You are using arpscan or ping provider for iPhone?
    Arpscan is convenient since it finds all devices but it's very flaky in reliability. You can tune it using "addedCount" & "removedCount"  configs.
    Ping should be more reliable, but you need static IP for tracked devices.
    Reliable is tcp-connect, but it requires some TCP service running on tracked device.

    @BasVanDenBosch Ping is using ICMP packets which can be sent only with root privileges (root user or su flag on binary). Similar for arpscan.

    Athom could add ping API, but that doesn't solve general issue. We have same issue with arp-scan or any other binary requiring su privileges. Running Homey apps in containers and allowing custom binaries with su would allow this. But current Homey is not at state where apps architecture is top priority.

    @Peao @Phuturist I'll look into if there is a possibility supporting 0.10, but don't have high hopes. Maybe 0.12.
    well not sure i understand :) but i tried in windows to continuosly ping the iphone and that dropped after a while as well...(request time out i believe)

    I can look into the TCP part - but no idea how to start there yet... 

  • Just a question. arp-scan does not auto detect my interface. i need to manually supply that. where can i configure tge arp-scan commandline parameters. 
    @MennoVanGrinsven I've added support for custom arp-scan arguments in latest 1.5.3 version. See config options.
  • Starting to think that in combination with an iphone that the arpscan or potentially even tcp/ping whatever might not be the best option to have homey know if im home or not. 

    Thinking that geofencing app with webhook might be a better (more stable and easy) solution. 

    I do welcome other thoughts though! and @MatjaLipu I would like to thank you for the quick support and the creation of this app, I think it can absolutely be great 
  • I don't know how iOS works and if it's possible to use wifi to test device presence.
    Homey bluetooth support would here open new possibilities.

    I'll add new provider which you can notify your device is present. Then in Tasker (or similar app in iOS) you can setup trigger when connected to home wifi, ping (http request) presence tracker app every x seconds. Sounds this like a solution?
  • MatjaLipu said:
    I don't know how iOS works and if it's possible to use wifi to test device presence.
    Homey bluetooth support would here open new possibilities.

    I'll add new provider which you can notify your device is present. Then in Tasker (or similar app in iOS) you can setup trigger when connected to home wifi, ping (http request) presence tracker app every x seconds. Sounds this like a solution?
    hi @MatjaLipu - ow it all worked kinda - but it was indeed the iphone who disconnects the wifi when it goes to locked screen. so it disconnects the possibility to be pinged. 

    I should indeed give it another go with something similar to tasker... will let you know :) 
  • MatjaLipu said:
    I don't know how iOS works and if it's possible to use wifi to test device presence.
    Homey bluetooth support would here open new possibilities.

    I'll add new provider which you can notify your device is present. Then in Tasker (or similar app in iOS) you can setup trigger when connected to home wifi, ping (http request) presence tracker app every x seconds. Sounds this like a solution?
    hi @MatjaLipu - ow it all worked kinda - but it was indeed the iphone who disconnects the wifi when it goes to locked screen. so it disconnects the possibility to be pinged. 

    I should indeed give it another go with something similar to tasker... will let you know :) 
    aokay  - well after googling the crap out of this topic there doesnt seem to be a valid solution for an iphone to keep its wifi on (without jailbreaking - which i cant do). so i did see earlier on this thread that bluetooth is being looked into, so that could be interesting! lets hope for that ;) 
  • The only way for me to reliably test whether a mac address is present or absent is by using the app Better Logic, and then use a Math.js expression. Only fill in the Present label; if you want to capture an Absent event, check the false checkbox in the Math.js expression.

    What would be the correct way to use the built-in logic?
    I'm having the same problem with the built-in logic cards. For some reason, comparing the tag to false or "not true" (with the checkbox) doesn't work. I'll try using Better Logic instead. Thanks!
  • Does anyone have a good init script for presence-tracker ? (running ubuntu server 14.04)
  • @MatjaLipu 

    Would love to use this app to increase presence usability of my Homey. I have a cheap BLE beacon but I can not find in your app how to use it. 
  • edited August 2016
    @DieterKoblenz  I do not think the app supports beacons. As fas as i remember it pings / arpscans for your phone. And that is sever side. 
  • Ah, well the description says iBeacon  ;) Perhaps Matjaž took a page from Athom's book when it comes to marketing  :# 
  • @DieterKoblenz I agree it is not very clear . I guess that you have to extend the server side part of better presence to support beacons. 

    If you are running a mqtt/Mosquitto broker you can have a look at my owntracks client. The owntracks app for ios/android has Beacon support
  • @DieterKoblenz I agree it is not very clear . I guess that you have to extend the server side part of better presence to support beacons. 

    If you are running a mqtt/Mosquitto broker you can have a look at my owntracks client. The owntracks app for ios/android has Beacon support
    Hmm, interesting. I do have a mqtt broker, but never exposed it to the world wide web before.
  • @DieterKoblenz I agree it is not very clear . I guess that you have to extend the server side part of better presence to support beacons. 

    If you are running a mqtt/Mosquitto broker you can have a look at my owntracks client. The owntracks app for ios/android has Beacon support
    Hmm, interesting. I do have a mqtt broker, but never exposed it to the world wide web before.
    For more info about owntracks , see http://owntracks.org/booklet/
  • Hey,

    I was away for a little while.. :)

    I had some issues with iBeacon, so I didn't include this provider (yet). I'll take another look.
    With better presence it's the other way around, iBeacon needs to be mobile and beacon tracker is device running tracker server.
    You can also use HTTP provider. Other providers are ping, TCP connect & ARP scan.

    Owntracks looks interesting, and also supports HTTP post, which could be connected with HTTP provider.
  • I've been trying to get this working, but I'm stuck now.
    Installed the app on Ubuntu, it runs ok I guess.
    http://192.168.1.20:3000 gives me:
    {"E4:71:85:31:0A:19":{"id":"E4:71:85:31:0A:19","last":1475782377097,"type":"arpscan","ip":"192.168.1.1","vendor":null,"first":1475781416457},"00:17:88:09:D3:E2":{"id":"00:17:88:09:D3:E2","last":1475782377097,"type":"arpscan","ip":"192.168.1.2","vendor":"Philips Lighting BV","first":1475781416457},"00:21:5B:00:29:9E":{"id":"00:21:5B:00:29:9E","last":1475782377097,"type":"arpscan","ip":"192.168.1.4","vendor":"Inotive","first":1475781416457},"7C:2F:80:53:9E:46":{"id":"7C:2F:80:53:9E:46","last":1475782377097,"type":"arpscan","ip":"192.168.1.3","vendor":"Gigaset Communications GmbH","first":1475781416457},"00:09:B0:4A:05:B1":{"id":"00:09:B0:4A:05:B1","last":1475782377097,"type":"arpscan","ip":"192.168.1.5","vendor":"Onkyo Corporation","first":1475781416457},"72:B8:AD:14:20:A0":{"id":"72:B8:AD:14:20:A0","last":1475782377097,"type":"arpscan","ip":"192.168.1.11","vendor":null,"first":1475781416457},"B8:27:EB:52:55:08":{"id":"B8:27:EB:52:55:08","last":1475782377097,"type":"arpscan","ip":"192.168.1.13","vendor":null,"first":1475781416457},"B8:27:EB:EE:77:94":{"id":"B8:27:EB:EE:77:94","last":1475782377097,"type":"arpscan","ip":"192.168.1.14","vendor":null,"first":1475781416457},"B8:27:EB:20:81:01":{"id":"B8:27:EB:20:81:01","last":1475782377097,"type":"arpscan","ip":"192.168.1.15","vendor":null,"first":1475781416457},"E8:AB:FA:11:0C:8A":{"id":"E8:AB:FA:11:0C:8A","last":1475782377097,"type":"arpscan","ip":"192.168.1.6","vendor":null,"first":1475781416457},"00:15:99:8D:E1:62":{"id":"00:15:99:8D:E1:62","last":1475782377097,"type":"arpscan","ip":"192.168.1.8","vendor":"Samsung Electronics Co., LTD","first":1475781416457},"44:85:00:29:1C:DD":{"id":"44:85:00:29:1C:DD","last":1475782377097,"type":"arpscan","ip":"192.168.1.21","vendor":"Intel Corporation","first":1475781416457},"00:04:20:F1:EF:25":{"id":"00:04:20:F1:EF:25","last":1475782377097,"type":"arpscan","ip":"192.168.1.9","vendor":"Slim Devices, Inc.","first":1475781416457},"6C:AD:F8:04:D5:31":{"id":"6C:AD:F8:04:D5:31","last":1475782377097,"type":"arpscan","ip":"192.168.1.10","vendor":"(Unknown) (DUP: 2)","first":1475781416457},"38:94:96:A0:EE:DF":{"id":"38:94:96:A0:EE:DF","last":1475782377097,"type":"arpscan","ip":"192.168.1.26","vendor":null,"first":1475781416457},"80:EA:23:1D:5C:18":{"id":"80:EA:23:1D:5C:18","last":1475782377097,"type":"arpscan","ip":"192.168.1.54","vendor":null,"first":1475781416457},"E8:AB:FA:17:36:0A":{"id":"E8:AB:FA:17:36:0A","last":1475782377097,"type":"arpscan","ip":"192.168.1.7","vendor":null,"first":1475781416457},"5C:F8:A1:A5:1A:A8":{"id":"5C:F8:A1:A5:1A:A8","last":1475782377097,"type":"arpscan","ip":"192.168.1.91","vendor":null,"first":1475781416457},"E8:50:8B:63:77:9D":{"id":"E8:50:8B:63:77:9D","last":1475782377097,"type":"arpscan","ip":"192.168.1.137","vendor":null,"first":1475782256938},"9C:65:B0:02:66:6B":{"id":"9C:65:B0:02:66:6B","last":1475782377097,"type":"arpscan","ip":"192.168.1.165","vendor":null,"first":1475782286962},"AC:5F:3E:5C:97:38":{"id":"AC:5F:3E:5C:97:38","last":1475782377097,"type":"arpscan","ip":"192.168.1.124","vendor":null,"first":1475782377097}}
    But on Homey, everything stays empty. Nothing listed in Status or Providers.

    Any ideas/tips?
  • in homey settings set url "http://192.168.1.20:3000" without trailing space!
    If it doesn't work, check developer tools network tab, when visiting settings page.
  • No trailing space here :)

    This is what I get:




  • Aha, another thing is to configure CORS so Homey app is able to connect to tracker.
    In tracker config add address of Homey to "allowedOrigins".

    Added those common issues to first post.
  • Fire69Fire69 Member
    edited October 2016
    I did that already :)

    [edit]
    Sorry, I'm stupid, I put the IP of my server instead of Homey  :|

    [edit2]
    Hm, still not working though  :'(

    [edit3]
    Thanks for the support!
    Info for other users, if everything seems correct and it still doesn't work, clear your cache  ;)
  • So, it's up and running, but now I'm wondering how to use it...

    There are 2 cards for the When column:  When Presence changed (general or per device).
    If I use those I don't know if somebody left or arrived?
    I'd like to set a boolean when somebody arrives or leaves, but that doesn't seem possible for the moment?
  • There is a "present" true/false token in trigger. you could add condition..
  • Sorry, don't get it... How would that work? What do I do with the token?
Sign In or Register to comment.