futomi / node-echonet-lite

A Node.js module which allows you to communicate with home appliances supporting the ECHONET Lite protocol.
MIT License
54 stars 17 forks source link

Support for multiple EOJs in one node #1

Closed sowd closed 8 years ago

sowd commented 8 years ago

Hi, I'm trying this library with this ECHONET Lite emulator: http://kadecot.net/blog/1479/

However, this only finds the air-conditioner. I wonder if it is caused by the partial support of multiple objects in one node (IP address).

futomi commented 8 years ago

I'm trying this library with this ECHONET Lite emulator: http://kadecot.net/blog/1479/

The emulator is nice! I tried it.

However, this only finds the air-conditioner. I wonder if it is caused by the partial support of multiple objects in one node (IP address).

Do you ask about the discovery process? This module supports multiple objects in one node.

I tried this code:

var EchonetLite = require('node-echonet-lite');
var el = new EchonetLite({'type': 'lan'});

el.init((err) => {
  if(err) {
    console.log('[ERROR] '+ err.toString());
  } else {
    el.startDiscovery((err, res) => {
      if(err) {
        console.log('[ERROR] ' + err.toString());
        process.exit();
      } else {
        console.log(res['device']['address']);
        console.dir(res['device']['eoj']);
      }
    });
  }
});

setTimeout(() => {
  el.close();
}, 3000);

The result was as follows:

192.168.10.17
[ [ 1, 48, 1 ],
  [ 2, 144, 1 ],
  [ 2, 96, 1 ],
  [ 0, 17, 1 ],
  [ 2, 111, 1 ],
  [ 2, 136, 1 ] ]

As you can see, this module found all EOJs in the emulator. It seems that the emulator has 6 EOJs. Is it right?

Cheers.

sowd commented 8 years ago

Sorry, I did not consider why device['eoj'] is an array (in the 'Quick Start' example.) It is working perfectly.

Thank you for the guidance!

sowd commented 8 years ago

forgot to close the issue again..