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

dmx-animate-web

v0.1.0

Published

A web interface and api for dmx-animate

Downloads

5

Readme

dmx-animate-web

enter image description here This module acts as a http API and Webinterface to control dmx devices via node-dmx-animate. Please familiarize yourself with the concept of the library, because we'll rely on it here.

Installation

After you've installed dmx-animate install dmx-animate-web with

npm i dmx-animate-web --save

Configuration

Configure dmx-animate, sequences and devices as shown here: node-dmx-animate But add a dmx-animate-web import and create a instance:

const dmxAnimate = require('dmx-animate')
const dmx = new dmxAnimate({
  universes: [
    {name: 'demo', driver: null, serialPath: 'COM7'}
  ]
})
// !important:
const dmxAnimateWeb = require('dmx-animate-web')
const dmxWeb = dmxAnimateWeb(dmx)

var rgbDevice = dmx.addDevice({
	name: 'basic-rgb',
	startChannel: 4,
	channels: ['r','g','b'],
	isRgb: true,
	reactSound: ['r','g','b']
})
dmx.addSequence('demo',function(){
	return rgbDevice.dim([255,255,255],undefined,2000).run()
})

dmx-animate-web(dmx, [config])

  • dmx: The instance the webserver should use
  • config: optional config containing:
    • port: The webservers port
    • https: True or False
    • httpsPort: Seperate Port for https
    • credentials: Object for https credentials
      • key: file path to the key file
      • cert: file path to the certificate file

If you take a glance at the console there should be a similar message like this:

Web server started at localhost:8080

Demo-Interface

I included a demo web interface for the barely usage and control. If you open localhost:8080 or computersIP:8080, a website should load. enter image description here You should see all your defined devices and their channels.

You can click the device names to get a wide view and execute programs from the web interface. isRgb defined devices can be controlled using a color wheel. reactToSound defined device channels can be controlled by the browsers microphone input (sensitivity and dim durations can be altered)

The sequences tab gives you an overview over all defined sequences and you can play them directly.

define Rgb devices

To enable the color wheel, pass isRgb: truein the device define reactSound

Pass an array of channel names that should change on sound peaks: reactSound: ['r','g','b'] Important: In many browsers the microphone is deactivated if the connection is not secure. So if you serve the site to other devices in your local network, consider a https connection.

API

You can access the http api yourself. There are these endpoints: **GET /api/devices **

Returns all devices and groups with this schema:

[
	{
		"name": String,
		"channels": [String],
		"state": {
			"channel":Number
			...
		},
		"programs": [String]
		"reactSound":[String]
	}
]

GET /api/sequences

Returns all sequences with this schema:

[
	{
		"name": String,
		"duration": Number
	}
]

POST /api/runSequence/[name]

Executes the sequence called name. Returns: {"success":Boolean} (optional) Request Body: Array of Arguments

POST /api/stopSequence/[name]

Stops a running sequence called name. Returns: {"success":Boolean}

POST /api/blackout

Blackouts all devices. Returns: {"success":Boolean}

POST /api/device/set

Executes a method on a device, animates it or just sets it's channels to a value.

Request Body:

{
	"name": String,
	"commands": [
		{
			"type": String,
			"args": Array
		}
	]
}

type - The name of a method on the device args - (optional) An Array of Arguments you would pass into the function usually Returns:

{
	"success": Boolean,
	"results": [
		"value": For each command
	]
}

Example:

{
	"name": "basic-rgb",
	"commands": [
		{
			"type": "set",
			"args": [{"r":150,"g": 50, "b": 255}]
		},
		{
			"type": "dim",
			"args": [{"r":255,"g": 150, "b": 0},null,10000]
		},
		{
			"type": "run"
		}
	]
}