I’m doing this in node red so that based on the source input on my receiver, I can control Kodi, or Netflix et cetera with the same virtual remote.
I just use a helper/Boolean input and check what it is set to and route it to the correct remote, in this example: Kodi. Here’s the code:
[{"id":"36ee710550b80842","type":"api-current-state","z":"ed20569e.0fcf18","name":"","server":"ec455634.5638","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.preamp_kodi_source","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":790,"y":4340,"wires":[["74b2e29eb8998f86"],[]]},{"id":"ef06d2c7ab4bb047","type":"api-call-service","z":"ed20569e.0fcf18","name":"","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"media_player","service":"media_pause","entityId":"media_player.kodi_de1dd512f4f69f","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1530,"y":3940,"wires":[[]]},{"id":"5278f7c1901177a4","type":"api-call-service","z":"ed20569e.0fcf18","name":"Down","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Down\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4240,"wires":[[]]},{"id":"74b2e29eb8998f86","type":"switch","z":"ed20569e.0fcf18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"play","vt":"str"},{"t":"eq","v":"pause","vt":"str"},{"t":"eq","v":"stop","vt":"str"},{"t":"eq","v":"left","vt":"str"},{"t":"eq","v":"right","vt":"str"},{"t":"eq","v":"up","vt":"str"},{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"select","vt":"str"},{"t":"eq","v":"back","vt":"str"},{"t":"eq","v":"rewind","vt":"str"},{"t":"eq","v":"fastforward","vt":"str"},{"t":"eq","v":"chup","vt":"str"},{"t":"eq","v":"chdn","vt":"str"},{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"info","vt":"str"},{"t":"eq","v":"ContextMenu","vt":"str"}],"checkall":"true","repair":false,"outputs":16,"x":1090,"y":4340,"wires":[["87d6e9ee7aea42cd"],["ef06d2c7ab4bb047"],["007f67d0ec07c03e"],["ac4d352e99f291cb"],["ae3754f5f82579c9"],["fe7e8d0612cb9c20"],["5278f7c1901177a4"],["5417f138cd7de57c"],["cc8949ebe30cf62a"],["40805776949d3fe7"],["c46c3a2f93a9534b"],["704c3ebe7afd8a39"],["8d61cecfe55f2e07"],["72efed837659fde3"],["5f9edc3f6c072d6d"],["bf569baa5c9334c1"]]},{"id":"fe7e8d0612cb9c20","type":"api-call-service","z":"ed20569e.0fcf18","name":"Up","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Up\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4180,"wires":[[]]},{"id":"ae3754f5f82579c9","type":"api-call-service","z":"ed20569e.0fcf18","name":"Right","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Right\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4120,"wires":[[]]},{"id":"ac4d352e99f291cb","type":"api-call-service","z":"ed20569e.0fcf18","name":"Left","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Left\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4060,"wires":[[]]},{"id":"5417f138cd7de57c","type":"api-call-service","z":"ed20569e.0fcf18","name":"Select","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Select\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4300,"wires":[[]]},{"id":"72efed837659fde3","type":"api-call-service","z":"ed20569e.0fcf18","name":"Home","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Home\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4660,"wires":[[]]},{"id":"cc8949ebe30cf62a","type":"api-call-service","z":"ed20569e.0fcf18","name":"Back","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Back\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4360,"wires":[[]]},{"id":"87d6e9ee7aea42cd","type":"api-call-service","z":"ed20569e.0fcf18","name":"","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"media_player","service":"media_play","entityId":"media_player.kodi_de1dd512f4f69f","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1530,"y":3880,"wires":[[]]},{"id":"007f67d0ec07c03e","type":"api-call-service","z":"ed20569e.0fcf18","name":"","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"media_player","service":"media_stop","entityId":"media_player.kodi_de1dd512f4f69f","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1530,"y":4000,"wires":[[]]},{"id":"208b80c401fb0c7a","type":"server-events","z":"ed20569e.0fcf18","name":"","server":"ec455634.5638","version":1,"event_type":"kodi_call_method_result","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":810,"y":4800,"wires":[[]]},{"id":"40805776949d3fe7","type":"api-call-service","z":"ed20569e.0fcf18","name":" small backward","server":"ec455634.5638","version":3,"debugenabled":true,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"playerid\":1,\"value\":{\"step\":\"smallbackward\"},\"method\":\"Player.Seek\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1480,"y":4420,"wires":[[]]},{"id":"c46c3a2f93a9534b","type":"api-call-service","z":"ed20569e.0fcf18","name":" small forward","server":"ec455634.5638","version":3,"debugenabled":true,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"playerid\":1,\"value\":{\"step\":\"smallforward\"},\"method\":\"Player.Seek\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1470,"y":4480,"wires":[[]]},{"id":"8d61cecfe55f2e07","type":"api-call-service","z":"ed20569e.0fcf18","name":"Page Down","server":"ec455634.5638","version":3,"debugenabled":true,"service_domain":"kodi","service":"call_method","entityId":"","data":"{\"action\":\"pagedown\",\"method\":\"Input.ExecuteAction\",\"entity_id\":\"media_player.kodi_de1dd512f4f69f\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1470,"y":4600,"wires":[[]]},{"id":"704c3ebe7afd8a39","type":"api-call-service","z":"ed20569e.0fcf18","name":"Page Up","server":"ec455634.5638","version":3,"debugenabled":true,"service_domain":"kodi","service":"call_method","entityId":"","data":"{\"action\":\"pageup\",\"method\":\"Input.ExecuteAction\",\"entity_id\":\"media_player.kodi_de1dd512f4f69f\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1460,"y":4540,"wires":[[]]},{"id":"5f9edc3f6c072d6d","type":"api-call-service","z":"ed20569e.0fcf18","name":"Info","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.Info\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":4720,"wires":[[]]},{"id":"bf569baa5c9334c1","type":"api-call-service","z":"ed20569e.0fcf18","name":"ContextMenu","server":"ec455634.5638","version":3,"debugenabled":false,"service_domain":"kodi","service":"call_method","entityId":"media_player.kodi_de1dd512f4f69f","data":"{\"method\":\"Input.ContextMenu\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1470,"y":4780,"wires":[[]]},{"id":"ec455634.5638","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]