Is there a better way to do this, either in Node-Red or an Automation?

I have a Broadlink Mini that I want to send three commands in a sequence (changing a channel on the TV).
The template node is to strip the msg.payload or else it gets merged with the next Home Assistant call service node.
This flow has an inject, template, delay and Home Assistant Call-Service nodes.

[{"id":"de7c52db.2289e","type":"api-call-service","z":"4820e6f6.309498","name":"6","server":"1a3c51f6.4b493e","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\": \"switch.fios_6\"}","mergecontext":"","x":290,"y":480,"wires":[["e3f9b9d9.d8c088"]]},{"id":"3e684ea3.2f21d2","type":"inject","z":"4820e6f6.309498","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":480,"wires":[["de7c52db.2289e"]]},{"id":"2414b736.d06578","type":"api-call-service","z":"4820e6f6.309498","name":"0","server":"1a3c51f6.4b493e","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\": \"switch.fios_0\"}","mergecontext":"","x":290,"y":560,"wires":[["163c1d45.04d693"]]},{"id":"8e2ce805.ee0bf8","type":"delay","z":"4820e6f6.309498","name":"","pauseType":"delay","timeout":"90","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":480,"wires":[["2414b736.d06578"]]},{"id":"fd0e1ee9.c7b24","type":"delay","z":"4820e6f6.309498","name":"","pauseType":"delay","timeout":"90","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":560,"wires":[["c1de10f1.7414e"]]},{"id":"c1de10f1.7414e","type":"api-call-service","z":"4820e6f6.309498","name":"3","server":"1a3c51f6.4b493e","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\": \"switch.fios_3\"}","mergecontext":"","x":290,"y":640,"wires":[[]]},{"id":"e3f9b9d9.d8c088","type":"template","z":"4820e6f6.309498","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"msg.payload = \"\";\n","output":"str","x":440,"y":480,"wires":[["8e2ce805.ee0bf8"]]},{"id":"163c1d45.04d693","type":"template","z":"4820e6f6.309498","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"msg.payload = \"\";\n","output":"str","x":440,"y":560,"wires":[["fd0e1ee9.c7b24"]]},{"id":"1a3c51f6.4b493e","type":"server","z":"","name":"Home Assistant- Raspberry","url":"http://localhost:8123","pass":"raspberry"}]

I use this in my Lovelace cards to switch to a different channel:

      - type: glance
        title: TV Channels
        show_state: false
        column_width: 33%
        entities:
          - entity: script.tv_channel_8
            name: NBC (8)
            tap_action: call-service
            service: script.tv_channel_8
          - entity: script.tv_channel_46
            name: CBS (46)
            tap_action: call-service
            service: script.tv_channel_46

And these are the scripts that go with it:

# Samsung TV
tv_channel_8:
  sequence:
    - service: switch.broadlink_send_packet_192_168_7_26
      data:
        packet:
          - "JgDSAJePFTUVNRU0FhAVEBUQFRAVEBU1FTUVNBYQFRAVEBUQFRAWNBUQFTUVNRUQFRAVEBYPFg8WNBYPFhAVNBY0FTUVNRUABfGWjxY0FjQWNBUQFRAWDxYPFhAVNBY0FjQVEBUQFg8WDxYQFTQWEBU0FjQWDxYPFhAVEBUQFTQWEBUQFTUVNBY0FjQVAAXxlpAVNRU0FjQWEBUQFRAVEBUQFTUVNRU0FhAVEBUQFRAVEBU1FRAVNRU1FRAVEBUQFRAVEBY0FRAWDxY0FTUVNRU0FgANBQAAAAAAAA=="
tv_channel_46:
  sequence:
    - service: switch.broadlink_send_packet_192_168_7_26
      data:
        packet:
          - "JgAYAZWRFTQWNBY0FRAVEBURFRAVEBU0FjQWNBUQFhAVEBUQFRAVEBUQFRAVNRUQFRAWDxYPFjQWNBU1FRAVNRU1FTQWNBYABfCWkBU1FTUVNBYQFRAVEBUQFRAVNRU1FTUVEBUQFRAVEBUQFRAWDxYQFTQWEBUQFRAVEBU1FTQWNBYPFjQWNBU1FTUVAAXxlo8WNBY0FTUVEBUQFRAVEBYQFDUVNRU1FBEUERUQFREUERQRFBEUERQ2FBEUERQRFBEVNRQ2FDYUERQ2FDUVNRU1FAAF9JaPFjQVNRU1FRAVEBUQFRAVEBY0FTUVNRUQFRAVEBUQFg8WDxYQFRAVNBYQFRAVEBUQFTUVNRU0FhAVNBU1FTUVNRQADQU="
          - "JgDSAJaQFTUVNBY0Fg8WEBUQFRAVEBU1FTQWNBYPFhAVEBUQFRAVEBU1FRAVNRUQFRAVEBYPFjQWDxY0FRAWNBU1FTUVNBYABe6XjxY0FTUVNBYQFRAVEBUQFRAWNBU1FTQWEBUQFRAVEBUQFg8WNBYPFjQVEBYPFg8WEBU0FhAVNBYPFjQWNBU1FTUVAAXvlo8WNBY0FTUVEBUQFRAWDxYPFjQWNBU1FRAVEBYPFg8WEBUQFTQWEBU0FhAVEBUQFRAVNRUQFTUVEBU1FTQWNBY0FQANBQAAAAAAAA=="

As you can see, I don’t use a delay but it could be easily built into the script.

Thanks, I am still waiting for the “Introduction to Lovelace” tutorial before diving in.
But I will bookmark your reply for when I do start using Lovelace.

Steve

Here is the config for the legacy interface:

broadlink_group_tv:
  name: TV Remote
  control: hidden
  entities:
    - script.tv_channel_8
    - script.tv_channel_46

There are quite a few tutorials on Youtube - this is actually the one that got me started on Lovleace: