GithubHelp home page GithubHelp logo

hexagon / node-telldus Goto Github PK

View Code? Open in Web Editor NEW
34.0 11.0 10.0 163 KB

Node bindings for telldus-core

License: Other

JavaScript 41.71% Python 1.85% C++ 56.45%
telldus node-telldus tellstick tellstick-duo tellstick-node

node-telldus's Introduction

telldus - Node bindings for telldus-core

npm version License

Latest release is 1.1.2, available at npm using npm install telldus

Note: Support for Node 0.10 and 0.11 is moved to a separate brach and package, available through npm install telldus-legacy

Table of contents

Installation

From npm

  1. Install telldus-core and development libraries, choose one of the following four procedures.
  2. Install node-gyp npm install node-gyp
  3. Install this module using npm cd yourprojectdirectory npm install telldus

From source

Note that the master branch isn't always top notch. If it doesn't compile, try an older revision or install the stable release

  1. Install telldus-core and development libraries, choose one of the following four procedures.
  2. Clone this project and enter the node-telldus directory cd node-telldus
  3. Install node-gyp npm install node-gyp
  4. Compile this module npm install -g
  5. Link the module to your project cd yourprojectdirectory npm link telldus

Basic Usage

Make sure telldusd is running on the same machine.

var telldus = require('telldus');

telldus.getDevices(function(err,devices) {
  if ( err ) {
    console.log('Error: ' + err);
  } else {
    // A list of all configured devices is returned
    console.log(devices);
  }
});

If you ever get a returnValue from a method like turnOnSync that is not equal to 0 (TELLDUS_SUCCESS) you could check what type of error that is using telldus.getErrorString.

API Overview

Asynchronous method([params...,] callback(err [, value]))
turnOn(id, callback)
turnOff(id, callback)
dim(id, levl, callback)
learn(id, callback)
addDevice(callback)
setName(id, name, callback)
getName(id, callback)
setProtocol(id, name, callback) )
getProtocol(id, callback)
setModel(id, name, callback) )
getModel(id, callback)
getDeviceType(id, callback)
removeDevice(id, callback)
removeEventListener(id, callback)
getErrorString(id, callback)
getNumberOfDevices(callback)
stop(id, callback)
bell(id, callback)
getDeviceId(id, callback)
getDeviceParameter(id, name, val, callback)
setDeviceParameter(id, name, val, callback)
execute(id, callback)
up(id, callback)
down(id, callback)
getDevices(callback)
getSensors(callback)
addDeviceEventListener(callback)
addSensorEventListener(callback)
addRawDeviceEventListener(callback)
Synchronous method(params)
turnOnSync(id)
turnOffSync(id)
dimSync(id, levl)
learnSync(id)
addDeviceSync(callback)
setNameSync(id, name)
getNameSync(id)
setProtocolSync(id, name) )
getProtocolSync(id)
setModelSync(id, name) )
getModelSync(id)
getDeviceTypeSync(id)
removeDeviceSync(id)
removeEventListenerSync(id)
getErrorStringSync(id)
getNumberOfDevicesSync(callback)
stopSync(id)
bellSync(id)
getDeviceIdSync(id)
getDeviceParameterSync(id, name, val)
setDeviceParameterSync(id, name, val)
executeSync(id)
upSync(id)
downSync(id)
getDevicesSync()
getSensorsSync()

Examples

getDevices

Returns an array of device dictionary objects. Only configured devices are returned.

Synchronous version: javascript var devices = telldus.getDevicesSync();

Signature:

telldus.getDevices(function(err,devices) {
  if ( err ) {
    console.log('Error: ' + err);
  } else {
    // The list of devices is returned
    console.log(devices);
  }
});
[
  {
    id: 1,
    name: 'name from telldus.conf',
    methods: [ 'TURNON', 'TURNOFF' ],
    model: 'codeswitch',
    type: 'DEVICE',
    status: {status: 'OFF'}
  },
  ...
]

