-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.js
executable file
·22 lines (19 loc) · 1.06 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
======================OBTAINING YOUR DEVICE ID=============================
//YOU CAN FIND YOUR DEVICE ID BY using the following code
let oAPI = new owletAPI('your username','your password')
oAPI.getDevices().then(function(dp){ console.log(dp) })
//RUN "node example.js" the resulting deviceArray will be displayed (it will contain dsn=deviceid)
*/
var args = process.argv.slice(2);
var owletAPI = require('./owletAPI.js')
let oAPI = new owletAPI('your username','your password','your device id')
var action = args[0]
if (action == 'on') oAPI.setProperty('BASE_STATION_ON','1')
else if (action == 'off') oAPI.setProperty('BASE_STATION_ON','0')
else oAPI.getProperties().then(function(dp){ console.log(JSON.stringify(dp)) })
//oAPI.getDevices().then(function(dp){ console.log(dp) })
//oAPI.getProperties().then(function(dp){ console.log(dp) })
//setProperty('APP_ACTIVE','1').then(function(status){console.log(status)})
//setProperty('BASE_STATION_ON','1').then(function(status){console.log(status)})
//setProperty('BASE_STATION_ON','1').then(function(status){console.log(status)})