Your syntax is a little bit off. Try this and see if it works for you...
My JavaScript code in the function node is...
switch (msg.topic) {
case 'climate.lounge':
if (msg.payload == 'auto') {
msg.domain = 'scene';
msg.action = 'create';
msg.data = '{"scene_id":"lounge_climate_scene","snapshot_entities":"climate.lounge"}';
} else {
msg.domain = 'scene';
msg.action = 'turn_on';
msg.data = 'lounge_climate_scene';
}
return msg; // Moved inside the switch case block
break; // Optional, as return statement exits the block
// Other cases...
}
[{"id":"04d5b6390d20da79","type":"tab","label":"Flow 46","disabled":false,"info":"","env":[]},{"id":"a5c4894da83b581b","type":"function","z":"04d5b6390d20da79","name":"function","func":"switch (msg.topic) {\n case 'climate.lounge':\n if (msg.payload == 'auto') {\n msg.domain = 'scene';\n msg.action = 'create';\n msg.data = '{\"scene_id\":\"lounge_climate_scene\",\"snapshot_entities\":\"climate.lounge\"}';\n } else {\n msg.domain = 'scene';\n msg.action = 'turn_on';\n msg.data = 'lounge_climate_scene';\n }\n return msg; // Moved inside the switch case block\n break; // Optional, as return statement exits the block\n // Other cases...\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":140,"wires":[["52b76b8a2a9f502d"]]},{"id":"5c4b20273b5bf96e","type":"inject","z":"04d5b6390d20da79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"climate.lounge","payload":"auto","payloadType":"str","x":150,"y":100,"wires":[["a5c4894da83b581b"]]},{"id":"52b76b8a2a9f502d","type":"debug","z":"04d5b6390d20da79","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":140,"wires":[]},{"id":"348b22d034b4d946","type":"inject","z":"04d5b6390d20da79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"climate.lounge","payload":"manual","payloadType":"str","x":160,"y":180,"wires":[["a5c4894da83b581b"]]}]