forked from jjtbsomhorst/eu.jeroensomhorst.domoticz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.js
34 lines (31 loc) · 765 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
'use strict';
const Domoticz = require('domoticz');
module.exports = [
{
method: 'POST',
path: 'validate',
fn: function(req,callback){
let args = req.body;
let dm = new Domoticz(args.username,args.password,args.host,args.port);
dm.doLogin().then(()=>{
callback(null,true);
}).catch((error)=>{
callback(error,false);
});
}
},
{
method: 'DELETE',
path: 'logs',
fn: function (req, callback) {
callback(null, true);
}
},
{
method: 'GET',
path: 'logs',
fn: function(req,callback){
callback(null, {"id": "Feature disabled"});
}
}
];