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

lirc-client

v2.0.0

Published

Connect to LIRC Daemon (Infrared)

Downloads

78

Readme

lirc-client

npm version Dependency Status Build Status XO code style License

Node.js module to connect to a LIRC daemon.

BREAKING CHANGE in v2.0 - Promises instead of Callbacks

If you prefer using callbacks or want to use Node < 6.12 you can still install the "old" v1.0: npm install [email protected].

Usage

$ npm install lirc-client

const lirc = require('lirc-client')({
  host: '127.0.0.1',
  port: 8765
});

lirc.on('connect', () => {
    lirc.send('VERSION').then(res => {
        console.log('LIRC Version', res);
    });

    lirc.sendOnce('Remote1', 'Key1').catch(error => {
        if (error) console.log(error);
    });
});

lirc.on('receive', function (remote, button, repeat) {
    console.log('button ' + button + ' on remote ' + remote + ' was pressed!');
});

you can also connect to a unix domain socket via path option:

const lirc = require('lirc-client')({
  path: '/var/run/lirc/lircd'
});

API

Lirc

Kind: global class

new module.exports.Lirc([config])

| Param | Type | Default | Description | | --- | --- | --- | --- | | [config] | object | | Configuration object. | | [config.autoconnect] | boolean | true | Automatically connect. | | [config.host] | string | "'127.0.0.1'" | Host running LIRC. | | [config.port] | number | 8765 | Port of running LIRC daemon. | | [config.path] | string | | Path to LIRC socket. | | [config.reconnect] | boolean | true | Automatically reconnect. | | [config.reconnect_delay] | number | 5000 | Delay when reconnecting. |

lirc.send() ⇒ Promise.<array.<string>>

Send a command.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Resulting response from LIRC daemon.

| Param | Type | Description | | --- | --- | --- | | ...args | string | Command to send, or individual parameters. |

lirc.sendOnce(remote, button, [repeat]) ⇒ Promise.<array.<string>>

Tell LIRC to emit a button press.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Response from LIRC.

| Param | Type | Description | | --- | --- | --- | | remote | string | Remote name. | | button | string | Button name. | | [repeat] | number | Number of times to repeat. |

lirc.sendStart(remote, button) ⇒ Promise.<array.<string>>

Tell LIRC to start emitting button presses.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Response from LIRC.

| Param | Type | Description | | --- | --- | --- | | remote | string | Remote name. | | button | string | Button name. |

lirc.sendStop(remote, button) ⇒ Promise.<array.<string>>

Tell LIRC to stop emitting a button press.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Response from LIRC.

| Param | Type | Description | | --- | --- | --- | | remote | string | Remote name. | | button | string | Button name. |

lirc.list([remote]) ⇒ Promise.<array.<string>>

If a remote is supplied, list available buttons for remote, otherwise return list of remotes.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Response from LIRC.

| Param | Type | Description | | --- | --- | --- | | [remote] | string | Remote name. |

lirc.version() ⇒ Promise.<array.<string>>

Get LIRC version from server.

Kind: instance method of Lirc
Returns: Promise.<array.<string>> - Response from LIRC.

lirc.connect() ⇒ Promise

Connect to a running LIRC daemon.

Kind: instance method of Lirc
Returns: Promise - Resolves upon connection to server.

lirc.disconnect() ⇒ Promise

Disconnect from LIRC daemon and clean up socket.

Kind: instance method of Lirc
Returns: Promise - Resolves upon disconnect.

License

MIT © Sebastian Raff