Created
February 8, 2023 15:06
-
-
Save nakov/8e14c842e072ebaef0ab02e4c27692d2 to your computer and use it in GitHub Desktop.
Shelly Plug: Play with LED
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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