Hi, I have issue where global.get seems to 'regroup' elements of the object.
Here is context value copied out from context panel:
{"group":{"hide":["Tablet_Heat","Tablet_Weather","Tablet_Collector","Tablet_EV","Tablet_Electricity","Tablet_ElectricityP","Tablet_House","Tablet_Pump","Tablet_Carport","Tablet_Workshop","Tablet_Sauna","Tablet_Misc"],"show":["Tablet_Menu"]}}
Here is the object that I get after:
var myArr = global.get("Menu");
msg.payload = myArr;
{"group":{"hide":[],"show":["Tablet_Menu","Tablet_Heat","Tablet_Heat","Tablet_Weather","Tablet_Collector","Tablet_Heat","Tablet_House","Tablet_Heat","Tablet_Weather","Tablet_Collector","Tablet_House","Tablet_Carport","Tablet_Carport","Tablet_Carport"]}}
My code works fine on JS simulator with the original context. What I am missing here? Thanks.
var Show = 'Tablet_Carport';
var myArr = global.get("Menu");
myArr.group.show.push(Show);
var index = myArr.group.hide.indexOf(Show);
myArr.group.hide.splice(index, 1);
msg.payload = myArr;
return msg