Help Required with passing payload and topic

Hello you awesome folks.

Having some trouble with this, please can someone tell me what im doing wrong.
I have been through writing nodes and working with messages Node-Red docs and a few JavaScript informative sites.

I have a status node checking the status of of another node. Depending on the status it returns a payload of "Close" else "open" additional to this it needs a topic of "Control" its function is to control a gate node.

Here is a pic of the setup and the message coming from the debug.

Here is the flow

[{"id":"36595d31.ac5c6a","type":"status","z":"60367313.e04cac","name":"","scope":["abae7ff5.f68b88"],"x":800,"y":1320,"wires":[["959d5020.312ce"]]},{"id":"f35207e9.031418","type":"debug","z":"60367313.e04cac","name":"full message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1270,"y":1220,"wires":[]},{"id":"959d5020.312ce","type":"function","z":"60367313.e04cac","name":"test Message","func":"msg.topic =\"control\"\nif (msg.status.text === \"closed\") \n{\nmsg.payload = \"close\";\nreturn [msg, null];\n} \nelse \n{\nmsg.payload = \"open\";\nreturn [msg, null];\n}","outputs":1,"noerr":0,"x":1060,"y":1320,"wires":[["f35207e9.031418","2798b304.43e8dc"]]},{"id":"2798b304.43e8dc","type":"gate","z":"60367313.e04cac","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1290,"y":1320,"wires":[[]]}]

My issue is is the Gate node is not recognizing the payload or the topic.
I used 2 inject nodes, used string"open" topic control & string "closed" topic control, worked OK.

Can you advise me what I'm doing wrong. This weekend i have completed the internet.

Thank you

Did some further testing and it appears it picks up the "open" payload and changes the status of the gate node.
The "close" payload has no effect. Tried msg.status.payload.

use the tool tips to confirm the location as described here https://nodered.org/docs/user-guide/messages

Is it node-red-contrib-simple-gate that you are using? This works ok for me.

image

[{"id":"4f9819ab.0472d8","type":"debug","z":"514a90a5.c7bae8","name":"full message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":565,"y":267,"wires":[]},{"id":"763c2212.f60844","type":"function","z":"514a90a5.c7bae8","name":"test Message","func":"msg.topic =\"control\"\nif (msg.status.text === \"closed\") \n{\nmsg.payload = \"close\";\nreturn [msg, null];\n} \nelse \n{\nmsg.payload = \"open\";\nreturn [msg, null];\n}","outputs":1,"noerr":0,"x":355,"y":367,"wires":[["4f9819ab.0472d8","657dc65b.59c1a8"]]},{"id":"657dc65b.59c1a8","type":"gate","z":"514a90a5.c7bae8","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":585,"y":367,"wires":[[]]},{"id":"286435d7.53353a","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":103,"y":467,"wires":[["977c9e57.6f698"]]},{"id":"ad2970d8.cc1dd","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"","payload":"closed","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":101,"y":509,"wires":[["977c9e57.6f698"]]},{"id":"977c9e57.6f698","type":"change","z":"514a90a5.c7bae8","name":"Set msg.status.text","rules":[{"t":"move","p":"payload","pt":"msg","to":"status.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":277.5,"y":490,"wires":[["763c2212.f60844"]]}]

Thanks for getting back Colin. That flow you have shown also works for me. i posted that just as an example on how it works and what i needed to achieve.
I'm still working on the problem now. It seems the Modbus Response node maybe the issue.
It will detect if a Modbus device has been re-connected to the bus. But when a device disconnects it wont change status until the flow has had a re-deploy.
I'm gonna play a little more, if no joy ill message the author.

Cheers again Sir

OK, your post read as if you were saying the gate node was not responding correctly.