Giter Club home page Giter Club logo

dmxnet's Introduction

dmxnet

GitHub release npm GitHub issues GitHub stars GitHub license GitHub last commit Github All Releases npm Travis (.com)

dmxnet is an ArtNet-DMX-sender and receiver for nodejs

Warning: This Libary is not really actively maintained from me at the moment. It probably does work, but PRs might take a time, if merged at all. Feel free to fork if you wanna extend and develop it actively.

Features

  • Send DMX-Data as ArtNet
  • Use multiple senders with different Net, Subnet and Universe-Settings
  • Receive ArtNet-Data
  • Use multiple receivers with different Net, Subnet and Universe
  • Receive ArtPoll and send ArtPollReply (dmxnet is found by other software, e.g. DMX-Workshop)

Contributors

See https://github.com/margau/dmxnet/graphs/contributors

Changelog

Work in Progress Redesigned error handling (@bannsaenger)

v0.9.0 Dependency Updates, added ESTA manufacturer ID (@bannsaenger)

v0.8.0 Dependency Updates, constructor improvement (@soimon)

v0.7.0 Improve logging (thanks to @Patrick-Remy)

v0.6.0 Add typescript definitions (thanks to @she11sh0cked)

v0.5.0 Dependency Updates, add hosts option (thanks to @gaelhuot)

v0.4.0 Added support for receiving ArtDMX packets.

v0.3.0 Added support for base_refresh_interval, add sender.reset()

v0.2.0

Added support for receiving ArtPoll and sending ArtPollReply.

v0.1.3 Improved logging trough use of simple-node-logger

v0.1.2 Added subuni option to sender

v0.1.1 Added prepare channel

v0.1.0 Initital Release, sending ArtDMX working

Installation

How to install latest release:

npm install dmxnet

How to install current development version:

npm install git+https://[email protected]/margau/dmxnet.git

Usage

See example_rx.js and example_tx.js

Include dmxnet lib:

var dmxlib=require('dmxnet');

Create new dmxnet object:

var dmxnet = new dmxlib.dmxnet(options);

Options:

{
  log: { level: 'info' }, // Winston logger options
  oem: 0, // OEM Code from artisticlicense, default to dmxnet OEM.
  esta: 0, // ESTA Manufacturer ID from https://tsp.esta.org, default to ESTA/PLASA (0x0000)
  sName: "Text", // 17 char long node description, default to "dmxnet"
  lName: "Long description", // 63 char long node description, default to "dmxnet - OpenSource ArtNet Transceiver"
  hosts: ["127.0.0.1"], // Interfaces to listen to, all by default
  errFunc: function(err) {
                this.error(`Do some error handling or throw it: ${err.message}, stack: ${err.stack}`);
            }.bind(this) // optional function to handle errors from the library by yourself. If omitted the errors will be thrown by the library
}

Structure

dmxnet works with objects: You can create a new Sender or Receiver-instance at any time, each transmitting or receiving data for a single ArtNet-Universe.

Each combination of net, subnet and universe is possible.

Notes

dmxnet can propagate max. 255 Sender/Receiver-Objects to other nodes. This is a limitation based on the internal structure of ArtPollReply-Packages. You can of course use more Sender/Receiver-Objects, but they won't propagate trough ArtPoll.

Transmitting Art-Net

Create new sender object:

var sender=dmxnet.newSender(options);

Options:

{
  ip: "127.0.0.1", //IP to send to, default 255.255.255.255
  subnet: 0, //Destination subnet, default 0
  universe: 0, //Destination universe, default 0
  net: 0, //Destination net, default 0
  port: 6454, //Destination UDP Port, default 6454
  base_refresh_interval: 1000 // Default interval for sending unchanged ArtDmx
}

Set Channel:

sender.setChannel(channel,value);

Sets channel (0-511) to value (0-255) and transmits the changed values .

Fill Channels

sender.fillChannels(min,max,value);

Sets all channels between min and max (including these) to value and transmits the values.

Prepare Channel:

sender.prepChannel(channel,value);

Prepares channel (0-511) to value (0-255) without transmitting.

Change is transmitted with next

sender.transmit();

call, or the next periodically transmit. Useful for changing lots of channels at once/in parallel from device view.

Transmit:

sender.transmit();

Transmits a new ArtDMX Frame manually.

Reset:

sender.reset();

Resets all channels of this sender object to zero.

Please Note: dmxnet transmits a dmx-frame every 1000ms even if no channel has changed its value!

Receiving Art-Net

Create a new receiver-instance:

var receiver=dmxnet.newReceiver(options);

Options:

{
  subnet: 0, //Destination subnet, default 0
  universe: 0, //Destination universe, default 0
  net: 0, //Destination net, default 0
}

Wait for a new frame:

receiver.on('data', function(data) {
  console.log('DMX data:', data);
});

The receiver is emits an "data"-event each time new values have arrived.

The current values are stored inside the receiver.values-array for polling.

