kevinbungeneers / nhc-client

Client to interface with a Niko Home Control installation
MIT License
3 stars 1 forks source link

Niko Home Control Client

Niko Home Control Client or NHC Client for short, allows you to interface with your Home Control installation.

The following features are or will be supported:

Requirements

Installation

npm install nhc-client --save

Usage

Niko's Home Control installation consists of three basic elements: an input, an output and an action. The input could be a sensor or a switch and the output could be the light in your bedroom. The action links the two together: as soon as the input starts the action, the state of your output changes.

The client follows this idea: the actions are loaded from the installation and you can code a virtual input that triggers an action by calling its execute() function.

Example

The following example shows you how to load all the available actions and how to execute a certain one to switch on/off a light:

const HomeControlClient  = require('nhc-client').HomeControlClient;

var client = new HomeControlClient();

client.on('connect', function() {
  client.listActions(function(actions) {
    actions.forEach(function(action) {
        if (action.id == 43) {
          action.execute();
        }
    });
  });
});

client.connect();

Notes

Niko does not provide an API or any official documentation so this client has been reverse engineered, which might mean this project will never be 100% feature-complete. Furthermore, I'm limited to develop the features I have access to so I can't build in support for every possible module Niko offers. If you can contribute to remedy this, please do!