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

jontelldus

v1.0.6

Published

Node wrapper for telldus-core

Downloads

16

Readme

node-jontelldus

Telldus-core wrapper.

Under development, poorly tested. I've used node 5.1.0, but it should compile with node 0.12 and 4 aswell.

Requirements

Telldus-core must be installed.

Methods

| method | description | |--------|-------------| | getDevices(callback(devices)) | get all devices | | addDevice(deviceConfiguration, callback(deviceId) | add a new device | | removeDevice(deviceId, callback(err)) | remove a device | | updateDevice(deviceConfiguration, callback(err, deviceId)) | update a device | | turnOn(deviceId, callback(error)) | send on command to device | | turnOff(deviceId, callback(error)) | send off command to device | | up(deviceId, callback(error)) | send up command to device | | down(deviceId, callback(error)) | send down command to device | | dim(deviceId, level, callback(error)) | send dim command to device | | bell(deviceId, callback(error)) | send bell command to device | | execute(deviceId, callback(error)) | send execute command to device | | stop(deviceId, callback(error)) | send stop command to device | | learn(deviceId, callback(error)) | send learn command for device | | addRawDeviceEventListener(listener(data)) | add a raw device event listener | | addSensorEventListener(listener(sensorEventData)) | add a sensor event listener | | addDeviceEventListener(listener(deviceEventData)) | add a device event listener | | removeRawDeviceEventListener(listener, callback(err)) | remove a raw device event listener | | removeDeviceEventListener(listener, callback(err)) | remove a device event listener | | removeSensorEventListener(listener, callback(err)) | remove a sensor event listener | | sendRawCommand(command, callback(error)) | send raw device command |

Properties

| property | description | |----------|-------------| | sensorValueType | enum with sensor value types (Temperature, Humidity, RainTotal, RainRate, WindDirection, WindAverage, WindGust) | | method | enum with methods (TurnOn, TurnOff, Bell, Toggle, Dim, Execute, Up, Down, Stop) | | errorCode | enum with error codes (NoError, NotFound, PermissionDenied, DeviceNotFound, MethodNotSupported, Communication, ConnectingService, UnknownResponse, Syntax, BrokenPipe, CommunicatingService, Unknown) |

Examples

Code examples is probably better than wall of text.

getDevices

var jtelldus = require('jontelldus');
jtelldus.getDevices((devices) => {
  console.log(devices);
});

addDevice

var jtelldus = require('jontelldus');
var device = {
  name: "Lamp",
  model: "selflearning-switch",
  protocol: "arctech",
  parameters: {
    house: 10,
    unit: 1
  }
};
jtelldus.addDevice(device, (err, deviceId) => {
  if (!err) {
    console.log('Device added. Id = ' + deviceId);
  }
});

removeDevice

var jtelldus = require('jontelldus');

jtelldus.removeDevice(1, (err) => {
  if (!err) {
    console.log('Device 1 removed');
  }
});

updateDevice

var jtelldus = require('jontelldus');
var device = {
  id: 1, // id is required!
  name: 'Blue lamp'
  parameters: {
    house: 10,
    unit: 3
  }
};
jtelldus.updateDevice(device, (err, deviceId) => {
  if (!err) {
    console.log('Device updated. Id = ' + deviceId);
  }
});

turnOn

var jtelldus = require('jontelldus');
jtelldus.turnOn(1, (error) => {
  if (!error) {
    console.log('On sent to device 1');
  }
});

turnOff

var jtelldus = require('jontelldus');
jtelldus.turnOff(1, (error) => {
  if (!error) {
    console.log('Off sent to device 1');
  }
});

up

var jtelldus = require('jontelldus');
jtelldus.up(1, (error) => {
  if (!error) {
    console.log('Up sent to device 1');
  }
});

down

var jtelldus = require('jontelldus');
jtelldus.down(1, (error) => {
  if (!error) {
    console.log('Down sent to device 1');
  }
});

dim

var jtelldus = require('jontelldus');
jtelldus.dim(1, 30, (error) => {
  if (!error) {
    console.log('Dim set to level 30 for device 1');
  }
});

bell

var jtelldus = require('jontelldus');
jtelldus.bell(1, (error) => {
  if (!error) {
    console.log('Bell sent to device 1');
  }
});

execute

var jtelldus = require('jontelldus');
jtelldus.execute(1, (error) => {
  if (!error) {
    console.log('Execute sent to device 1');
  }
});

stop

var jtelldus = require('jontelldus');
jtelldus.stop(1, (error) => {
  if (!error) {
    console.log('Stop sent to device 1');
  }
});

learn

var jtelldus = require('jontelldus');
jtelldus.learn(1, (error) => {
  if (!error) {
    console.log('Learn sent to device 1');
  }
});

addRawDeviceEventListener / removeRawDeviceEventListener

var jtelldus = require('jontelldus');
var listener = (event) => {
  console.log('RAW EVENT', event);
};
jtelldus.addRawDeviceEventListener(listener);
jtelldus.removeRawDeviceEventListener(listener);

addSensorEventListener / removeSensorEventListener

var jtelldus = require('jontelldus');
var listener = (event) => {
  console.log('SENSOR EVENT', event);
};
jtelldus.addSensorEventListener(listener);
jtelldus.removeSensorEventListener(listener);

addDeviceEventListener / removeDeviceEventListener

var jtelldus = require('jontelldus');
var listener = (event) => {
  console.log('DEVICE EVENT', event);
};
jtelldus.addDeviceEventListener(listener);
jtelldus.removeDeviceEventListener(listener);

sendRawCommand

var jtelldus = require('jontelldus');
var command = 'class:command;protocol:waveman;model:codeswitch;house:A;unit:1;method:turnoff;';
jtelldus.sendRawCommand(command, (error) => {
  if (error) {
    console.log(error);
  }
});