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 🙏

© 2025 – Pkg Stats / Ryan Hefner

honcho

v0.4.4

Published

Abstraction layer for multiple PLC controller interfaces

Readme

honcho

Honcho is a multiple PLC connection manager for Node.JS using nodes7/nodepccc/mcprotocol/mbtcpprotocol or other libraries that use a similar API to those.

Normally Honcho will be called by a program that configures it and subscribes to its polls, like a server that streams PLC data over a Websocket or TCP stream.

Honcho is initially configured by a configuration object and multiple PLC tag files.

First create a tag to address translation file using a text editor:

testplctags.txt should have only one line for the following example to work: MYTAG=DB99,INT0

When you specify tags you need to prefix the tag name with the PLC name and a "/" as a separator. If you specify a default controller, (defaultController object), this will be used by default.

Example application:

var honcho = require('honcho');

config = {
	defaultController: 'TESTPLC',  /* This is optional, if you omit it, you must always prefix tags with the connection_name */
	tagFileDir: '.',
	controllers: [
		{ 
			host: '192.168.1.2',
			connection_name: 'TESTPLC',
			port: 102,
			slot: 1, 	/* See NodeS7 docs - slot 1 for 1200/1500, slot 2 for 300 */
			type: 'nodes7',
  			tagfile: './testplctags.txt' 
		},
		{ 
			host: '192.168.1.2',	
			connection_name: 'TESTPLC2',
			port: 102,
			slot: 1, 	/* See NodeS7 docs - slot 1 for 1200/1500, slot 2 for 300 */
			type: 'nodes7',
  			tagfile: './testplctags.txt'   /* For this example we are pointing to the same file like a second PLC running the same program */
		}
	],

	/* Define one or more tagsets to be subscribed to */
	tagsets: ['status'],

	/* Define one or more tags to be subscribed to */
	tags : {
		'MYTAG':{
		tagsets:['status']
		},
		'TESTPLC2/MYTAG':{
		tagsets:['status']
		}		
	}
};

function readDone(err, vars) {
	console.log(vars);
	// Or stream to a Websocket, etc
}

honcho.configure(config, function(){
	honcho.createSubscription(['MYTAG','TESTPLC2/MYTAG'], readDone, 500);
});

This will log the following every 500ms:

{ MYTAG: 0 } and { 'TESTPLC/MYTAG2': 0 }

API

honcho.configure(config, callback)

Sets up the configuration and calls the callback when done. Please see above for configuration syntax.

honcho.findItem(item, callback)

Retuns the full "item" from the PLC driver in the callback.

honcho.read(tags, callback)

Reads specific tags and runs a callback with their values. Note the callback is called as callback(err, values).

honcho.write(tag, value, callback)

Writes a specific tag and runs an optional callback with the result.

honcho.writeItems(items, callback)

Write any number of tags at once. Given an object mapping a tag name to the desired value. Tags can span multiple controllers on the network. DOES NOT fail on single controller write error unless you call done(err).

honcho.createSubscription(tag array, callback, interval)

Sets up a subscription that will return the values of listed tags every timeout via the callback. Returns a token useful for removing subscriptions. Note the callback is called as callback(err, values).

honcho.removeSubscription(token)

Removes a subscription using a token returned when creating it.