led
The sos.hardware.led
API groups together methods for controlling LEDs of the device.
warning
This is currently only supported by Phillips devices.
Methods
setColor()
The setColor()
methods sets the LED color.
setColor(color: string | null): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
color | string | null | Yes | The color to set the LED to, in hexadecimal format (e.g. #FF0000 for red). If null , it will turn off the LED. |
Return value
Returns a promise that resolves when the color is successfully set.
Possible errors
- If the color is not a valid hexadecimal string or is not a string at all.
- If the LED cannot be controlled by the device.
- If any other error occurs while setting the color.
Example
// Set the LED color to red
await sos.hardware.led.setColor('#FF0000');
// Turn off the LED
await sos.hardware.led.setColor(null);
API Example
import { sos } from '@signageos/front-applet';
void sos.onReady(async () => {
await sos.hardware.led.setColor('#00FF00'); // For GREEN light
});