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

hue-handler

v2.1.1

Published

This module provides hue managements API.

Downloads

23

Readme

Overview

hue-handler

Install

下記コマンドでモジュールをインストールできます.

You can install the module as following command.

npm i hue-handler

Demo, example

const Hue = require('hue-handler');

////////////////////////////////////////
// test config
let hueKey = '';  // 分かっている場合はここに記述,初めての時は空文字でよい


// Hue受信後の処理
let Huereceived = function(rIP, response, error) {

	console.log('-- recenved');

	if( error ) {
		console.error( 'Error:', error );
		return;
	}

	if( response == 'Linking' ) {
		console.log('Please push Link button.');
	}else{
		console.dir(rIP);
		console.dir(response);
		console.dir(error);
	}
};


( async ()=> {
	try{
		hueKey = await Hue.initialize( hueKey, Huereceived, {debugMode: false} );
	}catch(e){
		hueKey = '';
		console.error('initialize error.');
		console.dir(e);
	}

	if( hueKey != '' ) {  // 接続成功
		// Hue.facilitiesの定期的監視
		Hue.setObserveFacilities( 3000, () => {
			console.log('-- Observe Facilities');
			console.log( JSON.stringify(Hue.facilities, null, '  ') );
		});

		Hue.setState( "/lights/1/state", '{"on":true}' );  // ライトONの例
		await Hue.sleep(3000);
		Hue.setState( "/lights/1/state", '{"on":false}' );  // ライトOFFの例
	}

})();

Data stracture

Hue.facilities is following stracture.

{
  '192.168.2.192': {
    bridge: {
      name: 'Philips hue (192.168.2.192)',
      manufacturer: 'Royal Philips Electronics',
      ipaddress: '192.168.2.192',
      model: [Object],
      version: [Object],
      icons: [Array]
    },
    devices: {
      '1': [Object],
      '3': [Object],
      '4': [Object],
      '6': [Object],
      '7': [Object],
      '8': [Object],
      '9': [Object],
      '10': [Object]
    }
  }
}

API

初期化と受信, 監視, initialize, receriver callback and observation

  • 初期化: Hue.initialize( key = '', callback, debugmode = {debugMode: false} );
// Hue受信後の処理
let Huereceived = function(gwIP, response, error) {

	console.log('-- recenved');

	if( error ) {
		console.error( error );
		return;
	}

	switch( response ) {  // レスポンスを処理
		case 'Linking':
		console.log('Please push Link button.');
		break;

		case 'Canceled':
		console.log('Please push Link button.');
		break;

		default:
		console.log('gwIP:', gwIP);
		console.log('res:', response);
	}
};


// Hue.initialize( hueKey, Huereceived );
hueKey = Hue.initialize( hueKey, Huereceived, {debugMode: true} );
  • 初期化中のキャンセル
Hue.initializeCancel();
  • 監視: Hue.setObserveFacilities( interval, callback )
// Hue.facilitiesの定期的監視
Hue.setObserveFacilities( 3000, () => {
	console.dir( Hue.facilities );
});

Knowhow

