Gathering detailed insights and metrics for node-rc6
Gathering detailed insights and metrics for node-rc6
Gathering detailed insights and metrics for node-rc6
Gathering detailed insights and metrics for node-rc6
npm install node-rc6
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
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.
1npm install node-rc6
You also need the Android Debug Bridge (adb) as binary1.
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.
1var rc6 = require('node-rc6'); 2 3// register devices 4var fireTV = rc6.device('adb-shell', '192.168.x.x', './bin/adb'); 5var hue = rc6.device('hue-api', '192.168.x.x'); 6 7// event driven input observation 8rc6.on('input', function(key){ 9 // key corresponds the key on the keyboard 10 if (key === 'enter') { 11 // sends a keyevent to the Fire TV 12 fireTV.execute('input keyevent KEYCODE_DPAD_CENTER'); 13 } else if (key === 'k') { 14 // try to start Kodi on Fire TV 15 fireTV.execute('am start -n org.xbmc.kodi/.Splash'); 16 } else if (key.match(/[01]/) !== null) { 17 // turn hue lights on/off 18 hue.on(key === '1'); 19 } 20}).observe();
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 |
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 |
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 |
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) |
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.
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. ↩
No vulnerabilities found.
No security vulnerabilities found.