owjs
A client library for the 1-wire server protocol
Last updated 7 years ago by vkfont .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install owjs 
SYNC missed versions from official npm registry.

owjs

node.js client library for 1-wire protocol

It can be used with classic node callbacks or Q promises


var owjs = require('owjs');
var client = new owjs.Client({host:'127.0.0.1'});


client.read('/settings/timeout/directory')
.then(function (result) {
  console.log("Timeout is set to ", result.value.trim());
});


client.list('/')
.then(client.list)
.then(function (result) {
  console.log('All properties of all devices');
  console.log(result);
});


client.write('/05.54F81BE8E78D/PIO', 100).
then(function(){
  console.log('Wrote a value');
});


// this is a special one just to make life easier for me
client.readFamily(10, 'temperature')
.then(function(result){
  console.log("All temperatures");
  console.log(result);
});


// And if you want it can of course be used with standard node
// callback pattern instead of promise.
// Just add a function as the last parameter.
client.list('/', function(err, result){
  if(err){
    return console.error(err);
  }
  console.log("All devices again");
  console.log(result);
});


Current Tags

  • 0.1.1                                ...           latest (7 years ago)

2 Versions

  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • q ~0.9.7
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |