TCP receive data led indicator - flip/flop?

I have two TCP nodes that are getting data from other Node-RED instances, that works fine.
What I am looking for is an LED (or some indicator) of where the data is coming from.
Here is a screen shot to help.....

I would like 2 LED's. One for port A, one for port B.
When data comes from port A, LED A turns on. When data comes from port B, LED B turns on and LED A turns off.
If another payload comes from Port B, nothing changes.

I think I need a binary flip-flop, but when I tried to make one, I had an infinite feedback loop and crashed Node-RED, so I clearly need a little help.....

sort of like

[{"id":"9a84e7e3.a615a8","type":"tcp in","z":"3658255b.2041aa","name":"","server":"server","host":"","port":"5555","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":210,"y":1280,"wires":[["293bfc05.dbfea4","a3715465.d77148"]]},{"id":"293bfc05.dbfea4","type":"change","z":"3658255b.2041aa","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1280,"wires":[["10ede147.9458ff"]]},{"id":"10ede147.9458ff","type":"ui_led","z":"3658255b.2041aa","group":"1e4b8483.ea6fab","order":7,"width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"gray","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"name":"","x":650,"y":1280,"wires":[]},{"id":"a3715465.d77148","type":"change","z":"3658255b.2041aa","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1320,"wires":[["ecee025e.d47ad"]]},{"id":"ecee025e.d47ad","type":"ui_led","z":"3658255b.2041aa","group":"1e4b8483.ea6fab","order":7,"width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"gray","value":"false","valueType":"bool"},{"color":"red","value":"true","valueType":"bool"}],"name":"","x":650,"y":1320,"wires":[]},{"id":"41f2c7a4.0206f8","type":"tcp in","z":"3658255b.2041aa","name":"","server":"server","host":"","port":"5556","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":220,"y":1380,"wires":[["e4c1be4.280934","8b4e898a.559598"]]},{"id":"e4c1be4.280934","type":"change","z":"3658255b.2041aa","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1380,"wires":[["ecee025e.d47ad"]]},{"id":"8b4e898a.559598","type":"change","z":"3658255b.2041aa","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1420,"wires":[["10ede147.9458ff"]]},{"id":"6b2d1ae5.460274","type":"inject","z":"3658255b.2041aa","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":1320,"wires":[["293bfc05.dbfea4","a3715465.d77148"]]},{"id":"d5cc1526.4caaf8","type":"inject","z":"3658255b.2041aa","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1420,"wires":[["e4c1be4.280934","8b4e898a.559598"]]},{"id":"1e4b8483.ea6fab","type":"ui_group","z":"","name":"LED example","tab":"28e3359c.db4eaa","order":1,"disp":true,"width":"6","collapse":false},{"id":"28e3359c.db4eaa","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

1 Like

Thanks so much @dceejay
I never would have come up with that. I was too obsessed with logic gates.
Your way is much clearer.
Cheers.