How to populate the Action Node with Function Vlaues from a Function

If you post a Node-RED flow JSON just as unformatted text, then the formatting is scrambled and it becomes unreadable and cannot be copied.

The empty array bracket pair [] in the editor becomes which looks very nice, but to import this requires hand editing the code, and you have a lot of in there…

Please use the code block </> option that you will find in the editor. This is a stated and de facto requirement of posting any structured code or data in this forum.

PS - the documentation says that input to the Action node needs to be under msg.payload, and if I read the stuff above correctly, you are setting

msg = {"action": "light.turn.off", }

which is both invalid JSON and is not setting msg.payload.

Using a Change node, and setting msg.payload to

{
   "action": "homeassistant.toggle",
   "target": {"entity_id": ["switch.t3_2"]}
}

overrides the UI settings and works perfectly for me.