If you are asking a question, please follow this template:
-
My goal is:
Trying to create a json object in the format state.container[variable].type = value to update a Shadow using dynamic variables.
e.g. state: {“connected”: true, “container”: {“30AEABCD” : {“type” : 12}}} -
My actions are:
In my mjs, I’m initialising state object as follows:
let state = { connected: true, container: {} }
However, I want to dynamically update my Shadow by setting for example:
state.container[Mac].type=12
If I simply do this, it works (but isn’t what I’m looking for):
state.continaer[Mac] = 12
-
The result I see is:
I get an MJS error: MJS callback error: unsupported object type -
My expectation & question is: Please can somebody help me properly initialise the state object to allow me to dynamically add in the type for a specific Mac variable?