Help with how to make a node to do this function

Forget the message off it is just the light trigger pulsing. when it does not receive a message with in the time of the trigger, set the trigger to send nothing rather than off. Or turn the debug off.

watch the blue dots and watch the switch states (status) which shows how the switches are positioned.

The light trigger is just a representation that the message (electricity is being received) the light trigger could be deleted it's there just to signify
message received, by showing a blue dot.

The default state is all switches in a position to turn on light, i.e light on.

Yeah, ok, with you not.

But - gee I have to ZOOM IN something shocking - to see the states clearly.
(having colours would help)

With you now.

Ok.

I'm kind of understanding your way now too.
Just a bit confusing for me as I was looking at the wrong things for the wrong reasons, and expecting to see something different.

All good now.

But I may (now) go and mark my latest one as the solution.

For the sake of keeping things clean:
The code I posted was mentioned to me I made a mistake with ` and ' being used incorrectly.

This is the code which - to me - clearly shows me what is going on and the trick with the DPDT switches and how they allow multiple (unlimited) numbers of them to control a light.

Yes: Outside the scope of NR. Just it is my go to program/language for testing things just now.

[{"id":"512885e1dfc85d57","type":"change","z":"b25fd092.bcc758","name":"STOP","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":6470,"wires":[["188b0c7758d721af"]]},{"id":"15b5283d986df757","type":"change","z":"b25fd092.bcc758","name":"STOP","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":6510,"wires":[["b275c8b2d07f2578"]]},{"id":"893473637099af23","type":"inject","z":"b25fd092.bcc758","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":250,"y":6540,"wires":[["b275c8b2d07f2578","512885e1dfc85d57"]]},{"id":"188b0c7758d721af","type":"trigger","z":"b25fd092.bcc758","name":"OFF","op1":"0,1","op2":"0","op1type":"str","op2type":"str","duration":"-1","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":6470,"wires":[["79dfd23d02073a19"]]},{"id":"54d68a866d3e8353","type":"inject","z":"b25fd092.bcc758","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":250,"y":6440,"wires":[["15b5283d986df757","188b0c7758d721af"]]},{"id":"b275c8b2d07f2578","type":"trigger","z":"b25fd092.bcc758","name":"ON","op1":"1,0","op2":"0","op1type":"str","op2type":"str","duration":"-1","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":6510,"wires":[["79dfd23d02073a19"]]},{"id":"79dfd23d02073a19","type":"function","z":"b25fd092.bcc758","name":"function 186","func":"let x = msg.payload;\nlet y = context.get(\"toggle\") || 0;\nif (x == \"TOGGLE\")\n{\n    y = ((y + 1) % 2);\n    context.set(\"toggle\",y)\n    if (y == 0)\n    {\n        node.status({fill: \"green\", text: \"normal\"});\n    }\n    else\n    {\n        node.status({fill: \"red\", text: \"flip\"});\n    }\n    return;\n}\n\nif (y == 1)\n{\n    //\n    if (x == '1,0')\n    {\n        x = '0,1'\n        msg.payload = x;\n        return msg;\n    }\n    //\n    if (x == '0,1')\n    {\n        x = '1,0'\n        msg.payload = x;\n        return msg;\n    }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":709,"y":6496,"wires":[["ae171e439487547e","32e7de687114a89f"]]},{"id":"aa890c59737b287b","type":"inject","z":"b25fd092.bcc758","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":699,"y":6446,"wires":[["79dfd23d02073a19"]]},{"id":"ae171e439487547e","type":"function","z":"b25fd092.bcc758","name":"function 187","func":"let x = msg.payload;\nlet y = context.get(\"toggle\") || 0;\nif (x == \"TOGGLE\")\n{\n    y = ((y + 1) % 2);\n    context.set(\"toggle\",y)\n    if (y == 0)\n    {\n        node.status({fill: \"green\", text: \"normal\"});\n    }\n    else\n    {\n        node.status({fill: \"red\", text: \"flip\"});\n    }\n    return;\n}\n\nif (y == 1)\n{\n    //\n    if (x == '1,0')\n    {\n        x = '0,1'\n        msg.payload = x;\n        return msg;\n    }\n    //\n    if (x == '0,1')\n    {\n        x = '1,0'\n        msg.payload = x;\n        return msg;\n    }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":929,"y":6496,"wires":[["87a2abd50a00c54c","070b96c2e0e3ce92"]]},{"id":"32e7de687114a89f","type":"debug","z":"b25fd092.bcc758","name":"SW1","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":690,"y":6560,"wires":[]},{"id":"c96ea5a2349e3ffc","type":"inject","z":"b25fd092.bcc758","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":919,"y":6446,"wires":[["ae171e439487547e"]]},{"id":"87a2abd50a00c54c","type":"function","z":"b25fd092.bcc758","name":"function 188","func":"let x = msg.payload;\nlet y = context.get(\"toggle\") || 0;\nif (x == \"TOGGLE\")\n{\n    y = ((y + 1) % 2);\n    context.set(\"toggle\",y)\n    if (y == 0)\n    {\n        node.status({fill: \"green\", text: \"normal\"});\n    }\n    else\n    {\n        node.status({fill: \"red\", text: \"flip\"});\n    }\n    return;\n}\n\nif (y == 1)\n{\n    //\n    if (x == '1,0')\n    {\n        x = '0,1'\n        msg.payload = x;\n        return msg;\n    }\n    //\n    if (x == '0,1')\n    {\n        x = '1,0'\n        msg.payload = x;\n        return msg;\n    }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1139,"y":6496,"wires":[["8799bfd981b0a666","d5b233c2e3220144"]]},{"id":"070b96c2e0e3ce92","type":"debug","z":"b25fd092.bcc758","name":"SW2","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":910,"y":6560,"wires":[]},{"id":"ea4d2a8c0b6140a6","type":"inject","z":"b25fd092.bcc758","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":1129,"y":6446,"wires":[["87a2abd50a00c54c"]]},{"id":"8799bfd981b0a666","type":"function","z":"b25fd092.bcc758","name":"function 189","func":"let x = msg.payload;\nlet y = x.split(',');\n\nlet state = y[0];\n\nif (state == 0)\n{\n    msg.payload = \"OFF\"\n}\nelse\n{\n    msg.payload = \"ON\"\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1329,"y":6496,"wires":[["415745113788cc72"]]},{"id":"d5b233c2e3220144","type":"debug","z":"b25fd092.bcc758","name":"SW3","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1120,"y":6560,"wires":[]},{"id":"415745113788cc72","type":"rbe","z":"b25fd092.bcc758","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1480,"y":6496,"wires":[["ca5264fb7de95619"]]},{"id":"ca5264fb7de95619","type":"debug","z":"b25fd092.bcc758","name":"Light is.....","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1330,"y":6550,"wires":[]}]