Skip to content

Instantly share code, notes, and snippets.

@nakov
Created February 8, 2023 15:06
Show Gist options
  • Save nakov/8e14c842e072ebaef0ab02e4c27692d2 to your computer and use it in GitHub Desktop.
Save nakov/8e14c842e072ebaef0ab02e4c27692d2 to your computer and use it in GitHub Desktop.
Shelly Plug: Play with LED
function shellyPlugSChangeLEDColor(red, green, blue, brightness) {
let config = {
"config": {
"leds": {
"colors": {
"switch:0": {
"on": {
"rgb": [red, green, blue],
"brightness": brightness
}
}
}
}
}
};
Shelly.call("PLUGS_UI.SetConfig", config);
}
Timer.set(500, true, function() {
let red = Math.round(Math.random() * 100);
let green = Math.round(Math.random() * 100);
let blue = Math.round(Math.random() * 100);
shellyPlugSChangeLEDColor(red, green, blue, 100);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment