const niko = require('niko-home-control');
niko.init({
ip: 'xxx.xxx.xxx.xxx',
port: 8000,
timeout: 20000,
events: true
});
events
enables direct events from the controller, such as energy consumption and actions states.
niko
.listLocations()
.then(function (response) {
console.log(response);
});
niko
.listActions()
.then(function (response) {
console.log(response);
});
niko
.executeActions(id, value)
.then(function (response) {
console.log(response);
});
niko
.listEnergy()
.then(function (response) {
console.log(response);
});
niko
.systemInfo()
.then(function (response) {
console.log(response);
});
niko.events.on('getlive', (data) => {
console.log(data, 'live');
});
niko.events.on('listactions', (data) => {
console.log(data, 'actions');
});