Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the rf_address #8

Open
RalphPungaKronbergs opened this issue Apr 28, 2016 · 11 comments
Open

What's the rf_address #8

RalphPungaKronbergs opened this issue Apr 28, 2016 · 11 comments

Comments

@RalphPungaKronbergs
Copy link

Hi,

on my way to create a homebridge package for Max! Cube I would like to use maxcube, but I can't figure where I get the 'rf_address' for each device of my Max! setup...

Would appreciate any help!

Cheers
Punga

@ivesdebruycker
Copy link
Owner

If you run following code (change ip according to your setup), you should get a list of all connected devices, including their rf-address:

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');
});

Output:

Connected
[ { rf_address: '0aa123',
    initialized: true,
    fromCmd: false,
    error: false,
    valid: true,
    mode: 'MANUAL',
    dst_active: true,
    gateway_known: true,
    panel_locked: false,
    link_error: false,
    battery_low: false,
    valve: 0,
    setpoint: 6,
    temp: 0 },
  { rf_address: '0bb123',
    initialized: true,
    fromCmd: false,
    error: false,
    valid: true,
    mode: 'MANUAL',
    dst_active: true,
    gateway_known: true,
    panel_locked: true,
    link_error: false,
    battery_low: false,
    valve: 100,
    setpoint: 30.5,
    temp: 0 } ]
Connection closed

@RalphPungaKronbergs
Copy link
Author

Thanks for the reply!

Using your script unfortunately there is not connected state rising, although I use the correct IP and Port - both are working with a PHP script that can read MAX! configuration and when I telnet into the MAX! Cube.

Any idea?

@ivesdebruycker
Copy link
Owner

There can only be one connection to the MAX! Cube at the same time.
If you're connected to the cube via the MAX! application or any other way (e.g. a PHP script), you should exit those and try again.

If there's already a connection, you'll get a timeout:

{ [Error: connect ETIMEDOUT 192.168.1.123:62910]
  code: 'ETIMEDOUT',
  errno: 'ETIMEDOUT',
  syscall: 'connect',
  address: '192.168.1.123',
  port: 62910 }
events.js:146
      throw err;

@RalphPungaKronbergs
Copy link
Author

RalphPungaKronbergs commented May 3, 2016

The MAX! Application is not running currently.

Got your code running (placed it somewhere else in the homebridge code), but the result is:

/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-commandparser.js:204
    default: deviceType = EQ3MAX_DEV_TYPE_UNKOWN; break;
                          ^

ReferenceError: EQ3MAX_DEV_TYPE_UNKOWN is not defined
    at Object.decodeDevice (/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-commandparser.js:204:27)
    at Object.parseCommandDeviceList (/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-commandparser.js:171:39)
    at Object.parse (/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-commandparser.js:22:37)
    at MaxCubeLowLevel.<anonymous> (/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube.js:33:46)
    at emitOne (events.js:77:13)
    at MaxCubeLowLevel.emit (events.js:169:7)
    at /Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-lowlevel.js:30:14
    at Array.forEach (native)
    at Socket.<anonymous> (/Users/punga/node_modules/homebridge-maxcube/node_modules/maxcube/maxcube-lowlevel.js:26:16)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:531:20)

Does this help to identify the issue?

Oh, it seems like there is a typo in "EQ3MAX_DEV_TYPE_UNKNOWN" on line 204.
After fixing, your code works! Great!

Thanks for your help!

@ivesdebruycker
Copy link
Owner

Yup, that's a bug, fixed in 67c4694, thanks.
Seems you have an unrecognized device, mind telling what it is?

@RalphPungaKronbergs
Copy link
Author

RalphPungaKronbergs commented May 3, 2016

Sure, it's a MAX! Cube but sold from ELV (www.elv.de), not EQ-3 (although it's absolutely the same). Does this help or do you need some other information?

@ivesdebruycker
Copy link
Owner

If you could give me the submessage length of this device, that would be helpfull.
By temporary changing line 204 in maxcube-commandparser.js to this, it wil print out the length:
default: deviceType = EQ3MAX_DEV_TYPE_UNKNOWN; console.log('Submessage Length: ' + payload[0]); break;

@RalphPungaKronbergs
Copy link
Author

No problem, the output is: 6

@RalphPungaKronbergs
Copy link
Author

Unfortunately I still get an error if trying to set the temperature for an existing device:

maxcube.js:134
  var command = MaxCubeCommandFactory.generateSetTemperatureCommand (rf_address, this.deviceCache[rf_address].room_id, 'MANUAL', degrees);
                                                                                                             ^
TypeError: Cannot read property 'room_id' of undefined

My code is:

          var MaxCubeApi = require('maxcube');   
          deviceId = '12afdd';
           temp = 19;
           var myMaxCube = new MaxCubeApi('192.168.1.31', 62910);

           myMaxCube.on('connected', function () {
          myMaxCube.setTemperature(deviceId, temp).then(function (success) {
                 if (success) {
                    console.log('Temperature set');
                 } else {
                    console.log('Error setting temperature');
                 }
                 myMaxCube.close();
              })
           });         

Do I miss something, like building the device cache first?

BTW: Is it possible to set temp to an wall mounted thermostat? Because the device list shows only
{ rf_address: '0ee83c' }
for a wallthermostat, while the bounded thermostat itself has a more detailed result:

{ rf_address: '12afdd',
    initialized: true,
    fromCmd: false,
    error: false,
    valid: true,
    mode: 'AUTO',
    dst_active: true,
    gateway_known: true,
    panel_locked: false,
    link_error: false,
    battery_low: false,
    valve: 100,
    setpoint: 22.5,
    temp: 0 }

Thanks
Ralph

@ivesdebruycker
Copy link
Owner

Error TypeError: Cannot read property 'room_id' of undefined should be fixed, see #12.

I don't own a wall mounted thermostat, but that should be working after ad94108, see #15.

@tobsch
Copy link

tobsch commented Mar 11, 2017

@RalphPungaKronbergs Feel free to support: https://github.com/tobsch/homebridge-platform-maxcube

I know it's dirty, just hacked my way through...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants