Last active
October 2, 2023 15:17
-
-
Save anttikuuskoski/a8ed556e2eb32c1843b2daac3da2a15c to your computer and use it in GitHub Desktop.
Object.create as used in the plus plug illuminator, is used to copy and modify a subobject - works on 0.14.4
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 reportConfigError(res, ec, em) { | |
console.log("Config update error", ec, em); | |
} | |
let onColorConfig = { | |
rgb: [100, 0, 0], | |
// rgb: [0, 0, 100], | |
brightness: 80 | |
}; | |
let uiConfig = Shelly.getComponentConfig("plugs_ui"); | |
uiConfig.leds.colors["switch:0"].on = onColorConfig; | |
let offColorConfig = Object.create( onColorConfig ); | |
offColorConfig.brightness = 20; | |
uiConfig.leds.colors["switch:0"].off = offColorConfig; | |
Shelly.call( "PLUGS_UI.SetConfig", { config: uiConfig}, reportConfigError ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment