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.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Presence detection
I've created an app which supports alternative presence detection.
It supports ARP scan, ping, TCP connect and HTTP signaling.
Due Homey security restrictions, this app requires presence app running on other device (such as Raspberry Pi), to collect presence data.
Steps to start using app:
- Configure CORS in presence app config, so Homey app is able to communicate with presence app. Add Homey address (IP) to "allowedOrigins". For example "http://192.168.13.37".
- in Homey app settings, URL must be without trailing slash.
It supports ARP scan, ping, TCP connect and HTTP signaling.
Due Homey security restrictions, this app requires presence app running on other device (such as Raspberry Pi), to collect presence data.
Steps to start using app:
- Install standalone presence app
- Configure presence app (see readme)
- Install Homey app
- Configure Homey app (settings page) set URL to presence app
- Configure CORS in presence app config, so Homey app is able to communicate with presence app. Add Homey address (IP) to "allowedOrigins". For example "http://192.168.13.37".
- in Homey app settings, URL must be without trailing slash.
Comments
I have installed Node and npm
The error I get when I install is as follows
npm ERR! Linux 4.1.18+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! presence-tracker@1.1.0 start: `babel-node bin/presence`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the presence-tracker@1.1.0 start script 'babel-node bin/presence'.
npm ERR! This is most likely a problem with the presence-tracker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node bin/presence
npm ERR! You can get their info via:
npm ERR! npm owner ls presence-tracker
npm ERR! There is likely additional logging output above.
If you could post the steps needed to get this to work on a vanilla raspberryPi it would be a great help
Then when starting the server I get the following:
And the npm debug log gives the following information:
Any idea on how to continue from here. Obviosly there is something wrong with the babel-node dependency.
I'll remove babel dependency in next release.
First install presence app and once confirmed working proceed with Homey app.
Until Homey app is approved install it from Github.
Gonna check it out this evening and will report here if I get this working on a Synology NAS.
presence-tracker -c /var/local/homey/config.json
It complains after a little while:
listening on 3000
module.js:453
throw err;
^
SyntaxError: /var/local/homey/data.json: Unexpected end of input
data.json? That is nowhere mentioned. I can create the file, but that does not change the throw error. What data.json file does it need where and what is supposed to be in it?
[EDIT]
When entering the path to the .js files and creating a blank data.json I get the following error when trying to run the server on my Synology NAS. Any clue?
[EDIT2] Nevermind, my nodejs version is outdated (0.10.0) and I cant update it because my Synology has a ARMv5 architecture. Looks like this is only going to run on newer Synology NAS models with either ARMv6 and up or Intel x86 architectures.
These json files are storage files for persisting tracker data.
storage.path = data.json - persist custom device data
ping.path = provider.ping.json - stores configuration about devices we want to monitor (ping)
tcp-connect.path = provider.tcp-connect.json - stores configuration about devices we want to monitor (TCP connect)
All paths can also be absolute (beginning with /).
I've updated package which should work with (updated) default config file.
Please update with npm install -g presence-tracker
Although you still need node version 4 or greater.
By default only ARP scan auto detects devices. For other providers you need to add devices to tracker.
How can I debug this further? And... should my configured /var/local/homey/data.json still be empty after some interactions with the daemon on port 3000?
And before anyone asks: no, it did not create a systemd script that you can use I chose the old fashioned /etc/init.d/script route to start this daemon.
{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.1.27:3000/.meta","headers":{"Accept":"application/json, text/plain, */*"}},"statusText":""}
This is the message that appears on top of the 'Presence App Url' page. The rpi mentions that the server is listening on port 3000. I've checked that the config.json is writeable.
After I changed the config.json and changed 'homey.local' to the correct IP-adress, the app is working!
I also do not see a data.json being created in the directory i added in the config.json. I see the provider.ping.json and provider.tcp-connect.json, but not the data.json.
- tracker app needs restart after config change
- current application sandbox model does not allow running su binaries
- I'll add GUI for managing provider devices
I got the presence app working on a windows device but for some reason the ARP scan in the app shows nothing but when I run ARP in the command line all devices are present
Can you provide me an output of arpscan and I'll take a look to add windows arpscan support. simply run and provide me the file.
Thanks.
Going to http://<ip>/providers/arpscan gives a 'Not Found'.
But the app still works. If you want to test the presence, make sure to use upper case MAC addresses.
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?
Sietse
There are no devices seen there, i've already restarted the presense app and also the homey.
I think windows doesn't recognize arp-scan only arp..
Don't understand what is the problem with 'Not found'?
@MennoVanGrinsven custom args are not yet supported. added to todo.
@p0nts please check if you have updated 'allowedOrigins' in tracker app (this causes cross origin error in dev. tools).
@willem138 arp-scan is not system default binary. Not sure if there is support for arp-scan in windows.
In general, if you have issues showing presence data in Homey app, in Homey Better Presence settings open Chrome developer tools, refresh page and check network and console tabs for any errors.
@ErikVanDongen I tried to connect to my samsung via your "http://" it showed connection refused. As my samsung has a fixed IP-adress in my network, homey can reach it. Only my samsung refuses acces, as it should. Turning off Wi-Fi on my samsung homey cannot connect or find the IP. Duh....
Now i had a thought, if connection refused was added as a valid value in a flow, Homey would be able to detect a pressence of a person when his/her phone static ip-adress is defined in a flow or variable. Although connection are refused you would be able to create somekind of boolean trigger. Ip-adress is there but the connection is refused = true, and someone (phone) is home. Ip-adress is not there = false, so someone (phone) is not at home.
I know it's a bit of a workaround, but if possible, Homey would be able to detect someone without an account. Perhaps could scan a guestnetwork or defined guest IP's in a DHCP-pool to detect pressences....
Just a thought. Perhaps not even possible.
- installed raspbian
- installed the presence stuff on pi
- updated allowedorigins
- get info from web url
- installed app on homey
- added url to app in homey
- doesnt do much after
- i get not found when i 'reload' the app page in homey.
config.json - that i did with sudo nano config.json
and the web URL results of: http://192.168.1.16:3000/
so what am i doing wrong on the homey app?
maybe FYI but im running homey 0.8.32 currently