forked from andig/fritzapi
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample-phonelist.js
More file actions
34 lines (27 loc) · 866 Bytes
/
example-phonelist.js
File metadata and controls
34 lines (27 loc) · 866 Bytes
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
/**
* fritzapi - Fritz goes smartHome
*
* AVM SmartHome nodeJS Control - for AVM Fritz!Box and Dect200 Devices
*
* @author Andreas Goetz <cpuidle@gmx.de>
*
* Examples. To use install csv:
* npm install csv
*/
var fritz = require('./index.js');
var csv = require('csv');
var username = DEFINE HERE;
var password = DEFINE HERE;
fritz.getSessionID(username, password).then(function(sid) {
console.log("SID: " + sid);
// function executeCommand(sid, command, ain, options, path)
fritz.executeCommand(sid, null, null, null, "/fon_num/foncalls_list.lua?csv=").then(function(body) {
console.log(body);
// strip first line with delimiter
csv.parse(body.split("\n").slice(1).join("\n"), {
delimiter: ';'
}, function(err, data) {
console.log(JSON.stringify(data));
});
});
});