ToDo:

  • Act as Controller (Sending ArtPoll, Receiving ArtPollReply)
  • Maybe support sACN?

Please feel free to contribute!

Credits

Art-Net™ Designed by and Copyright Artistic Licence Holdings Ltd

dmxnet's People

Contributors

bannsaenger avatar claysam75 avatar dependabot[bot] avatar k-yle avatar kev-ac avatar margau avatar patrick-remy avatar she11sh0cked avatar soimon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmxnet's Issues

Support IPv6

Implement IPv6 (v4 only, v6 only or dualstack)

lib will not work when used in a deamon/service

Hi,

The lib wont work on a DietPi linux distro when used in a deamon / service
The logger you use tries to write/open a file and does not have the permisisons to do that.
An uncaught error occurred: Error: ENOENT: no such file or directory, open '/logs/all.log

I do not want to give the service i create any writable access to the filesystem

If i remove the logger instance from the lib it works fine.
I see the lib is in development and it would be nice if you consider to allow disableing the logging to file.

Thanks & Have a nice day

Does this support Unicast?

Currently using MadMapper for testing and when i enable Unicast I stop getting Art-Net data. It sees dmxnet but no data is recieved. Thanks!

Issue with hibas123?

Hi, I've just tried a simple test of the code but seem to get an error from the hibas dependency. Am I doing something wrong with initialising it or is there an issue upstream? I have tried some of the logging options mentioned elsewhere on here with no luck.

Code:

var dmxlib=require('dmxnet');

var dmxnet = new dmxlib.dmxnet({
  verbose: 1, //Verbosity, default 0
  oem: 0, //OEM Code from artisticlicense, default to dmxnet OEM.
  sName: "Eminant DMX", // 17 char long node description, default to "dmxnet"
  lName: "A really good DMX controller function", // 63 char long node description, default to "dmxnet - OpenSource ArtNet Transceiver"
	log: {
    files: false,
    name: "dmxnet"
  }});

var sender=dmxnet.newSender({
  ip: "192.168.0.201", //IP to send to, default 255.255.255.255
  subnet: 0, //Destination subnet, default 0
  universe: 0, //Destination universe, default 0
  net: 0, //Destination net, default 0
  port: 6454, //Destination UDP Port, default 6454
  base_refresh_interval: 1000 // Default interval for sending unchanged ArtDmx
});

sender.fillChannels(1,4,255);
sender.fillChannels(5,7,0);

Error:

C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\node_modules\@hibas123\utils\lib\observable.js:68
        Array.from(this.subscriber.values()).forEach(e => {
                                   ^

TypeError: this.subscriber.values is not a function
    at Observable.send (C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\node_modules\@hibas123\utils\lib\observable.js:68:36)
    at LoggingBase.message (C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\node_modules\@hibas123\logging\out\base.js:257:32)
    at LoggingBase.log (C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\node_modules\@hibas123\logging\out\base.js:96:18)
    at new dmxnet (C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\node_modules\dmxnet\lib.js:45:9)
    at Object.<anonymous> (C:\Users\emina\OneDrive\Escape Room\Subsystems\Host\node_server\dmx_test.js:3:14)

Clarify zero indexed DMX Channel Numbering in Documentation and Error Messages

Something that got me very confused today. I noticed the dmxnet library is using 0-511 which maps to DMX Channel 1 - 512. So for instance the user or coder has to take the user channel 1 and then put that into channel 0 for it to control the correct fixture. Should this not be shifted within the library so that we are passing the correct channels down to the lowest level before transmission ?

Catching errors

Is there a way to catch the errors generated here?

The promise is not returned so the error gets thrown in a stack the client doesn't control.

lib not receiving data

I tried the rx example with node 12.16.1 - everything starts, but I'm not getting any data logs :(

receiver receives only 511 channels

See title. DMX has 512 channels. The following only receives 511 channels.

var receiver=dmxnet.newReceiver({ universe: 0 });
receiver.on('data', function(data) {
  console.log(data.length); // -> 511
});

Use ES6 Classes

I would like to rewrite the library using ES6-Classes for better readability in the next time.

plans for RDM - remote device management ?

This looks like a very interesting repo. do you plan to add RDM in the future? I am hoping to find an option to set DMX addresses and other parameters like PWM frequency, Gamma curves etc via RDM on all attached LED dimmer DMX devices.

I have an Enttec Storm8 artnet device https://www.enttec.com/product/uncategorized/storm-8-8-universe-ethernet-to-dmx-gateway/
and send DMX to these dimmers https://www.sunricher.com/din-rail-mounted-dmx512-decoder-sr-2103din.html#product_tabs_resources

Until now I always set their addresses by hand, but someone showed me how they were able to use a grandMA console https://www.malighting.com/grandma3/ to address all daisy chained dimmers in a sequential order. I assume that was done via RDM. So it should be possible to do without such cancellation console and just use code.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.