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

homebridge-globalcache-gc100

v0.1.5

Published

A homebridge plugin for Global Cache GC-100 IR/RS232 bridge

Downloads

6

Readme

homebridge-globalcache-gc100

THIS HOMEBRIDGE PLUGIN IS VERY BETA

I can sucesfully turn my Panasonic Plasma TV and Marantz Stereo on and off by saying "Siri turn the Marantz On" or "Siri turn the Panasonic TV On". This plugin assumes you already have the IR codes or serial commands for your devices that are downstream of your GC100. I would suggest only attempting to use this plugin if you can already control your devices with your GC100!

Installation

Requires homebridge and net

npm -g install homebridge-globalcache-gc100

To Do:

  1. Find a way to implement more than just On/Off service so that its possible to control volume, mute and input
  2. Test more IR devices (e.g. Apple TV)
  3. Support GC100's DC Triggers

About

The goal of this homebridge plugin is to make it possible to turn a TV and/or Stereo on or off with Siri.

The hardware topology looks like this:

iOS Device -> homebridge server -|-> Global Cache 100 IR -> Stereo IR blaster
                                 |-> Global Cache 100 RS232 -> Television serial port

"Siri turn on the Stereo" should then run this code:

var net = require('net');

var HOST = '10.0.1.155';
var IR_PORT = 4998;
var client = new net.Socket();

// Marantz Stereo ON IR command:
var command = 'sendir,4:1,1,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,1200';

client.connect(IR_PORT, HOST, function(){
	console.log('CONNECTED TO: ' + HOST + ':' + IR_PORT);
		// Send the IR command to the GC100
		client.write(command+"\r");
}).on('data', function(data) {
	// log the response from the GC100
	console.log('DATA: ' + data);
	// Close the connection
	client.destroy();
});

In order to achieve this goal, I need to create a new platform for homebridge (https://github.com/nfarina/homebridge)

Configuration

HYPOTHETICAL config.json:

Add this to .homebridge/config.json:

"platforms": [
	{
		"platform": "globalcache-gc100",
		"name": "gc100",
		"host": "10.0.1.155",
		"ir_port": "4998",

		"ir_devices": [
			{ "name": "Marantz Stereo",
				"commands": {
					{"on": "sendir,4:1,1,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,1200"},
					{"off": "sendir,4:1,2,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,64,64,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,64,64,1200"}
				},
				"success_messages" : {
					"on": "completeir,4:1,1",
					"off": "completeir,4:1,2"
				}
			}
		],

		"rs232_devices": [
			{"name": "Panasonic TV",
			"port": "4999",
			"base64_encoded": true,
				"commands": {
					"on" : "AlBPTgM=",
					"off" : "AlBPRgM="
				},
				"success_messages" : {
					"on" : "AlBPTgM=",
					"off" : "AlBPRgM="
				}
			}
		]
	}
]

Config file Notes:

  1. success_message is the data that the GC100 should send back to this plugin if the command is received and understood by the GC100. This is how Siri knows to respond "yes it worked" or "no, there was a problem"
  2. There is an issue specifying control characters such as \x02 or \x03 (STX or ETX) in the homebridge config.json file. I had to implement a workaround by base64 encoding the RS232 commands. See base64_encoder.js and https://github.com/nfarina/homebridge/issues/441
  3. There is a unique port for each RS232 device, but only one port for all IR devices - that's why the port # is specified separately.
  4. Siri responds to the "Name" you specify for each device.

Support

Contact me on slack!

I'm a member of https://homebridgeteam.slack.com/messages/plugins/team/