This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@maexle/node-max

0.1.0-dev • Public • Published

maexle/node-max

License Version

node-max is a node.js module to communicate with a eQ3 MAX! Cube.

Installation

npm install @maexle/node-max

Quick Start

var max = require('@maexle/node-max'),
    discover = max.discover();

discover.once('cube', function(c) {
    var cube = c.connect();
    discover.end();

    cube.on('change', function() {
        console.log('\nCube:');
        console.log(cube.toJSON());
    });

    cube.on('room', function(room) {
        console.log('\nRoom: %s', room.name);
        console.log(room.toJSON());
    });

    cube.on('device', function(device) {
        console.log('\nDevice: %s%s', device.name, device.getRoom() ? ' in room ' + device.getRoom().name : '');
        console.log(device.toJSON());
        console.log(device.getConfig().toJSON());
        console.log(device.getStatus().toJSON());
    });

    cube.once('sync', function() {
        cube.close();
    });
});

API

node-max

max.connect([String|Object options])

Connect with a cube knowing it's ip address.

var max = require('@maexle/node-max'),
    cube = max.connect('192.168.0.10');

You can also pass an object instead:

var max = require('@maexle/node-max'),
    cube = max.connect({ip: '192.168.0.10'});

max.discover()

Discover MAX! cubes in your local network. Returns an EventEmitter which fires these events:

  • error: Something went wrong. You should get the error as the first argument.
  • cube: Heey, we found a cube. Answer object described below.
  • end: Discovery closed

The first argument for an cube event looks like this:

{
    "ip": "192.168.0.10",
    "serial": "JEQ0123456",
    "rf": "012EF0",
    "version": "1.1.3",
    "connect": function() {…}
}

Use connect() to get the Cube Instance.

Tests

There are just very few tests, you can run them with

npm test

Copyright and license

Copyright (c) Sebastian Pekarek under the GNU GPL 3.0.

Readme

Keywords

none

Package Sidebar

Install

npm i @maexle/node-max

Weekly Downloads

1

Version

0.1.0-dev

License

GNU GPL 3.0

Last publish

Collaborators

  • maexle