2 input messages into 1 output line 1 and line 2?

Hello again
i need to have the input messages to go to the same location every time on output

array 1 night/day
array 2 brightness

im confussed tried to add a dellay to solve it can i do it through function?

[{"id":"b84a7f9a.24408","type":"server-events","z":"cf1115c.2dcd6e8","name":"HA All Events","server":"d0be6c93.2903a","x":270,"y":1320,"wires":[["fd7c9ec6.5f502"]]},{"id":"29e7db9a.11e0a4","type":"function","z":"cf1115c.2dcd6e8","name":"Brightness Value","func":"var temp=msg.payload.event.new_state.attributes.brightness;\nvar msg = {payload:temp};\nmsg.topic = \"brightness\"\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":1320,"wires":[["48d98f79.41b7a","363b56eb.16082a","a435cd2b.f58f9"]]},{"id":"fd7c9ec6.5f502","type":"switch","z":"cf1115c.2dcd6e8","name":"Filter Kitchen lights","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"light.kitchen_lights","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":1320,"wires":[["b8864352.8aa0a"],[]]},{"id":"48d98f79.41b7a","type":"api-current-state","z":"cf1115c.2dcd6e8","name":"","server":"d0be6c93.2903a","halt_if":"","override_topic":false,"override_payload":false,"entity_id":"binary_sensor.sun_up","x":1190,"y":1220,"wires":[["aaeebb7d.751588"]],"outputLabels":["sunnny"]},{"id":"b8864352.8aa0a","type":"rbe","z":"cf1115c.2dcd6e8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":690,"y":1320,"wires":[["29e7db9a.11e0a4","8525153c.c3f018"]]},{"id":"51dc5e5f.29237","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1990,"y":1300,"wires":[]},{"id":"9148ce4e.b341","type":"rbe","z":"cf1115c.2dcd6e8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1590,"y":1320,"wires":[["54d0fcae.af7164"]]},{"id":"54d0fcae.af7164","type":"delay","z":"cf1115c.2dcd6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1760,"y":1320,"wires":[["bd8cdda.f7d072","51dc5e5f.29237"]]},{"id":"363b56eb.16082a","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","x":1840,"y":1200,"wires":[]},{"id":"50646725.16c588","type":"comment","z":"cf1115c.2dcd6e8","name":"Kitchen - Full 30m / Dimming 10s Auto Off 15m","info":"","x":220,"y":1220,"wires":[]},{"id":"8525153c.c3f018","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":890,"y":1240,"wires":[]},{"id":"aaeebb7d.751588","type":"change","z":"cf1115c.2dcd6e8","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"day","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"night","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":1260,"wires":[["b426470c.53a0c8"]]},{"id":"b426470c.53a0c8","type":"delay","z":"cf1115c.2dcd6e8","name":"","pauseType":"delay","timeout":"40","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1290,"y":1260,"wires":[["a435cd2b.f58f9","363b56eb.16082a"]]},{"id":"62495b0d.a79694","type":"change","z":"cf1115c.2dcd6e8","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1590,"y":1260,"wires":[[]]},{"id":"a435cd2b.f58f9","type":"join","z":"cf1115c.2dcd6e8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1470,"y":1320,"wires":[["9148ce4e.b341"]]},{"id":"d0be6c93.2903a","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"dc3135e532cbaf42e85360934d4d6c8db1eff8d668bf130879152a8797022145"}]

message 1

binary_sensor.sun_up : msg.payload : string[3]

"day"

message 2

brightness : msg.payload : number
72

combined

binary_sensor.sun_up : msg.payload : array[2]

array[2]

0: 72

1: "day"

I'm confused as to how the flow you posted relates to the question you asked.
The flow has 3 inputs ( 2 alexa and one MQTT which looks like a switch)
so where does day and brightness come into your flow?

But if you want to direct message 1 and message 2 to different places use a switch node
as one payload is a number you can set a switch to is of type number

Could you be a bit more descriptive? Even lookng at your flow, I don't know whart you want. Explain the issue and use the type/names of nodes you are using in your flow

updated flow wrong one my mistake
sorry

Ok, when you are posting a flow for others to look at you should assume that any nodes - other than the standard flows - are not installed by others asnd you should provice the full node names so they won't have to spend their time figuring out what you have not provided.

You should also try to create the issue with a minimum number of nodes (use inject nodes to inject data from a sensor etc) and provide the platform, os, os release and the NR and node.js versions

1 Like

ok all i need is message 1 and 2 in the same message but in the same location in the message every time
can you help from the information provided?

What are you trying to do with the message afterwards?

Do you need an output message every time a new message either type comes in?
Or only when a new mesage1 or message2 comes in?

only when 1 and 2 come in not either message

then i have other flows working on the payload 1 and payload 2 but need the together in one message

You can use a Join node to combine two message payloads with different topics into a single message containing key/value pairs.

Node-red msgs are javascript objects, so I'm not sure that what you are asking is even relevant, since the order of properies in an object are not guaranteed. Perhaps you are trying to force a sqaure peg into a round hole... can you provide some formatted json examples of one msg that is ok, compared to another that is not what you want?

As Colin mentions, if you are trying to place objects into an specific indexes in a payload array, it would be safer to use named properties in a single key/value object (which the join node will do for you). Just set the msg.topic for each sensor to be the "key" to use as the property name -- then it doesn't matter what order the msgs arrive.