npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ics-2000

v1.2.1

Published

A library to control your KAKU devices through the ICS-2000 and read P1 data from ICS-2000

Downloads

65

Readme

ICS-2000 client for NodeJS

Control your KAKU devices connected to the ICS-2000 with this library. If you already have the ICS-2000 and don't have or want Zigbee / 443MHz sender receiver hardware and still want to control your devices using JS, it's possible with this library.

This library supports communication locally (talking direct to the ICS-2000) and remote (through the servers of Trust)

Example usage

const hub = new Hub('your KAKU account e-mail', 'your password');

// Login to get AES key anc MAC-address of your ICS-2000
// Required for almost everything
await hub.login();

// Get all devices stored on your account and find the local IP-address of your ICS-2000 
await hub.getDevices();

// Get the status of each device
await hub.getAllDeviceStatuses();

// Turn device on with entity id 12345
await hub.turnDeviceOnOff(12345, true, 1, false, true);

// Easier way:
const device = hub.devices.find(device => device.name === "My device name");
await device.turnOn();
await device.turnOff();

// Dim to maximal level
await device.dim(255)

// Change color temperature to half of maximal level
await device.changeColorTemperature(300);

By default, all commands are sent directly to the ICS-2000. If you want to send it through the servers of Trust, pass a boolean as extra argument that says whether command should be sent directly to the ICS-2000 or through the servers of Trust.

const hub = new Hub('your KAKU account e-mail', 'your password');
await hub.login();
await hub.getAllDeviceStatuses();
await hub.discoverDevices();

// Easier way:
const device = hub.devices.find(device => device.name === "My device name");

// Turn of and off through the servers of Trust
await device.turnOn(false);
await device.turnOff(false);

// Dim to maximal level using the servers of Trust
await device.dim(255, false)

// Change color temperature to half of maximal level using the servers of Trust
await device.changeColorTemperature(300, false);

Locally VS cloud

Locally is faster as your command doesn't leave the network. But locally only works when connected to your LAN. If you want to send the commands from any other network, you need to send the commands through the servers of Trust (the company behind the brand Klik Aan Klik Uit).

REST server

A REST server written with Express.js is included in this library. It provides an easy way to communicate with your ICS-2000. To build it, clone this repo and run the following commands once in the folder of this repo:

npm install
npm run build

To start the server, run the following:

npm run start:server -- 'e-mail' 'password'

Optionally, provide a port (default port is 8080):

npm run start:server -- 'e-mail' 'password' '8888'

Note that the server only supports controlling devices connected to the account you provided the credentials for when you started the server.

Docker

A Docker-image is provided to run the REST server in a Docker container. To run it, clone this repo and build the image with te following command:

 docker build -t ics-2000 .

Start the container in multi-user mode:

docker run -p 8080:8080 --name ics-2000 ics-2000 

Start the container in single-user mode: Note: Backup IP is required because the hub can't be found from the Docker container

docker run -p 8080:8080 -e EMAIL='[email protected]' -e PASSWORD='password' -e BACKUPIP='192.168.1.12' --name ics-2000 ics-2000