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

node-rc6

v1.0.1

Published

Small home automation project. Controls Fire TV + Kodi (via adb) and hue lights (via API) using a Harmony One + RC6 USB IR receiver (on a Raspberry Pi).

Downloads

11

Readme

node-rc6

Super small home automation project, that let my Logitech Harmony One control Amazon Fire TV / Kodi Mediacenter and Philips hue lights. Runs on a Raspberry Pi with a noname RC6 USB IR receiver.

RC6 labeled IR receiver simple convert IR commands into keystrokes and is often used in connection with remote controls for Windows Media Center / Kodi / XBMC.

This package uses thouse IR inputs to control various devices in the local network.

Installation

npm install node-rc6

You also need the Android Debug Bridge (adb) as binary[^1].

Usage

You have to create devices, currently Philips hue lights and Android devices (e.g. Amazon Fire TV) are supported. Every RC6 input (even from a normal keyboard) fires an input event. Use the key to send an associated command to a device.

var rc6 = require('node-rc6');

// register devices
var fireTV = rc6.device('adb-shell', '192.168.x.x', './bin/adb');
var hue = rc6.device('hue-api', '192.168.x.x');

// event driven input observation
rc6.on('input', function(key){  
  // key corresponds the key on the keyboard
  if (key === 'enter') {
    // sends a keyevent to the Fire TV
    fireTV.execute('input keyevent KEYCODE_DPAD_CENTER');
  } else if (key === 'k') {
    // try to start Kodi on Fire TV
    fireTV.execute('am start -n org.xbmc.kodi/.Splash');
  } else if (key.match(/[01]/) !== null) {
    // turn hue lights on/off
    hue.on(key === '1');
  }
}).observe();

API

node-rc6 inherits EventEmiter

method | arguments | description -------|-----------|------------ device | string type, string ip, ... | create a new device (s. Devices) observe | void | start the RC6 input observer

Events

event | arguments | description ------|-----------|------------ start | void | observation starts end | void | observation ends (ctrl+c) input | string key | keystorke, key corresponds the name of a key on normal keyboard info | string message, object scope | info messages like child_process output, scope has information around the event, e.g. the returned json from the hue API error | string/Error error, object scope | error reporting, scope has information around the event, e.g. the returned json from the hue API debug | string message, object scope | debug messages, scope has information around the event, e.g. the returned json from the hue API

Devices

adb-shell device('adb-shell', ip, path_to_adb);

Used for Android devices which have network debugging enabled.

method | arguments | description -------|-----------|------------ execute| string command | executes a adb shell command

hue device('hue', ip);

Philips hue lights.

method | arguments | description -------|-----------|------------ on | boolean on| turn lights on/off scene | int num| My hue scene (1..n) bri | char operation, int value | change brightness by value using '=', '+' or '-' operation random| boolean sync, mixed duration, int transition | bring the hue bulbs (simultaneously or separately, use sync) to random colors, every milliseconds or random ms values (e.g. duration => [1000,3000]), use optionally transition to have always the same time for the transition effect (otherwise the transition is permanent)

Status

This is the first implementation. The logging is still silly, only two devices with micro API functionality. But it works perfect for me. No further work planed.

My personal config can be found in `captains-table.js.

Links

[^1]: For my environment I found adb for my Mac in the HOW-TO:Install Kodi on Fire TV (4.1 Setup ADB on Your Host) and for the Raspberry Pi in the xda-developers community.