This is what I basically can do without any push() because there is no array being used as part of the naming.
When I want to work with the parameters, I need to get the parameter included.
let Parameters = ["ENERGY.Power", "ENERGY.Today", "ENERGY.Voltage", "ENERGY.Current", "ENERGY.Factor", "ANALOG.Temperature"]
let myValueDeltas = []
for (let parameter of Parameters) {
myValueDeltas.push({ parameter : msg.payload }) // this uses "parameter" as name but should use the value of parameter
msg.ValueDeltas = myValueDeltas
}
return msg;
[{"id":"f6bbb2255bea8924","type":"function","z":"807907a1ba82ffea","name":"function 22","func":"let Parameters = [\"ENERGY.Power\", \"ENERGY.Today\", \"ENERGY.Voltage\", \"ENERGY.Current\", \"ENERGY.Factor\", \"ANALOG.Temperature\"]\nlet myValueDeltas = []\n\nfor (let parameter of Parameters) {\n myValueDeltas.push({ parameter : msg.payload }) // this uses \"parameter\" as name but should use the value of parameter\n msg.ValueDeltas = myValueDeltas\n} \nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":2620,"wires":[["ecea2f597a5493e3"]]},{"id":"92646279f23dd4f1","type":"inject","z":"807907a1ba82ffea","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"25","payloadType":"str","x":420,"y":2630,"wires":[["f6bbb2255bea8924"]]},{"id":"ecea2f597a5493e3","type":"debug","z":"807907a1ba82ffea","name":"debug 332","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":2610,"wires":[]}]