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

itach

v2.0.1

Published

Simple Node.js module to send commands to GlobalCache iTach devices. Should handle reconnection (if connection lost), resending (on busyIR), etc.. but not abstract away the iTach API.

Downloads

377

Readme

node-itach

Simple Node.js module to send commands to GlobalCache iTach devices. Should handle reconnection (if connection lost), resending (on busyIR), etc.. but not abstract away the iTach API (https://www.globalcache.com/files/docs/API-iTach.pdf).

Note: Only testing with IP2IR device but it should work with any of the itach devices.

Installation

npm install itach --save

Example

var itach = require("itach");

itach.on("connect", async () => {
  console.log("Connected to itach");
  try {
    const result = await itach.send("sendir:..")
  } catch (error) {
    // Some error happened
  }
});

itach.connect({ host: "itach", reconnect: true });

API

All commands are enqueued and are only sent when a connection to an itach device is present. The queue is paused if connection is lost and then resumed when connection is restored.

If iTach is already busy sending IR from another connection it will retry every options.retryInterval until options.sendTimeout is reached.

setOptions(options)

Changes options

Arguments

  • options - (Mandatory) An options Object
    • options.host - (Default: null) Hostname/IP to connect to
    • options.port - (Default: 4998) Port to connect to
    • options.reconnect - (Default: false) Try to reconnect if connection is lost
    • options.reconnectInterval - (Default: 3000) Time (in milliseconds) between reconnection attempts
    • options.connectionTimeout - (Default: 3000) Timeout (in milliseconds) when connection attempt is assumed to be failed. error event will be emitted.
    • options.retryInterval- (Default: 99) Time (in milliseconds) between resending attempts (when busyIR is received)
    • options.sendTimeout - (Default: 500) Time (in milliseconds) after which a sent command will be assumed lost

Examples

itach.setOptions({ host: "itachIP2IR", reconnect: true });

connect(options)

Connects to itach device and optionally changes options before connecting.

Arguments

  • options - An options Object (see setOptions method)

Examples

itach.connect();
itach.connect({ host: "itachIP2IR", reconnect: true });

close(options)

Closes the connection to the itach device. Note: If reconnect is enabled the connection will not stay closed. If you want that you have to pass in { reconnect: false }. Also note: You can change any options.

Example

itach.close();
itach.close({ reconnect: false });

send(data)

Sends a itach api command to be executed.

Arguments

  • data - (Mandatory) String containing a itach command (carriage return not required)

Returns

A promise that will resolve to the result of the sent command.

Example

try {
  const result = await itach.send('sendir,1:1,1,38400,1,1,347,173,22,22,22,65,22,22,22,22,22,65,22,22,22,22,22,22,22,22,22,22,22,65,22,22,22,65,22,65,22,22,22,22,22,22,22,22,22,65,22,22,22,22,22,22,22,22,22,22,22,65,22,65,22,22,22,65,22,65,22,65,22,65,22,65,22,1657')
  console.log(result) // completeir...
} catch (error) {
  // handle error
}

Events

  • connect - Connection to itach has been established and commands will now be sent
  • close - Connection to itach has been closed
  • error - Some error with the socket connection

Example

itach.on("connect", function() {
  // Connection established
});

itach.on("close", function() {
  // Connection closed
});

itach.on("error", function (error) {
  // Error occurred
});

TODO

LINKS

  • API: http://www.globalcache.com/files/docs/API-iTach.pdf