# maxcube2

> eq-3 Max! Cube interface for homebridge-platform-maxcube

Latest version **2.2.3** (published 2020-08-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install maxcube2
pnpm add maxcube2
yarn add maxcube2
bun add maxcube2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.3 |
| Published | 2020-08-16 |
| First published | 2018-03-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 37.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Ives De Bruycker |
| Maintainers | normen |
| Keywords | eq-3, eq3, maxcube, thermostat, home, heating, max, elv |

## Links

- npm: https://www.npmjs.com/package/maxcube2
- Repository: https://github.com/normen/maxcube2
- Homepage: https://github.com/normen/maxcube2#readme
- Issues: https://github.com/normen/maxcube2/issues
- npm.io page: https://npm.io/package/maxcube2

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) ^2.17.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.3.4

## Recent versions

- 2.2.3 (latest) — 2020-08-16
- 2.1.1-beta.2 (beta) — 2018-03-11
- 2.2.2 — 2020-03-07
- 2.2.1 — 2019-04-02
- 2.2.0 — 2019-03-25
- 2.1.3 — 2019-01-24
- 2.1.2 — 2018-03-11
- 2.1.1 — 2018-03-11
- 2.1.1-beta.1 — 2018-03-11
- 2.1.0 — 2018-03-10
- 2.1.0-beta.2 — 2018-03-07
- 2.1.0-beta.1 — 2018-03-07
- 2.0.3 — 2018-03-06
- 2.0.2 — 2018-03-06
- 2.0.0 — 2018-03-05

## README

# MaxCube2 [![NPM Version](https://img.shields.io/npm/v/maxcube2.svg)](https://www.npmjs.com/package/maxcube2)

eQ-3 Max! Cube interface library for homebridge-platform-maxcube

This is a fork of the work first started by https://github.com/ivesdebruycker/maxcube

## Introduction
### History
Why this library is called maxcube_2_? Because the maxcube project seemed to be dead without response to issues or PRs for over half a year and I needed it fixed for my homebridge plugin. So I finally decided to continue its legacy as "maxcube2" but then it suddenly got revived. Now I won't change the name of this library anymore and keep this fork for the homebridge-platform-maxcube project - still as a proper merge-able fork of maxcube however.

### Changes from maxcube
- More events (error, device_list etc.)
- Getting device configurations (min/max/eco/comfort temperatures etc.)

The old API didn't change currently so it's a drop-in replacement.

## Example
```
var MaxCube = require('maxcube2');
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
* error
* hello (arg = hello object)
* meta_data (arg = meta data object)
* device_list (arg = list of devices)
* configuration (arg = configuration object for a single device)

## API
### getConnection()
Returns a promise for an active connection.
```
myMaxCube.getConnection().then(function () {
  ..
});
```
### close()
Closes the connection to the Max! Cube immediately (when active).
### disconnect()
Send **q** command to the Max! Cube and Cube will close a connection.
### 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');
  }
});
```

### setSchedule(rf_address, room_id, weekday, temperaturesArray, timesArray)
Set a schedule for a device.

- weekday:           0=mo,1=tu,..,6=su
- temperaturesArray: [19.5,21,..] degrees Celsius (max 7)
- timesArray:        ['HH:mm',..] 24h format (max 7, same amount as temperatures)
- the first time will be the time (from 00:00 to timesArray[0]) that the first temperature is active. Last possibe time of the day: 00:00

---
_Source: https://npm.io/package/maxcube2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
