A .Net library that provides a simple API to control Luxafor lighting devices.
$ dotnet add package Reefact.LuxaforLightingDeviceControllerA .Net library that provides a simple API to control Luxafor devices.
Luxafor is a company that designs and sells products for office productivity, such as availability indicators and notification tools.
Their flagship product is an LED availability indicator that can be programmed to display different colors depending on the user's availability status.
Luxafor's goal is to provide users with a simple and effective way to signal their availability to co-workers and improve communication and collaboration in the workplace.
Here is a non-exhaustive list of Luxafor devices:
Luxafor Flag: an LED availability indicator that displays personal availabilityLuxafor Bluetooth: a wireless, software-controlled LED availability indicator that displays notifications and personal availabilityLuxafor Switch: a wireless, remote-controlled availability indicator that displays the availability of meeting rooms and workstations in real timeLuxafor Cube: a standalone LED availability indicator that displays meeting room availabilityLuxafor Pomodoro-Timer: a USB-powered LED timer that divides work into smaller time slots (see Pomodoro)Luxafor Orb: a wide angle USB LED availability indicatorLuxafor CO2 Monitor: a sensor that analyzes the air quality of a room and alerts you when it needs to be ventilatedLuxafor Mute Button: turn on/off the microphone with a single touch and indicate if you are available with the red/greenLuxafor Colorblind Flag: monochrome USB LED availability light eliminates distractions and boosts productivityThese different devices are designed to be driven manually ('mechanical') for some, semi-automatically (manual driving via software) / automatically (integration via software to tools like Teams, Skype, Cisco, Zappier or via Webhook) for others.
This library aims to allow the integration of USB LED devices to your in-house applications without having to go through the Luxafor server (webhook).
It is developed in .Net Core and is based on the library HidLibrairy which allows to enumerate and communicate with HID compatible USB devices in .NET.
The code below presents an example of basic use of the library for the control of a Luxafor Orb device.
[Fact]
public void french_sequence() {
LuxaforDevice orb = Luxafor.GetDevices().First();
for (var i = 0; i < 3; i++) {
orb.SetBasicColor(BasicColor.Blue);
Thread.Sleep(500);
orb.SetBasicColor(BasicColor.White);
Thread.Sleep(500);
orb.SetBasicColor(BasicColor.Red);
Thread.Sleep(500);
orb.SetBasicColor(BasicColor.Off);
Thread.Sleep(1000);
}
}
Line 3 shows how to connect to a single Orb connected to the machine's USB port.
I will quickly go through all the possible commands to send to devices from the LuxaforDevice.
void TurnOff(); // Turns off all the LEDs of the device
void TurnOff(TargetedLeds targetedLeds); // Turn off the targeted LEDs of the device
void SetColor(BrightColor color); // Turns on the device's LEDs in a custom color.
void SetColor(TargetedLeds targetedLeds, BrightColor color); // Turns on the targeted device LEDs in a custom color.
void FadeColor(BrightColor color, FadeDuration duration); // Make a transition from all the LEDs of the device to a custom color
void FadeColor(TargetedLeds targetedLeds, BrightColor color, FadeDuration duration); // Performs a transition from the targeted device LEDs to a custom color
void Strobe(BrightColor color, Speed speed, Repeat repeat); // Flashes all the LEDs of the device in a custom color
void Strobe(TargetedLeds targetedLeds, BrightColor color, Speed speed, Repeat repeat); // Flashes the targeted device LEDs in a custom color
void PlayPattern(WavePattern wavePattern, BrightColor color, Speed speed, Repeat repeat); // Starts a wave pattern that targets all the LEDs of the device based on a custom color
void PlayPattern(BuiltInPattern, Repeat repeat); // Starts an embedded pattern that targets all LEDs on the device
It is possible to create custom commands called LightingCommand so that they can be reused in the code:
var command = LightingCommand.CreateStrobeCommand(TargetedLeds.All, BrightColor.Yellow, Speed.FromByte(20), Repeat.Count(3));
The Send method allows you to use these commands.
void Send(LightingCommand command); // Send a command to the device