npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

telldus-legacy

v0.0.10

Published

node wrapper for telldus-core, based on telldus-core-js

Downloads

8

Readme

telldus-legacy - Node bindings for telldus-core

Latest release is 0.0.10, available at npm using npm install telldus-legacy

NOTE THAT THIS MODULE IS TARGETED AT NODE >= 0.6 and < 0.12.

FOR 0.12 AND LATER USE THE REGULAR "telldus" MODULE.


Installation (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.
    • Windows, Mac: Install Telldus Center -- go here and get the latest version of the appropriate DMG or EXE file and install. Note: You'll need to check "Developer files" during install. You'll also need a version of Visual C++ installed.
    • Linux Ubuntu/Debian prebuilt:
      • Follow general guide at http://developer.telldus.com/wiki/TellStickInstallationUbuntu
      • Install telldus-core and libtelldus-core-dev
    • Arch Linux prebuilt:
      • Install telldus-core
    • Linux source install: http://developer.telldus.com/wiki/TellStickInstallationSource
  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

Installation (From npm):

  1. Install telldus-core and development libraries, choose one of the following four procedures.
    • Windows, Mac: Install Telldus Center -- go here and get the latest version of the appropriate DMG or EXE file and install. Note: You'll need to check "Developer files" during install. You'll also need a version of Visual C++ installed.
    • Linux Ubuntu/Debian prebuilt:
      • Follow general guide at http://developer.telldus.com/wiki/TellStickInstallationUbuntu
      • Install telldus-core library libtelldus-core-dev
    • Arch Linux prebuilt:
      • Install telldus-core
    • Linux source install: http://developer.telldus.com/wiki/TellStickInstallationSource
  2. Install node-gyp npm install node-gyp
  3. Install this module using npm cd yourprojectdirectory npm install telldus-legacy

Basic Usage

Make sure telldusd is running on the same machine.

var telldus = require('telldus-legacy');

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

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'}
  },
  ...
]

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.


Bugs, issues and feature request:

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