totally untested but I think this is where you are going
[{"id":"a12fd86cefad38b2","type":"inject","z":"d5c9800b918b16b1","name":"s1 up","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"s1","payload":"1","payloadType":"num","x":150,"y":60,"wires":[["b8aacbc9fc416766"]]},{"id":"df77685f245585b8","type":"inject","z":"d5c9800b918b16b1","name":"s1 dn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"s1","payload":"0","payloadType":"num","x":150,"y":120,"wires":[["b8aacbc9fc416766"]]},{"id":"d04ed9d6f12cd219","type":"inject","z":"d5c9800b918b16b1","name":"s2 up","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"s2","payload":"1","payloadType":"num","x":150,"y":220,"wires":[["b8aacbc9fc416766"]]},{"id":"c40df9e2b7f13bce","type":"inject","z":"d5c9800b918b16b1","name":"s2 dn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"s2","payload":"0","payloadType":"num","x":150,"y":280,"wires":[["b8aacbc9fc416766"]]},{"id":"b8aacbc9fc416766","type":"function","z":"d5c9800b918b16b1","name":"logic","func":"\n\nif (msg.topic == \"s1\"){\n if (msg.payload = 1){\n let S1= \"up\";\n context.set(\"S1\",\"up\");\n }\n if (msg.payload = 0){\n let S1 = \"dn\";\n context.set(\"S1\", \"dn\"); \n }\n}\n\nif (msg.topic == \"s2\") {\n if (msg.payload = 1) {\n let S2 = \"up\";\n context.set(\"S2\", \"up\");\n }\n if (msg.payload = 0) {\n let S2 = \"dn\";\n context.set(\"S2\", \"dn\");\n }\n}\n\nlet S1 = context.get(\"S1\");\nlet S2 = context.get(\"S2\");\n\nif (S1 == 1 && S2 == 1){\n //both switches up \n //logic good - logic one on output\n}\n\nif (S1 == 0 && S2 == 0) {\n //both switches dn \n //logic good - logic one on output\n}\n\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":160,"wires":[[]]}]