Script - input select with broadlink

Does anyone have this scenario working (or let alone know if it can be done)? What I am trying to achieve is have an input select for a AVR that will send the IR codes based on the selection.
The below configuration loads, but it is not sending the IR code to change an input. Using the gui under broadlink call service I can successfully send the command to change input so I know they are working.

   alias: Change Denon Input
    sequence:
     - service: broadlink.send_packet_192_168_2_63
       data:
         value_template:
         packet: >
          {% if is_state("input_select.denon_input", "Kodi") %}  - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% elif is_state("input_select.denon_input", "CD") %}  - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% elif is_state("input_select.denon_input", "DVD") %} - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% elif is_state("input_select.denon_input", "IPOD") %} - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% elif is_state("input_select.denon_input", "ChromeCast Audio") %}  - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% elif is_state("input_select.denon_input", "USB") %}  - "JgDMAAoYCT0KGQoYCRkIGgkaCD0IPgoYCxgJPAo7CBsKGAkABfMKGQg9CBsIGgkaCD0IPQkZCRoIPQg9ChgJGgg9CjwKAAWsChkIPgoXCRoIGgkaCBsIPQk8ChgIGwc/CjsKGAoZCQAF8goaCjsJGQkaCRkJPAo7ChkIGgk8CTwJGggaCTwJPQoABa0JGQk8ChkIGgkaCBsIGgg9CjsJGggaCTwKPAoZChcJAAX0ChkKOwoZChgJGgk8CjsIGgkaCToMOwkZCRoIPQk8CgANBQAAAAAAAAAAAAAAAA=="
          {% endif %}

Can it be done link this?

remove the value template, instead replace data with data_template try again.

~Cheers

@PhyberApex no luck unfortuantely - I cant see the broadlink LED firing off the code…

Have you had any luck with this?

issue is linked ot the fact that broadlink platform is sending the packet using an array… and we template it s not an array but directly the value.

could nt find any other solution so far, except using switches…