Package Exports
- smartthings-phone-presence-sensor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (smartthings-phone-presence-sensor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
smartthings router connection
Description
With this project you can use your router as a presence detector for your phones.
Reads known personal mobile device's MAC address(using DHCP leases) to check each person's presence.
Features
- work without Smartthings hub
- setup outside your network(communicate directly with cloud)
- Presence sensor based on DHCP lease.
- can detect mobile phone in sleep state
- support mikrotik, asus, tplink Supported SmartThings and SmartThings Classic applications
Supported device list:
Asus:
Firmware version should be later than 3.0.0.4.380:
- All 802.11ax line up
- All ROG Rapture line up
- Blue Cave
- BRT-AC828
- RT-AC5300
- RT-AC3100
- RT-AC88U
- RT-AC3200
- RT-AC2900
- RT-AC87U/R
- RT-AC86U
- RT-AC85U
- RT-AC85P
- RT-AC65P
- RT-AC57U
- RT-AC68U/R/P/W/UF
- RT-AC65U
- RT-AC1900
- RT-AC1900P/U
- RT-AC1750
- RT-AC1750 B1
- RT-AC66U/R/W
- RT-AC66U B1
- RT-AC66U+
- RT-AC1300UHP
- RT-AC1200
- RT-AC1200G/HP/G+
- RT-AC58U
- RT-AC57U
- RT-AC56U/R/S
- RT-AC55U
- RT-AC55UHP
- RT-AC53U
- RT-AC53
- RT-AC52U
- RT-AC52U B1
- RT-AC51U
- RT-AC51U+
- RT-ACRH17
- RT-ACRH13
- RT-N66U/R/W
- RT-N18U
- RT-N16
- RT-N14UHP
- RT-N12E B1/C1
- RT-N12HP B1
- RT-N12VP B1
- RT-N12+
- RT-N12+ B1
- RT-N12D1
- DSL-AC68U/R
TpLink: tested on TP-LINK Touch P5 Mikrotik:
- all devices
Installation Steps with Smartthings Hub:
- Install server
curl -sSL https://raw.githubusercontent.com/vzakharchenko/smartthings-phone-presense-sensor/master/install.sh | bash
or
Manual Server Installation Steps
2. open link http:/
4. select router type: asus or tplink or mikrotik
5. set ip(hostname) of router web admin UI
6. set port of router web admin UI (microtik rest API sevice). Default is 80 (microtik: 8728)
7. set login and password of router web admin UI
8. install SmartApp Source
9. Create new device handler
10. Add new SmartApp to SmartThings Classic
11. Assign Phone Mac address to SmartThing Device
12. add more devices if necessary, for this repeat steps 7-10 to do this
13. now you can use Smartthings Device for automation
Installation Steps without Smartthings Hub:
- Install server
curl -sSL https://raw.githubusercontent.com/vzakharchenko/smartthings-phone-presense-sensor/master/install.sh | bash
or
Manual Server Installation Steps
2. open link http:/
4. select router type: asus or tplink or mikrotik
5. set ip(hostname) of router web admin UI
6. set port of router web admin UI (microtik rest API sevice). Default is 80 (microtik: 8728)
7. set login and password of router web admin UI
8. install SmartApp Source
9. Create new device handler
10. Add new SmartApp to SmartThings Classic without Smartthings Hub
11. Assign Phone Mac address to SmartThing Device
12. add more devices if necessary, for this repeat steps 7-10 to do this
13. now you can use Smartthings Device for automation
Installation Outside your network:
- Install server
curl -sSL https://raw.githubusercontent.com/vzakharchenko/smartthings-phone-presense-sensor/master/install.sh | bash
or
Manual Server Installation Steps
2. open link http:/
4. select router type: asus or tplink or mikrotik
5. set ip(hostname) of router web admin UI
6. set port of router web admin UI (microtik rest API sevice). Default is 80 (microtik: 8728)
7. set login and password of router web admin UI
8. install SmartApp Source
9. Create new device handler
10. Add new SmartApp to SmartThings Classic with device name
11. Assign Phone Mac address to SmartThing Device
12. add more devices if necessary, for this repeat steps 7-10 to do this
13. now you can use Smartthings Device for automation
Manual Server Installation Steps:
- setup linux on RaspberryPi https://ubuntu.com/download/iot/raspberry-pi-2-3
- install node.
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs
or
sudo apt-get install snapd
sudo snap install node --channel=14/stable --classic
- install git
sudo apt-get install git
- install pm2
sudo npm i pm2 -g
- add pm2 to autostart
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ${currentUser} --hp ${HOME}
- make directory /opt/app
sudo mkdir -p /opt/app
- make directory /opt/config
- change ownership of /opt/app and /opt/config
sudo chown -R <USER>:<USER> /opt/app
sudo chown -R <USER>:<USER> /opt/config
- checkout project
cd /opt/app
git clone https://github.com/vzakharchenko/https://github.com/vzakharchenko/smartthings-phone-presense-sensor router
- copy config
cp -n /opt/app/router/config/config.json /opt/config/routerConfig.json
- install and build project
cd /opt/app/router
npm i
cd router-ui
npm i
npm build
cd ..
- add poject to pm2
cd /opt/app/router
pm2 start RouterSmartAppServer.js
pm2 save
Router setting
- open link http:/
:5000 - open router Setting tab
- select router type: asus or tplink or mikrotik
- set ip(hostname) of router web admin UI
- set port of router web admin UI (microtik rest API sevice). Default is 80 (microtik: 8728)
- set login and password of router
install SmartApp Source
- open https://graph.api.smartthings.com/location/list with your samsung account
- select your location
- add new smartapp
- select "From Code" insert code from https://raw.githubusercontent.com/vzakharchenko/smartthings-phone-presense-sensor/master/smartapps/WiFi%20%20Presence.groovy
- open App-Setting
- enable oauth in smartapp
- save and publish
install device Handler
- open https://graph.api.smartthings.com/location/list with your samsung account
- select your location
- goto "My Device Handlers" -> "Create New Device Handler"
- select "From Code" insert code from https://raw.githubusercontent.com/vzakharchenko/smartthings-phone-presense-sensor/master/deviceHandler/WifiPresence.groovy
Add a new SmartApp to SmartThings Classic
- install SmartThings Classic
- open "Automation" Tab->"SmartApps" -> "add SmartApp"
- select "My app" category
- add "WiFi Mobile Manager
- set Server IP, port, hub and Presence Sensor Name and click save
Add a new SmartApp to SmartThings Classic without Smartthings Hub
- install SmartThings Classic
- open "Automation" Tab->"SmartApps" -> "add SmartApp"
- select "My app" category
- add "WiFi Mobile Manager
- set Server IP, port and Presence Sensor Name and click save
Add a new SmartApp to SmartThings Classic outside network
- install SmartThings Classic
- open "Automation" Tab->"SmartApps" -> "add SmartApp"
- select "My app" category
- add "WiFi Mobile Manager
- set Presence Sensor Name and click save
Assign Phone Mac address to SmartThing Device
- open link http:/
:5000 - goto Device Tab
- assign network device to Smartthings Device
Remove Mac address from SmartThings Device
- open link http:/
:5000 - goto "SmartThing Devices" Tab
- click "unAssign"
Manually add Integration between SmartApp and nodejs server
- get applicationId and secret from SmartApp
- open smartapp on phone:
or
- open smartapp on smartthing portal:
- open smartapp on phone:
- open link http:/
:5000 - goto "SmartThing Devices" Tab
- set applicationId and secret from step 1, and click "add Device"
Protect Admin UI using keycloak SSO (Optional)
- download keycloak.json from the keycloak admin ui https://www.keycloak.org/docs/latest/securing_apps/.
- save keycloak.json to ./config/keycloak.json
example of keycloak.json
{
"realm": "REALM",
"auth-server-url": "https://localhost:8090/auth",
"ssl-required": "external",
"resource": "testClient",
"credentials": {
"secret": "secret"
},
"confidential-port": 0
}