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

labox-tv

v1.0.4

Published

Control and get informations from Labox TV (Numericable)

Downloads

4

Readme

Latest Stable Version Downloads License

Labox TV

Control and get informations from Labox TV (Numericable)

Installation

Via npm :

npm install labox-tv

Usage

Initialization

Replace *.*.*.* with IP adress of labox tv in the line below, if you don't know which ip address to use, you can try websocket.labox instead of IP address.

var labox = require('labox-tv')('*.*.*.*'); 

If you have problems or nothing seems to work, you can start the module in debug mode by adding true in the second parameter, in this mode every action or error will be logged to console.

var labox = require('labox-tv')('*.*.*.*', true); 

Events

Events list

The module exposes several events in order to have information available in real time :

  • open : Triggered when the module successfully connects to Labox, empty data
  • close : Triggered when the connection to Labox is lost, empty data
  • power : Triggered when power status changes, returns bool representing current power status
  • volume : Triggered when volume is changed, returns int representing current volume
  • mute : Triggered when sound mute status changes, returns bool representing current mute status
  • program : Triggered when current program changes, returns an object with the following structure:
  { "name": string, "category": string }
  • channel : Triggered when current channel changes, returns an object with the following structure:
  { "name": string, "number": int, "category": string }
  • update : Triggered if any of the above events occurs, returns a full object containing all information with the following structure :
  {
    "power": bool,
    "volume": int,
    "mute": bool,
    "channel": {
      "name": string,
      "number": int,
      "category": string
    },
    "program": {
      "name": string,
      "category": string
    }
  }

Example

// We load the module
var labox = require('labox-tv')('*.*.*.*'); 

// We listen for "volume" events :
labox.on('volume', function(data) {
  // For volume event, data is an integer
  console.log(data);
});

Methods

There are currently two methods available : getInfo and sendButtonEvent :

getInfo()

This method returns a full object containing all information about Labox. The object structure is identical as the object returned by the update event.

sendButtonEvent(int buttonCode)

This method takes the button's ID to send. For example to increase volume :

// We load the module
var labox = require('labox-tv')('*.*.*.*'); 

// We wait for connection to be open and increase volume
labox.on('open', function() {
  labox.sendButtonEvent(labox.buttons.BUTTON_VOLUME_PLUS_KEY_CODE);
});

This method does not return data, once the action button will be taken into account by Labox, you will receive a corresponding event. All available supported button IDs can be found in the file Constants.js.