A wrapper for lightitup-engine offering useful features
npm install @b-stud/lightitup-serverLight'It Up Server documentation www.b-stud.com.
!Logo
1. Introduction
2. Prerequisites
3. Wiring
4. Installation
5. Usage
5.1 Launching the server
5.2 Access to the interface
6 Features
6.1 Adding light effects to your list
6.2 Priorities
6.3 Automatizing effects with the time scheduler
6.4 Controlling several devices at the same time
7. API
8. License
9. Author
sudo raspi-config
Advanced options choose SPI enable it, save and reboot your device.
git clone this repository or by downloading the archive and extracting it to your device.
cd path/to/lightitup-server
default-config.yml file
sh install-script.sh (It can take a while)
autostart_service to false. Then you will have to manually start the server at each boot.
service lightitup start (or restart or stop)
node /opt/lightitup/dist/index.js
--port HTTP Port of the server
--unsecured Will enforce not creating an HTTPS server
--secured Will enforce to only create a HTTPS server
--secured-port HTTPS Port of the server
--no-audio To not handling the audio signal
--device The audio device interface index
--latency Audio device latency (ms) (e.g. in case of wireless speakers)
`
Note: For a permanent configuration, you should edit the default-config.yml file instead
$3
You are now able to access to interface by browsing to :
http:// (or any HTTP port you set in the config file)
https:// (or any HTTPS port you set in the config file)
You should now see the Light'It Up server interface.
Some basics built-in effects are available by default, in the next section you will learn how to add other effects.
You can try to click on an effect to apply it on the lightstrip.
Note: If colors are inverted then you just have to change SPI.RGB_ORDER parameter in the default-config.yml file and then
restarting the server : service lightitup restart
$3
#### 6.1 Adding light effects to your list
To create effects or used existing presets, do the following process :
- Go to http://www.b-stud.com/lightitup-configurator
- Create and custom your effect using available options
- Then click on Export current effect and click on Copy
- Go back to the server interface and click on New Effect
- Give a unique name to your effect, for example: My custom Green Pulse
- On the config field, paste the effect you have copied from the configurator
- You can also set the optional Default limit time if you want the effect to stop running after a certain time
- You can change the Default priority to give more or less importance to the effect (see explanations below)
- Then click save, you are now able to use this effect.
#### 6.2 Priorities
Let's imagine you have created a sunrise effect that lasts 30 minutes to gently wake up you. Now let's imagine that
you use the HTTP API with a domotic solution (Jeedom, Domoticz..) and you have set up another effect, Red Alert that is set to the lightstrip when
someone opens the entry door. The red alert is of course much more important than the sunrise, so it has to interrupt the sunrise effect.
Then, when the red alert is finished (let say after 10 seconds), the sunrise is able to resume as if it had not been interrupted at all.
That is all the sense of effects priorities. For this scenario we should for example have set the sunrise priority to 0 and the red alert
priority to 1 or anything higher than 0.
#### 6.3 Automatizing effects with the time scheduler
The time scheduler gives a way to repeat launching effects over the time, for example, you could set sunset each day at 7pm,
you could then schedule a Static Blue at 10pm from Monday to Friday, and so on..
To use the scheduler, you just to have to click the "Scheduler" button on the interface.
Then you can very simply setup all you want to.
#### 6.4 Controlling several devices at the same time
Sometimes devices are not close enough to control them with same RPi device, also, you may want to synchronize devices located in different places.
For this purpose, you have to complete the list of the hosts that you want to control inside the default-config.yml file :
SYNCHRONIZED_DEVICES_HOSTS: []
For example you could have something like this :
`yaml
...
SYNCHRONIZED_DEVICES_HOSTS:
- https://mydevice.local:8000
- http://192.168.1.14:7400
# - ... And so on
`
Note that a request coming from the master to a slave won't be forwarded anymore by the slave even if it has itself a completed list
of devices hosts to control.
Please also note that the synchronized control does only concern the effects (un)stacked on the fly, toggling, and resetting options.
7. API
To control your light strip from outside, from a Domotics solution or from any other software able to send HTTP requests,
a simple API is available.
$3
- URL /ping
- Method GET
- Return 200, online
$3
- URL /reset
- Method POST
- Return 200, Reset done
- Header Content-Type: application/json
- Body
`javascript
{
"apply_to_slaves": true|false // // Propagate the effect to slaves devices or not
}
`
$3
- URL /toggle
- Method POST
- Return 200, Toggle done
- Header Content-Type: application/json
- Body
`javascript
{
"apply_to_slaves": true|false // // Propagate the effect to slaves devices or not
}
`
$3
- URL /stack
- Header Content-Type: application/json
- Method POST
- Body
- Header Content-Type: application/json
- Body
`javascript
{
"apply_to_slaves": true|false // // Propagate the effect to slaves devices or not
}
`
$3
- URL /unstack
- Header Content-Type: application/json
- Method POST
- Body
`javascript
{
"priority_min": integer|null, // // If set, the effect currently being played will be unstacked only if it has a priority greater than or equal the value specified
"priority_max": integer|null, // , // If set, the effect currently being played will be unstacked only if it has a priority lesser than or equal the value specified
"apply_to_slaves": true|false // // Propagate the effect to slaves devices or not
}
`
- Return 200, sent or 200, error
$3
- URL /manager
- Method GET
- Return 200, JSON array of the effects list
$3
- URL /manager
- Method POST
- Header Content-Type: application/json
- Body
`javascript
{
"name":"My New Effect",
"config": [], // Array of effects bricks as exported from the configurator
"timeLimit":"", // Leave to null for a forever running effect, set a millisecond value else
"priority":"0" // Any integer value (see above for explanations on priorities)
}
`
- Return 200, done OR 400, An error occurred
$3
- URL /manager/effect-id
- Method PUT
- Header Content-Type: application/json
- Body
`javascript
{
"name":"My New Effect",
"config": [], // Array of effects bricks as exported from the configurator
"timeLimit":"", // Leave to null for a forever running effect, set a millisecond value else
"priority":"0" // Any integer value (see above for explanations on priorities)
}
`
- Return 200, done OR 400, An error occurred
$3
- URL /manager/effect-id
- Method DELETE
- Return 200, done OR 400, Could not delete the effect
$3
- URL /manager/apply/effect-name
- Optional URL parameters priority (integer value), timeLimit` (millisecond time value). These parameters will override the effect settings.