node red push to array

To push an item to an array in Node-RED, you can use the following steps:

  1. Create an Inject node to trigger the flow.
  2. Add a Function node to generate the item you want to push to the array.
  3. Use a Change node to set the msg.topic to the name of the array.
  4. Connect a Change node to the Function node and set its action to "Change" and its rules to "msg.payload" and "to" the array's name.
  5. Use a Change node to set the msg.payload to the item you want to push.
  6. Finally, connect the last Change node to the array you want to push the item to.