Would be helpful if you supplied examples of the incoming data, but to guess i would think something like this.
[{"id":"932b6c8.9517f9","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":120,"y":3620,"wires":[["12917235.b92ee6"]]},{"id":"12917235.b92ee6","type":"switch","z":"bf9e1e33.030598","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":260,"y":3640,"wires":[["23ac18a8.48ff98"],["39b76aea.15f0e6"]]},{"id":"85624c72.86a75","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":130,"y":3660,"wires":[["12917235.b92ee6"]]},{"id":"23ac18a8.48ff98","type":"trigger","z":"bf9e1e33.030598","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":470,"y":3620,"wires":[["d75462a8.4fb38"]]},{"id":"39b76aea.15f0e6","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":3680,"wires":[["23ac18a8.48ff98","6b19140d.17a95c"]]},{"id":"d75462a8.4fb38","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":3620,"wires":[["6b19140d.17a95c"]]},{"id":"6b19140d.17a95c","type":"rbe","z":"bf9e1e33.030598","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":850,"y":3680,"wires":[["838111ef.f0b218"]]},{"id":"838111ef.f0b218","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":3820,"wires":[]}]
[edit] added fuller example