Code Monkey home page Code Monkey logo

maxcube's Introduction

maxcube

eQ-3 Max! Cube interface library.

For a cli, see maxcube-cli. If you want to integrate your MAX! Cube in node-red, use node-red-node-maxcube.

Example

var MaxCube = require('maxcube');
var myMaxCube = new MaxCube('192.168.1.123', 62910);

myMaxCube.on('connected', function () {
  console.log('Connected');

  myMaxCube.getDeviceStatus().then(function (payload) {
    console.log(payload);
    myMaxCube.close();
  });
});

myMaxCube.on('closed', function () {
  console.log('Connection closed');
});

Events

  • connected
  • closed

API

getConnection()

Returns a promise for an active connection.

myMaxCube.getConnection().then(function () {
  ..
});

close()

Closes the connection to the Max! Cube immediately (when active).

getCommStatus()

Returns the last known communication status (duty cycle & free memory slots).

getDevices()

Returns devices (from cache).

getDeviceInfo()

Returns device info (from cache).

getRooms()

Returns room info (from cache).

getDeviceStatus([rf_address])

Returns a promise with device status of all or specified devices.

myMaxCube.getDeviceStatus().then(function (devices) {
  devices.forEach(function (device) {
    var deviceInfo = myMaxCube.getDeviceInfo(device.rf_address);
    console.log(deviceInfo.device_name + ', ' + deviceInfo.room_name);
    console.log(' temperature: ' + device.temp);
    console.log(' setpoint: ' + device.setpoint);
    console.log(' valve: ' + device.valve);
    console.log(' mode: ' + device.mode);
  });
});

setTemperature(rf_address, degrees, (optional) mode, (only for vacation mode) untilDate)

Set setpoint temperature for specified device and returns a promise.

Possible modes are: 'AUTO', 'MANUAL', 'BOOST' and 'VACATION'. If no mode is given, 'MANUAL' is presumed.

Format untilDate as ISO 8601, e.g. 2019-06-20T10:00:00Z.

myMaxCube.setTemperature('0dd6b5', 18).then(function (success) {
  if (success) {
    console.log('Temperature set');
  } else {
    console.log('Error setting temperature');
  }
});

Related projects

maxcube's People

Contributors

ivesdebruycker avatar mikes7 avatar jakob-gliwa avatar fgather avatar

Watchers

James Cloos avatar Mariusz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.