the resulting msg.payload is an array containing the data from these three entities, but they aren’t in a logical order. In fact, object 0 is the ac_hold_time, object 1 is the sunday_morning_temp, and object 2 is away_temp.
Since I’m going to be using this array to assign the state values to flow variables, I need to know how to make sure the array is being created the same every time and values aren’t shifting around.
They’re in whatever order Home Assistant sends them to node-red.
You could try sorting the array before doing stuff or figuring out what element is in what position of the array and going about assigning to to a flow variable dependent on that.
Or just do three current-state nodes and assign the output to different msg properties and use one change node to assign them to flow variables.
Another possible solution for you might just be do it all in a function node.
After extracting the values I needed, I ended up using wait delays to ensure the messages were joined in the order I needed them. After testing an inject node, the array was hit or miss on the same order.
On another note, Kermit is teaching me javascript. ;). I don’t know how you know this stuff or figure it out. It’s cryptic, but I’m slowly catching on.