stagehacks / stagehack-sACN

Library for sending and receiving sACN (E1.31) lighting data
Do What The F*ck You Want To Public License
14 stars 4 forks source link

šŸ”Œstagehack-sACN

Simple library for sending and receiving sACN (E1.31) lighting data. It is not the full E1.31 protocol, but should be close enough for most projects.

This library supports

Installation

npm install stagehack-sacn

Sender

const ACNSender = require('stagehack-sACN').Sender;
ACNSender.Start([options]);
var universe = new ACNSender.Universe([universe], [priority]);

Sender Options:

Universe Options:

Example:

const ACNSender = require('stagehack-sACN').Sender;
ACNSender.Start({
    interfaces: ["192.168.0.40"]
});

var sender = new ACNSender.Universe(1, 100);
sender.on("ready", function(){
     // send as an array
    this.send([255, 0, 0, 255]);

    // or send as key-value pairs
    this.send({
        4: 255,
        11: 150,
        301: 155
    });
});

Sender also provides sender.getPossibleInterfaces() which returns a list of all IPv4 network interfaces on the device. Useful for populating a dropdown or other UI.

Receiver

const ACNReceiver = require('stagehack-sACN').Receiver;
ACNReceiver.Start();
var universe = new ACNReceiver.Universe([universe]);

Universe Options:

Example:

const ACNReceiver = require('./../stagehack-sACN').Receiver;
ACNReceiver.Start();

var receiver = new ACNReceiver.Universe(1);
receiver.on("packet", function(packet){
 console.log(packet.getSlots());
});

Packet

Setters:

Getters:

TODO