Skip to content

Instantly share code, notes, and snippets.

@anttikuuskoski
Last active October 2, 2023 15:18
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/dd71253aabf9334e9f97b40d55cd1bfc to your computer and use it in GitHub Desktop.
Save anttikuuskoski/dd71253aabf9334e9f97b40d55cd1bfc to your computer and use it in GitHub Desktop.
Object.create works when used to replace a subobject on fw 0.14.4
function reportConfigError(res, ec, em) {
if(ec)
console.log("Config update error", ec, em);
}
let bluConfig = Shelly.getComponentConfig("plugs_ui");
let on = Object.create(bluConfig.leds.colors["switch:0"].on);
on.rgb = [50, 0, 50];
bluConfig.leds.colors["switch:0"].on = on;
Shelly.call( "PLUGS_UI.SetConfig", { config: bluConfig}, reportConfigError );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment