/niko-home-control

Connector for the Niko Home Control API

Primary LanguageJavaScript

Connector for the Niko Home Control API

Init

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.

Usage

Get the list of available locations

niko
  .listLocations()
  .then(function (response) {
    console.log(response);
  });

Get the list of available actions

niko
  .listActions()
  .then(function (response) {
    console.log(response);
  });

Perform an action

niko
  .executeActions(id, value)
  .then(function (response) {
    console.log(response);
  });

Get energy info

niko
  .listEnergy()
  .then(function (response) {
    console.log(response);
  });

Get system info

niko
  .systemInfo()
  .then(function (response) {
    console.log(response);
  });

Reveive energy consumption events

niko.events.on('getlive', (data) => {
  console.log(data, 'live');
});

Reveive actions states events

niko.events.on('listactions', (data) => {
  console.log(data, 'actions');
});