{
  '1': {
    state: {
      on: false,
      bri: 254,
      hue: 65104,
      sat: 253,
      effect: 'none',
      xy: [Array],
      ct: 153,
      alert: 'none',
      colormode: 'xy',
      reachable: true
    },
    type: 'Extended color light',
    name: 'Hue Lamp',
    modelid: 'LCT001',
    manufacturername: 'Philips',
    uniqueid: '00:17:88:01:00:e1:0d:0b-0b',
    swversion: '5.127.1.26581'
  },

meta data

Authors

神奈川工科大学 創造工学部 ホームエレクトロニクス開発学科; Dept. of Home Electronics, Faculty of Creative Engineering, Kanagawa Institute of Technology

杉村 博; SUGIMURA, Hiroshi

License

MIT License

-- License summary --
o Commercial use
o Modification
o Distribution
o Private use
x Liability
x Warranty

Using other modules and License

  • このモジュールで使用している、他モジュールとライセンスは下記のようになっています。このリストはlicense-chekerで作製しています。
  • Here is modules and license using this module. The list is extracted by license-checker function.
    • このリストの更新は少し遅いので参考情報程度にしてください。
    • The updating this list is very slow, you can not use to impotant information directly.
license-checker --csv
  • List
"[email protected]","MIT","https://github.com/ajv-validator/ajv"
"[email protected]","MIT","https://github.com/joyent/node-asn1"
"[email protected]","MIT","https://github.com/mcavage/node-assert-plus"
"[email protected]","MIT","https://github.com/alexindigo/asynckit"
"[email protected]","Apache-2.0","https://github.com/mikeal/aws-sign"
"[email protected]","MIT","https://github.com/mhart/aws4"
"[email protected]","MIT","https://github.com/axios/axios"
"[email protected]","BSD-3-Clause","https://github.com/joyent/node-bcrypt-pbkdf"
"[email protected]","MIT","https://github.com/SGrondin/bottleneck"
"[email protected]","Apache-2.0","https://github.com/mikeal/caseless"
"[email protected]","MIT","https://github.com/felixge/node-combined-stream"
"[email protected]","MIT","https://github.com/isaacs/core-util-is"
"[email protected]","MIT","https://github.com/trentm/node-dashdash"
"[email protected]","MIT","https://github.com/felixge/node-delayed-stream"
"[email protected]","MIT","https://github.com/quartzjer/ecc-jsbn"
"[email protected]","MIT","https://github.com/justmoon/node-extend"
"[email protected]","MIT","https://github.com/davepacheco/node-extsprintf"
"[email protected]","MIT","https://github.com/epoberezkin/fast-deep-equal"
"[email protected]","MIT","https://github.com/epoberezkin/fast-json-stable-stringify"
"[email protected]","MIT","https://github.com/follow-redirects/follow-redirects"
"[email protected]","Apache-2.0","https://github.com/mikeal/forever-agent"
"[email protected]","MIT","https://github.com/form-data/form-data"
"[email protected]","MIT","https://github.com/johncrisostomo/get-ssl-certificate"
"[email protected]","MIT","https://github.com/arekinath/node-getpass"
"[email protected]","ISC","https://github.com/ahmadnassri/har-schema"
"[email protected]","MIT","https://github.com/ahmadnassri/node-har-validator"
"[email protected]","MIT","https://github.com/joyent/node-http-signature"
"[email protected]","MIT","https://github.com/Hiroshi-Sugimura/hue-handler.js"
"[email protected]","MIT","https://github.com/hughsk/is-typedarray"
"[email protected]","MIT","https://github.com/rvagg/isstream"
"[email protected]","MIT","https://github.com/andyperlitch/jsbn"
"[email protected]","MIT","https://github.com/epoberezkin/json-schema-traverse"
"[email protected]","AFLv2.1,BSD","https://github.com/kriszyp/json-schema"
"[email protected]","ISC","https://github.com/isaacs/json-stringify-safe"
"[email protected]","MIT","https://github.com/joyent/node-jsprim"
"[email protected]","MIT","https://github.com/lodash/lodash"
"[email protected]","MIT","https://github.com/jshttp/mime-db"
"[email protected]","MIT","https://github.com/jshttp/mime-types"
"[email protected]","ISC","https://github.com/merencia/node-cron"
"[email protected]","Apache-2.0","https://github.com/peter-murray/node-hue-api"
"[email protected]","Apache-2.0","https://github.com/mikeal/oauth-sign"
"[email protected]","MIT","https://github.com/braveg1rl/performance-now"
"[email protected]","MIT","https://github.com/lupomontero/psl"
"[email protected]","MIT","https://github.com/bestiejs/punycode.js"
"[email protected]","BSD-3-Clause","https://github.com/ljharb/qs"
"[email protected]","ISC","https://github.com/request/promise-core"
"[email protected]","ISC","https://github.com/request/request-promise-native"
"[email protected]","Apache-2.0","https://github.com/request/request"
"[email protected]","MIT","https://github.com/feross/safe-buffer"
"[email protected]","MIT","https://github.com/ChALkeR/safer-buffer"
"[email protected]","MIT","https://github.com/joyent/node-sshpk"
"[email protected]","ISC","https://github.com/analog-nico/stealthy-require"
"[email protected]","BSD-3-Clause","https://github.com/salesforce/tough-cookie"
"[email protected]","Apache-2.0","https://github.com/mikeal/tunnel-agent"
"[email protected]","Unlicense","https://github.com/dchest/tweetnacl-js"
"[email protected]","BSD-2-Clause","https://github.com/garycourt/uri-js"
"[email protected]","MIT","https://github.com/uuidjs/uuid"
"[email protected]","MIT","https://github.com/davepacheco/node-verror"
  • Apache-2.0 License is Here. (https://www.apache.org/licenses/LICENSE-2.0)
  • ISC License is Here. (https://opensource.org/licenses/ISC)
  • MIT License is Here. (https://opensource.org/licenses/mit-license.php)
  • BSD-3-Clause is Here. (https://opensource.org/licenses/BSD-3-Clause)
  • AFLv2.1 is Here. (https://spdx.org/licenses/AFL-2.1.html)

Log

  • 2.1.0 定期的な監視いらないので消した
  • 2.0.2 いらないdebugログをとった
  • 2.0.1 監視を1分毎にした。そのうちカスタムできるようにする。
  • 2.0.0 request-promise-nativeがdeprecatedになっているので、base moduleをaxiosに変更する。
  • 1.2.0 setStateのobject対応
  • 1.1.6 debug追加
  • 1.1.5 cancel条件のbug fix
  • 1.1.4 cancelタイミングを増やした
  • 1.1.3 二重禁止の時の戻り値を申請したhueKyeを返却することとした
  • 1.1.2 cancelのときのinitializeの戻り値は''とした
  • 1.1.1 initialize中initializeを禁止
  • 1.1.0 監視をnode-cronにした、cancel機能追加
  • 1.0.0 失敗時のリトライ処理,async/await調整,
  • 0.2.2 setStatus
  • 0.2.1 manage errors
  • 0.2.0 renew stracture
  • 0.1.0 first published
  • 0.0.1 start up