The script will detect that one of a list of mac addresses on the network exists to determin that someone is currently connected to the home wifi, which can be used to detect that a person is hom by monitoring that persons mobile phone mac address.
To setup the application you should do the following:
- Make sure nvm is installed on your local machine
- Make sure you have a mqtt broker installed, for example mosquitto mqtt
- clone this repository
- cd into the appropriate folder
- run
mkdir .config - run
cp ./.config.example/config.json ./.config/config.json - Fill in your credentials and other information in the .config/config.json file
- run
nvm use - run
npm run start
This will run the application once and detect that the required mac addresses are present or not, this information is then published to the mqtt topic you have selected
To make this work permanently you should run te application by means of a crontab. For example run crontab -e
Define a proper cron, for example every minute
* * * * * node /path/to/your/dir/app.js
If you want to use this as a sensor in home-assistant, add it to your sensors list like this:
- platform: mqtt
name: "AtHome"
state_topic: "atHome"