Skip to content

Giermann/owfs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A node.js client library to owserver Documentation & protocol specs

Installation

npm install owfs

Examples

First of all you need a connection to a running owserver:

var Client = require("owfs").Client;
var con = new Client(HOST,PORT);

or with the default port 4304

var con = new Client(HOST);

read

Reads a value of the specified path and passes the value to the callback.

con.read("/10.E89C8A020800/temperature", function(err, result){
	console.log(result);
})

write

Writes a value to the specified path and passes the raw owserver message to the callback.

con.write("/10.E89C8A020800/temperature",1,function(err, message){
	console.log(message)
})

Directory listings

According to OWFS message types there are several methods for directory listings. They all have the same argument list but behave a bit different.

Lists all the children of the supplied path as an array passed to the callback.

con.dir("/",function(err, directories){
	console.log(directories);
})

con.dirall("/",function(err, directories){
	console.log(directories);
})

con.get("/",function(err, directories){
	console.log(directories);
})

con.dirallslash("/",function(err, directories){
	console.log(directories);
})

con.getslash("/",function(err, directories){
	console.log(directories);
})

Debug

We are using debug for debugging output. If you are using owfs in your app, start the debug mode like this:

DEBUG=owfs* node app.js

About

A node.js client library to owserver

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 71.0%
  • CoffeeScript 28.7%
  • Shell 0.3%