You can use msg.payload.idx to route messages or in a look up table to look up esp device id's (or values to add) etc
[{"id":"4cd7ce02.22cb","type":"inject","z":"5a245aa1.510164","name":"Off 2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Battery\":255,\"RSSI\":12,\"description\":\"\",\"dtype\":\"Light/Switch\",\"hwid\":\"18\",\"id\":\"000143F7\",\"idx\":836,\"name\":\"testmqtt\",\"nvalue\":0,\"stype\":\"Switch\",\"svalue1\":\"0\",\"switchType\":\"On/Off\",\"unit\":1}","payloadType":"json","x":121.33332824707031,"y":788.3333740234375,"wires":[["5242075a.1c74d"]]},{"id":"5242075a.1c74d","type":"function","z":"5a245aa1.510164","name":"","func":"var lookup = {\"_935\":0,\"_836\":2};\nmsg.payload = lookup[\"_\" + msg.payload.idx] + msg.payload.nvalue;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":620,"wires":[["33d9788d.83b238"]]},{"id":"33d9788d.83b238","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":620,"wires":[]},{"id":"6707b592.81f91c","type":"inject","z":"5a245aa1.510164","name":"On","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Battery\":255,\"RSSI\":12,\"description\":\"\",\"dtype\":\"Light/Switch\",\"hwid\":\"18\",\"id\":\"000143F7\",\"idx\":935,\"name\":\"testmqtt\",\"nvalue\":1,\"stype\":\"Switch\",\"svalue1\":\"0\",\"switchType\":\"On/Off\",\"unit\":1}","payloadType":"json","x":130,"y":620,"wires":[["5242075a.1c74d"]]},{"id":"c2ab7e91.ecfb58","type":"inject","z":"5a245aa1.510164","name":"Off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Battery\":255,\"RSSI\":12,\"description\":\"\",\"dtype\":\"Light/Switch\",\"hwid\":\"18\",\"id\":\"000143F7\",\"idx\":935,\"name\":\"testmqtt\",\"nvalue\":0,\"stype\":\"Switch\",\"svalue1\":\"0\",\"switchType\":\"On/Off\",\"unit\":1}","payloadType":"json","x":110,"y":680,"wires":[["5242075a.1c74d"]]},{"id":"ff2dd620.963bc","type":"inject","z":"5a245aa1.510164","name":"On 2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Battery\":255,\"RSSI\":12,\"description\":\"\",\"dtype\":\"Light/Switch\",\"hwid\":\"18\",\"id\":\"000143F7\",\"idx\":836,\"name\":\"testmqtt\",\"nvalue\":1,\"stype\":\"Switch\",\"svalue1\":\"0\",\"switchType\":\"On/Off\",\"unit\":1}","payloadType":"json","x":110,"y":740,"wires":[["5242075a.1c74d"]]}]
a simple lookup example.
[edit] output 0 , 1, 2 or 3 , dependant on idx and nvalue