-
Notifications
You must be signed in to change notification settings - Fork 7
/
api.js
37 lines (35 loc) · 905 Bytes
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*jslint node: true */
module.exports = {
async getLog( { homey, query } )
{
return homey.app.diagLog;
},
async getDetect( { homey, query } )
{
homey.app.getDevices(true);
return homey.app.detectedDevices;
},
async clearLog( { homey, body } )
{
homey.app.diagLog = "";
return "ok";
},
async sendCmd( { homey, body } )
{
var result = await homey.app.GetURL( body.command );
if ( result )
{
let searchData = JSON.parse( result.body );
return searchData;
}
throw new Error( "No Response" );
},
async SendDeviceLog({ homey, body })
{
return homey.app.sendLog('deviceLog', body.email, body.description);
},
async SendInfoLog({ homey, body })
{
return homey.app.sendLog('infoLog', body.email, body.description);
},
};