Skip to content

Instantly share code, notes, and snippets.

@anttikuuskoski
Last active October 2, 2023 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anttikuuskoski/a8ed556e2eb32c1843b2daac3da2a15c to your computer and use it in GitHub Desktop.
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
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