getSensors

Synchronous version: javascript var devices = telldus.getSensorsSync();

Signature:

telldus.getSensors(function(err,sensors) {
  if ( err ) {
    console.log('Error: ' + err);
  } else {
    // The list of sensors and their values is returned
    console.log(sensors);
  }
});
  { model: 'temperaturehumidity',
    protocol: 'mandolyn',
    id: 41,
    data: [ 
      { type: 'TEMPERATURE',
        value: '17.6',
        timestamp: '2015-12-14 23:33:01' },
      { type: 'HUMIDITY',
        value: '26',
        timestamp: '2015-12-14 23:33:01' } 
    ]
  }

turnOn

Turns a configured device ON.

Synchronous version: javascript var returnValue = turnOnSync(deviceId);

Signature:

telldus.turnOn(deviceId,function(err) {
  console.log('deviceId is now ON');
});

Similar to the command

tdtool --on deviceId

turnOff

Turns a configured device OFF.

Synchronous version: var returnValue = turnOffSync(deviceId);

Signature:

telldus.turnOff(deviceId,function(err) {
  console.log('Device' + deviceId + ' is now OFF');
});

Similar to the command

tdtool --off deviceId

dim

Dims a configured device to a certain level.

Synchronous version: javascript var returnValue = dimSync(deviceId,level);

Signature:

telldus.dim(deviceId, level,function(err) {
  console.log('Device ' + deviceId + ' is now dimmed to level ' + level);
});

addRawDeviceEventListener

Add a listener for raw device events. This is usefull for scanning for devices not yet configured

Signature:

var listener = telldus.addRawDeviceEventListener(function(controllerId, data) {
  console.log('Raw device event: ' + data);
});
  • controllerId: id of receiving controller, can identify the TellStick if several exists in the system.
  • data: A semicolon separated string with colon separated key / value pairs.
'class:command;protocol:arctech;model:selflearning;house:5804222;unit:2;group:0;method:turnon;'

addDeviceEventListener

Add a listener for device events

Signature:

var listener = telldus.addDeviceEventListener(function(deviceId, status) {
  console.log('Device ' + deviceId + ' is now ' + status.name);
});
  • status: is an object of the form:
    {"status": "the status"}

addSensorEventListener

Add a listener for sensor events

Signature:

var listener = telldus.addSensorEventListener(function(deviceId,protocol,model,type,value,timestamp) {
  console.log('New sensor event received: ',deviceId,protocol,model,type,value,timestamp);
});

removeEventListener

Remove a previously added listener.

Synchronous version: javascript var returnValue = telldus.removeEventListenerSync(listener); Signature:

telldus.removeEventListener(listener,function(err) {});

getErrorString

Get the string representation of a return value

Synchronous version: javascript var errStr = telldus.getErrorStringSync(returnValue);

Signature:

var returnValue = telldus.turnOnSync(deviceId);
if(returnValue > 0) {
  telldus.getErrorString(returnValue, function (err, errStr) {
    console.error('turnOn failed for device ' + deviceId + ', error: ' + errStr);
    process.exit(0);
  });
}

License and Credits

This project is licensed under the MIT license and is forked from telldus-core-js (https://github.com/evilmachina/telldus-core-js) by GitHub user evilmachina.

Issues

The sourcecode and bug tracker is hosted on GitHub, https://github.com/Hexagon/node-telldus

node-telldus's People

Contributors

evilmachina avatar gnitset avatar hexagon avatar hugosp avatar jdagerot avatar kmpm avatar marchaos avatar mrose17 avatar msundberg avatar olekenneth avatar plastbox avatar wootapa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-telldus's Issues

Uncaught assertions does not work as usual.

If you run the test below using mocha the fs 'should work like this' shows the uncaught assertion as the failed test.
Telldus does not bubble up that in it's callback, instead mocha complains about a timeout because the code never reaches done().

It has the same effect though, the test fails but it does not show the correct reason.
It would perhaps not matter that much here but it is really unexpected behaviour and not like for example how the fs module behaves.

var should = require('should');
var fs = require('fs');
var telldus = require('..');

describe('testing callbacks', function(){

    it('should work like this', function(done){
        fs.rename('non existing file', 'whatever', function(err){
            should.not.exist(err);
            done();
        });
    });


    it('does like this', function(done){
        telldus.turnOn(9999, function(returnValue){
            returnValue.should.equal(0);
            done();
        })
    });
})

Require testing: New functions getDeviceParameterSync , getDeviceParameter

Get a protocol specific parameter for a device.

Parameters:

intDeviceId The device to query.
strName The name of the parameter to query.
defaultValue    A default value to return if the current parameter hasn't previously been set.

Returns:

The protocol specific parameter specified by strName. The returned string must be freed by calling tdReleaseString().

No really an issue, but a question of best practice

I use
telldus.addDeviceEventListener

to listen on my switches. When for example switch 10 gets triggered I want to turn on three devices. However, for every device I turn on the addDeviceListener is triggered again. Why is this happening, is the device sending it's status to tellstick when the status has changed, or is tellstick triggering itself?

Some async methods does not seem to work as expected.

Things like setNameSync works but not setName or at least it does not work in the sense that I'm able to retrieve the new name within the callback. It will be written to the tellstick.conf.

I have strong suspicions that all similar methods have issues, setProtocol, setModel etc but more testing is needed.

This works and the new name is returned.

    it('setNameSync', function(){
      var setResult = telldus.setNameSync(deviceId, 'Newly created');
      var name = telldus.getNameSync(deviceId);
      name.should.equal('Newly created');
      setResult.should.equal(true, 'set worked but did still return error');
    });

This doesn't work. Even though the call to setName does not generate an error then new name will not be returned by getNameSync.
The assertion that fails is - 'setName did not fail but can not get new values'

    it('setName', function(done){
      telldus.setName(deviceId, 'Newly created2', function(err){
        should.not.exist(err);
        var name = telldus.getNameSync(deviceId);
        name.should.equal('Newly created2', 'setName did not fail but can not get new values');
        done(err);
      });
    });

Until issue #18 is fixed mocha will report this as a timeout error but if you look carefully at the output you will see the 'setName did not fail but can not get new values'

Is the deviceID really working on addSensorEventListener?

UPDATE: My bad. I had to restart (removing batteries) for the new channel to kick in. Sorry for disturbing, please close/delete/vaporise/nuke this issue.

I'm not sure this is an issue, but I don't know other channels where this can be discussed.

Unfortunately I only have two sensors right now. However when an sensorEvent is triggered (using addSensorEventListener) they both identify themselfes with deviceID 135. I have tried changing channel on the sensor but there was no difference.

Lack of issues is an issue!

I'm sure there are a lots of bugs in this wrapper, please report any bug you find so we can fix it in the 0.0.2 release, thanks 👍

Proper testing

I have not found time to properly test each function in this library, is there someone who is up to the task?

Require testing: Several new control functions

stop, bell, up, down, stopSync, bellSync, upSync, downSync, execute, executeSync

All with identical signatures:

Parameters:

intDeviceId The device id to send X to.

Returns:

TELLSTICK_SUCCESS on success or appropriate error code on failure.

Asyncification of all functions

All functions should be async, I'm not sure that the sensor callbacks (to take an example) is fully async. All work is done in the "after-function" instead of the "working-function".

Anyone who actually has som libuv-skills that can check if this is the preferred way of doing things?

I actually tried moving the code to the working-functions, only to get instant segfaults.

Should we "flatten" the device status?

I feels a bit ugly to access the device status as it is right now.

if (device.status.status === 'ON') {
...

What do you guys think about flattening the device object?
So instead of:

{
'name': 'Foo',
'status': {
'status': 'dim',
'level': 100
},
...
}

We do:

{
'name': 'Foo',
'status': 'dim',
'level': 100,
...
}

Tellstick.conf parser

Could it be within this modules scope to include a tellstick.conf parser? I started to look in to what the options are, there are quite many ini/config parsers in the mpm-registry but none seems to understand the tellstick.conf rather strange syntax.

I then started to write my own but that project stalled after a few minutes... :)

Sending two commands at the same time

I don't know if this is an issue for node-telldus or if if it's the core. However if I want to turnon two devices at the same time the last device wont react. I'm running this on a Raspberry Pi.

None of my recievers are trained with my wall mounted senders, instead eveything is handled by my server script. This means that when a sender is triggered my server will first recieve the code for the button and then send out turnOn/turnOff to the devices.

Code:

telldus.turnOnSync(13);
telldus.turnOnSync(14); // This will never happen

I've tried this aswell:

telldus.turnOn(13,function(){
    telldus.turnOn(14, function(){
        console.log("14 turned on");
    });
});

The only, somewhat, working solution is to set a timeOut like this:

console.log("Turning off 14...");
telldus.turnOff(14, function(err){
    console.log("err: " + err);
        setTimeout(function(){
            telldus.turnOff(13, function(err){
                console.log("err: " + err);
                console.log("13 turned off");
                });                             
        }, 2000);
});

telldus-core.h missing

I have tried to install on both linux and windows. Both stops at can not find telldus-core.h that is referenced in telldus.c in the node-gyp build process. What am I doing wrong?

Require testing: New functions getDeviceId, getDeviceIdSync

This function returns the unique id of a device with a specific index.

To get all the id numbers you should loop over all the devices:

int intNumberOfDevices = tdGetNumberOfDevices();
for (int i = 0; i < intNumberOfDevices; i++) {
    int id = tdGetDeviceId( i );
    // id now contains the id number of the device with index of i
}

Parameters:

intDeviceIndex  The device index to query. The index starts from 0.

Returns:

The unique id for the device or -1 if the device is not found.

Update instructions for Windows

The node-gyp relies on older (2010?) C++ compiler to work, few developers have this installed any longer so the installation will fail unless alternative compiler is specified.

Append --msvs_version=2013 to the install command (npm install) to use Visual Studio 2013, or replace with 2012.

npm install telldus --msvs_version=2013

Also add a link to the C++ redist that is required to compile this, with a comment to get the 32-bit version: http://www.microsoft.com/en-us/download/details.aspx?id=40784

Though I'm getting errors still that I really can't find a solution too...

LINK : fatal error LNK1181: cannot open input file 'TelldusCore.lib'

I even tried adding the Telldus-dev path to my PATH environment variables.

Crashes node app

Hi

I get this error several times a day.

node: ../deps/uv/src/unix/threadpool.c:236: uv__queue_done: Assertion `((&(req->loop)->active_reqs == (&(req->loop)->active_reqs)->prev) == 0)' failed.

I use the Tellstick Duo with firmware 12 on a Debian machine.

Require testing: New functions getNumberOfDevices, getNumberOfDevicesSync

This function returns the number of devices configured.

Parameters:

None

Returns:

An integer of the total number of devices configured.

Note:

Even though the documentation don't specifically state that, this function will return a negative integer on any kind of failure (for example non existant tellstick)

Should getXXXX return a err if empty or UNKNOWN?

First let me describe what the sync version does.

If you have a spanking new device that you just added with addDevice and then tries to, for example getNameSync. It will then return an empty string which is sort of correct and in my opinion should NOT be considered as an error in the async version of the same method.

If you try to do getName for an non existing device id you will get the string 'UNKNOWN' back. I would be ok regarding this as an error.

Votes please...

P.S.
I think this is for all string returning methods, if anyone knows anything else then please tell me.

Ready for 0.0.6?

All milestones for 0.0.6 is done, and we are 41 comitts ahead of 0.0.5. Anyone want any more changes before we bump the version?

If i get no vetos before tonight, I'll assume all is clear :)

Node process exits when it should wait for events...

Hi,

I'm trying to listen to Sensor Events, but the node process exits when it (according to me) should wait for events and fire the callback when the sensors send data (temperature etc.).

Code:

var telldus = require('telldus');

var listener = telldus.addSensorEventListener(function(deviceId,protocol,model,type,value,timestamp) {
  console.log('New sensor event received: ',deviceId,protocol,model,type,value,timestamp);
});

console.log('Event listener set up, waiting for events...');

Node exists with return code 0, so it does not look like it crashes or fail in any other way.

Any idea? (or anything i'm missing?)

Raspian Wheezy, old node version.

I don't know if this is something we should care much about, but in the deb-repos for Raspian Wheezy (probably the most used distro for Raspberry Pi), the newest version of node.js is 0.6.19.

How much word would it be to get node-telldus working on that version?

Does not (always) exit on error

When I use this module, my script some times continue even though there's an error. This leaves my application in a weird state. I rather have it crash then continue after error ...

Is this intended? Like is there any flag I can edit to make it exit after errors?

Or is it a bug?

Windows support

Someone familiar to node.js/gyp on windows should modify the bindings.gyp-file and write up some nice installation instructions in the readme.

Should callback signature for async methods be more like node with an 'err' first argument?

I would like the callback signature of the async events be like

callback(err, <something depending on method used>)

Where err should be an Error object with the message taken from ::getErrorString if the returnValue was above 0 and null if everything was ok. Just like you can expect from many other node modules.

I don't know what this would actually take to implement but it could be done as a wrapper in the call in telldus.js

OSX

Hi! Any ideas how to get this working on OS X? :)

There is no "Developer files" check during the install and Visual C++ is Windows only, as far as I know.

I'm getting this error on npm install

  SOLINK_MODULE(target) Release/telldus.node
ld: framework not found TelldusCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/telldus.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 14.1.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/markus/www/homie/node_modules/telldus
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the telldus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls telldus
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 14.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/markus/www/homie
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/markus/www/homie/npm-debug.log
npm ERR! not ok code 0

device.status.level should be an int

device.status.level is a string but from what i can tell it's only used for dimmers and therefore it should be an int so we get a "correct" json response.

level: 64

instead of:

level: "64"

Implementing deviceChangeEvent

The current incarnation of node-telldus only supports three of the existing events, leaving out tdRegisterDeviceChangeEvent(). This event contains, according to the documentation*:

  • device ID
  • changeEvent (added, changed, removed)
  • changeType (name, protocol, model, method)
    ..and a couple of technical things.

I might give implementing it a try myself, as this event would come in quite handy for the project I'm working on.

*http://developer.telldus.se/doxygen/group__core.html#gaf5263a29ca20f66cfa78d2ff2625b388

Problems installing after upgrading node 0.10.41 -> 4.2.6

I'm building a project on Raspberry Pi and Tellstick Duo. I got it working once already, but when continuing forward, I decided to upgrade node from version 0.10.41 to 4.2.6. (As a new module that I wanted to test required node 0.12+ and I could not find a way to upgrade to 0.12)

After the upgrade I'm unable to install the node-telldus.

  1. Updated node, reinstalled everything in my project except telldus module
  2. I installed node-gyp (tried both locally and globally)
  3. Tried to install the telldus module

I keep getting the same error. What am I doing wrong?

arkkis@vatukka ~/valot $ npm install telldus

> [email protected] install /home/arkkis/valot/node_modules/telldus
> node-gyp configure build

make: Entering directory '/home/arkkis/valot/node_modules/telldus/build'
  CXX(target) Release/obj.target/telldus/telldus.o
In file included from /home/arkkis/.node-gyp/4.2.6/include/node/node.h:42:0,
                 from ../telldus.cc:9:
/home/arkkis/.node-gyp/4.2.6/include/node/v8.h:336:1: error: expected unqualified-id before ‘using’
/home/arkkis/.node-gyp/4.2.6/include/node/v8.h:469:1: error: expected unqualified-id before ‘using’
/home/arkkis/.node-gyp/4.2.6/include/node/v8.h:852:1: error: expected unqualified-id before ‘using’
../telldus.cc: In function ‘void telldus_v8::RunCallback(uv_work_t*, int)’:
../telldus.cc:751:5: error: ‘Handle’ was not declared in this scope
../telldus.cc:751:17: error: expected primary-expression before ‘>’ token
../telldus.cc:751:19: error: ‘argv’ was not declared in this scope
../telldus.cc: In function ‘void telldus_v8::SyncCaller(const v8::FunctionCallbackInfo<v8::Value>&)’:
../telldus.cc:1049:5: error: ‘Handle’ was not declared in this scope
../telldus.cc:1049:17: error: expected primary-expression before ‘>’ token
../telldus.cc:1049:19: error: ‘argv’ was not declared in this scope
../telldus.cc: At global scope:
../telldus.cc:1121:11: error: variable or field ‘init’ declared void
../telldus.cc:1121:11: error: ‘Handle’ was not declared in this scope
../telldus.cc:1121:24: error: expected primary-expression before ‘>’ token
../telldus.cc:1121:26: error: ‘exports’ was not declared in this scope
../telldus.cc:1138:1: error: ‘init’ was not declared in this scope
telldus.target.mk:86: recipe for target 'Release/obj.target/telldus/telldus.o' failed
make: *** [Release/obj.target/telldus/telldus.o] Error 1
make: Leaving directory '/home/arkkis/valot/node_modules/telldus/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.1.7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/arkkis/valot/node_modules/telldus
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/arkkis/valot/node_modules/node-gyp.DELETE/package.json'
npm ERR! Linux 4.1.7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "telldus"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp configure build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the telldus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs telldus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls telldus
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/arkkis/valot/npm-debug.log

Unable to install on Windows

Hi

I'm unable to install telldus on Windows. I've tried with both Visual Studio 2013 Express and Visual Studio Community 2015.

The error i'm receiving is this:
`

[email protected] install E:\TestTellstick\node_modules\telldus
node-gyp configure build
E:\TestTellstick\node_modules\telldus>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" configure build ) else (node configure build )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
telldus.cc
..\telldus.cc(166): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(216): error C3861: 'strftime': identifier not found [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(216): error C3861: 'localtime': identifier not found [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(350): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(892): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(893): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(894): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(926): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(927): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
..\telldus.cc(928): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data [E:\TestTellstick\node_modules\telldus\build\telldus.vcxproj]
`

Do you know of any way to get around this?
OS is Windows 10, x64 with Node.JS version 0.12.7, npm -v shows: 2.11.3

LICENSE file missing

I know it's supposed to be MIT but why not make it properly and add a file to the repos?

nodejs segfault error 15 in libuv.so.1.0.0

I get this a lot, like every 30 minute or so when using the NodeJS tulldus module.

$ sudo journalctl --since="2016-11-09 14:43:00" | grep segfault -B 3

Nov 09 15:16:43 Z-MAINFRAME nodejs[4028]: 2016-11-09 (15:16:43_611 debug: sensorEvent: deviceId=135, protocol=temperaturehumidity, model=fineoffset, type=1 value=4.7, timestamp=1478701003
Nov 09 15:16:43 Z-MAINFRAME nodejs[4028]: [206B blob data]
Nov 09 15:16:43 Z-MAINFRAME kernel: show_signal_msg: 91 callbacks suppressed
Nov 09 15:16:43 Z-MAINFRAME kernel: nodejs[4028]: segfault at 7fcfab5708e0 ip 00007fcfab5708e0 sp 00007ffe65ab9ae8 error 15 in libuv.so.1.0.0[7fcfab570000+1000]

Nov 09 15:23:27 Z-MAINFRAME nodejs[4951]: 2016-11-09 (15:23:27_147 debug: sensorEvent: deviceId=151, protocol=temperaturehumidity, model=fineoffset, type=2 value=87, timestamp=1478701407
Nov 09 15:23:27 Z-MAINFRAME nodejs[4951]: [208B blob data]
Nov 09 15:23:32 Z-MAINFRAME nodejs[4951]: 2016-11-09 (15:23:32_517 debug: RAW: class:sensor;protocol:fineoffset;id:183;model:temperaturehumidity;humidity:23;temp:20.6;
Nov 09 15:23:32 Z-MAINFRAME kernel: nodejs[4951]: segfault at 7f889bdcd8e0 ip 00007f889bdcd8e0 sp 00007ffe4201cbe8 error 15 in libuv.so.1.0.0[7f889bdcd000+1000]

Nov 09 15:28:59 Z-MAINFRAME nodejs[5607]: 2016-11-09 (15:28:59_232 debug: RAW: class:sensor;protocol:fineoffset;id:167;model:temperaturehumidity;humidity:25;temp:20.7;
Nov 09 15:28:59 Z-MAINFRAME nodejs[5607]: 2016-11-09 (15:28:59_233 debug: sensorEvent: deviceId=167, protocol=temperaturehumidity, model=fineoffset, type=1 value=20.7, timestamp=1478701739
Nov 09 15:28:59 Z-MAINFRAME nodejs[5607]: [208B blob data]
Nov 09 15:28:59 Z-MAINFRAME kernel: nodejs[5607]: segfault at 7fe826a7c8e0 ip 00007fe826a7c8e0 sp 00007ffe0a2adb48 error 15 in libuv.so.1.0.0[7fe826a7c000+1000]

Nov 09 15:30:11 Z-MAINFRAME nodejs[6177]: [206B blob data]
Nov 09 15:30:11 Z-MAINFRAME nodejs[6177]: 2016-11-09 (15:30:11_684 debug: sensorEvent: deviceId=199, protocol=temperaturehumidity, model=fineoffset, type=2 value=71, timestamp=1478701811
Nov 09 15:30:11 Z-MAINFRAME nodejs[6177]: [206B blob data]
Nov 09 15:30:11 Z-MAINFRAME kernel: nodejs[6177]: segfault at 7fd217d8c8e0 ip 00007fd217d8c8e0 sp 00007ffd5768c5e8 error 15 in libuv.so.1.0.0[7fd217d8c000+1000]

Nov 09 15:31:49 Z-MAINFRAME nodejs[6456]: 2016-11-09 (15:31:49_909 debug: RAW: class:command;protocol:sartano;model:codeswitch;code:0110111000;method:turnon;
Nov 09 15:31:50 Z-MAINFRAME nodejs[6456]: 2016-11-09 (15:31:50_56 debug: RAW: class:command;protocol:arctech;model:selflearning;house:15274990;unit:10;group:0;method:turnoff;
Nov 09 15:31:50 Z-MAINFRAME nodejs[6456]: 2016-11-09 (15:31:50_57 debug: RAW: class:command;protocol:sartano;model:codeswitch;code:0110111000;method:turnon;
Nov 09 15:31:50 Z-MAINFRAME kernel: nodejs[6456]: segfault at 7f5a1a9398e0 ip 00007f5a1a9398e0 sp 00007ffedaba0118 error 15 in libuv.so.1.0.0[7f5a1a939000+1000]

Nov 09 15:52:35 Z-MAINFRAME nodejs[6773]: [206B blob data]
Nov 09 15:52:43 Z-MAINFRAME nodejs[6773]: 2016-11-09 (15:52:43_614 debug: sensorEvent: deviceId=135, protocol=temperaturehumidity, model=fineoffset, type=1 value=4.7, timestamp=1478703163
Nov 09 15:52:43 Z-MAINFRAME nodejs[6773]: [206B blob data]
Nov 09 15:52:43 Z-MAINFRAME kernel: nodejs[6773]: segfault at 7f51a67c78e0 ip 00007f51a67c78e0 sp 00007fff2fd76818 error 15 in libuv.so.1.0.0[7f51a67c7000+1000]

Nov 09 15:57:23 Z-MAINFRAME nodejs[8580]: 2016-11-09 (15:57:23_676 debug: RAW: class:sensor;protocol:fineoffset;id:199;model:temperaturehumidity;humidity:71;temp:5.9;
Nov 09 15:57:23 Z-MAINFRAME nodejs[8580]: 2016-11-09 (15:57:23_677 debug: sensorEvent: deviceId=199, protocol=temperaturehumidity, model=fineoffset, type=1 value=5.9, timestamp=1478703443
Nov 09 15:57:23 Z-MAINFRAME nodejs[8580]: [206B blob data]
Nov 09 15:57:23 Z-MAINFRAME kernel: nodejs[8580]: segfault at 7f9c7f5108e0 ip 00007f9c7f5108e0 sp 00007ffc73143048 error 15 in libuv.so.1.0.0[7f9c7f510000+1000]

$ sudo apt-get install telldus-core
telldus-core is already the newest version (2.1.2-1).

$ npm version
{ telldus: '1.1.0',
npm: '3.5.2',
ares: '1.10.1-DEV',
http_parser: '2.5.0',
icu: '55.1',
modules: '46',
node: '4.2.6',
openssl: '1.0.2g-fips',
uv: '1.8.0',
v8: '4.5.103.35',
zlib: '1.2.8' }

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

Installation fails on node-gyp

Hi,

I am unable to get around this. Tried different node versions and made sure I had recent gcc and g++ versions. Any suggestions?

make: Entering directory '/usr/local/lib/node_modules/telldus/build'
CXX(target) Release/obj.target/telldus/telldus.o
../telldus.cc: In function ‘v8::Localv8::Object telldus_v8::GetSupportedSensorValues(telldus_v8::telldusSensorInternals, v8::Isolate_)’:
../telldus.cc:247:24: error: ‘TELLSTICK_RAINRATE’ was not declared in this scope
if (si.dataTypes & TELLSTICK_RAINRATE) {
^
../telldus.cc:255:24: error: ‘TELLSTICK_RAINTOTAL’ was not declared in this scope
if (si.dataTypes & TELLSTICK_RAINTOTAL) {
^
../telldus.cc:263:24: error: ‘TELLSTICK_WINDDIRECTION’ was not declared in this scope
if (si.dataTypes & TELLSTICK_WINDDIRECTION) {
^
../telldus.cc:271:24: error: ‘TELLSTICK_WINDAVERAGE’ was not declared in this scope
if (si.dataTypes & TELLSTICK_WINDAVERAGE) {
^
../telldus.cc:279:24: error: ‘TELLSTICK_WINDGUST’ was not declared in this scope
if (si.dataTypes & TELLSTICK_WINDGUST) {
^
telldus.target.mk:86: recipe for target 'Release/obj.target/telldus/telldus.o' failed
make: *_* [Release/obj.target/telldus/telldus.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/telldus/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.12.20+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/local/lib/node_modules/telldus
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok

Node method naming convention

I think the methods exposed to node should be named according to the naming convention Node uses.

Ex.

turnOn -> turnOnSync
turnOff -> turnOffSync
dim -> turnOffSync

And the other way:

asyncTurnOn -> turnOn
asyncTurnOff -> turnOff
asyncDim -> dim

I know there are a lot more sync than async methods atm but this gives the developer a good "warning" that the method is synchronous.

Thoughts?

Coding standards, anarchy or order?

What type of coding standards should this project use..

  • tabs or spaces.
  • if spaces 2 or 4.
  • require "use strict"

jshint, jslint or similar with the required settings...
It will save time and tears in the end, I promise...

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.