Need help with TV channel select (input_select)

I need some help here. I’m not sure where the error is. A random channel is selected each time I select a channel :flushed:

Input_select.yaml

tv_kanaler_stuen:
  name: 'Tv kanaler stuen'
  options:
   - '(1) NRK 1'
   - '(2) NRK 2'
   - '(3) TV2'
   - '(4) TV Norge'
   - '(5) TV3'
   - '(6) NRK 3 / Super'
   - '(7) TV2 Zebra'
   - '(8)TV2 Livsstil'
   - '(9) Viasat 4'
  initial: '(3) TV2'
  icon: 'mdi:television'

configuration.yaml

script:
  tv_kanal_0:
    alias: TV kanal 0
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA=='

  tv_kanal_1:
    alias: TV kanal 1
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_2:
    alias: TV kanal 2
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_3:
    alias: TV kanal 3
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_4:
    alias: TV kanal 4
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_5:
    alias: TV kanal 5
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA=="

  tv_kanal_6:
    alias: TV kanal 6
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_7:
    alias: TV kanal 7
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgBGAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETERQRFBEUERMRFBEUETgRORETERQRFBEUETgROBITERQROBI4ETgROREADQUAAA=="

  tv_kanal_8:
    alias: TV kanal 8
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA=="

  tv_kanal_9:
    alias: TV kanal 9
    sequence:
      - service: switch.broadlink_send_packet_10_0_0_116
        data:
          packet: 
            - "JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=="

automation_tv_kanaler.yaml

- alias: 'TV Kanal (1) NRK 1'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_1

- alias: 'TV Kanal (2) NRK 2'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(2) NRK 2' 
  action:
    - service: script.tv_kanal_2

- alias: 'TV Kanal (3) TV2'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_3

- alias: 'TV Kanal (4) TV Norge'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_4

- alias: 'TV Kanal (5) TV3'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_5

- alias: 'TV Kanal (6) NRK 3 / Super'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_6

- alias: 'TV Kanal (7) TV2 Zebra'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_7

- alias: 'TV Kanal (8)TV2 Livsstil'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_8

- alias: 'TV Kanal (9) Viasat 4'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
#      state: '(1) NRK 1' 
  action:
    - service: script.tv_kanal_9

The issue I see is with your automations, it just activates on input select change but it doesn’t check to see what’s been selected. Your input_select and scripts seem ok, but your automations are wrong. If you uncomment the state, and change it to suit each channel/automation, and qualify the service properly, it will work.

- alias: 'TV Kanal (1) NRK 1'
  hide_entity: True
  trigger:
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
      state: '(1) NRK 1' 
  action:
    - service: homeassistant.turn_on
      entity_id: script.tv_kanal_1

This is mine, a single automation controls all channels, just adjust it to connect with yours:

- alias: Sports Automation
  initial_state: 'on'
  hide_entity: true
  trigger:
    platform: state
    entity_id: input_select.sports
  action:
    service: homeassistant.turn_on
    data_template:
      entity_id: >
       {% if is_state('input_select.sports', 'Fox Sports News') %}
       script.500
       {% elif is_state('input_select.sports', 'Fox Sports 501') %}
       script.501
       {% elif is_state('input_select.sports', 'Fox League') %}
       script.502
       {% elif is_state('input_select.sports', 'Fox Sports 503') %}
       script.503
       {% elif is_state('input_select.sports', 'Fox Footy') %}
       script.504
       {% elif is_state('input_select.sports', 'Fox Sports 505') %}
       script.505
       {% elif is_state('input_select.sports', 'Fox Sports 506') %}
       script.506
       {% elif is_state('input_select.sports', 'Fox Sports More') %}
       script.507
       {% elif is_state('input_select.sports', 'ESPN') %}
       script.espn
       {% elif is_state('input_select.sports', 'ESPN2') %}
       script.espn2
       {% elif is_state('input_select.sports', 'Racing.com') %}
       script.racing
       {% endif %}

Hope this works for you.

Thanks for the quick reply. I have to try this :slight_smile:
If I want to watch channel 36, do I add two comendos (3 and 6) under script?

data:
  packet: 
    - "JgDSAJOVETgRORE4ERQRFB......"
    - "JgCMAJOUETkROBE5ERBE5R......"

do I have to put some delay between?

Unfortunately I’m not familiar with the Broadlink platform (I use Harmony) so you will have to give it a go both ways and see which one works.

For the Harmony, you don’t need a delay and every number needs to be entered, example below:

500:
  alias: 'Fox Sports News'
  sequence:
    service: remote.send_command
    data:
      entity_id: remote.harmony_hub
      device: '49229097'
      command:
        - 5
        - 0
        - 0

I’d be super lazy with this and have a script that handles all numbers:

tv_kanaler_stuen:
  name: 'Tv kanaler stuen'
  options:
   - '1 NRK 1'
   - '2 NRK 2'
   - '3 TV2'
   - '4 TV Norge'
   - '5 TV3'
   - '6 NRK 3 / Super'
   - '7 TV2 Zebra'
   - '8 TV2 Livsstil'
   - '9 Viasat 4'
   - '17 test'
   - '123 test2'
  initial: '(3) TV2'
  icon: 'mdi:television'

- alias: Change Channel
  trigger: 
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
  action:
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {%- for index in indexes %}
          {{- numbers[index | int] }}
          {% endfor %}

Then you wouldn’t need scripts and it would send all the commands regardless of what station you create.

The only stipulation is that you create your stations inside your input select with the following format:

- 'numberSPACEstationname'

example:

- '100 ESPN 8, the ocho'

1 automation, 1 input_select. No other configurations.

Thank you @petro.
I tried your example and it works just fine on channels 1 - 9. But as soon as I select a 2-digit channel, the TV will only receive the first digit.

   - '29 Eurosport'               # TV only receive "2"
   - '30 Eurosport Norge'         # TV only receive "3"

Is it possible to add delay after each sent digit?

It is, but the script is less friendly. YOu have to hardcode services instead of looping:

  action:
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[0]] }}
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 2 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[1]] }} 
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 3 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[2]] }} 

You’d need to add a condition for every numerical value in your channel number. This example can go up to 999. Anything beyond that number will not work.

1 Like

Thank you verry much…
But IM not quite sure what I have to do… not sure if I understand…

Updated the automation but now the TV does not receive anything. Here is what I got now.

automation_tv_kanaler.yaml

- alias: Change Channel
  trigger: 
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
  action:
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[0]] }}
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 2 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[1]] }} 
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 3 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[2]] }} 

input_select.yaml

tv_kanaler_stuen:
  name: 'Tv kanaler stuen'
  options:
   - '1 NRK 1'
   - '2 NRK 2'
   - '3 TV2'
   - '4 TV Norge'
   - '5 TV3'
   - '6 NRK 3 / Super'
   - '7 TV2 Zebra'
   - '8 TV2 Livsstil'
   - '9 Viasat 4'
   - '10 FEM'
   - '11 BBC BRIT'
   - '12 TV 2 Nyhetskanalen'
   - '13 TV 2 Sportskanalen'
   - '14 MAX'
   - '15 VOX'
   - '16 Discovery'
   - '17 TLC Norge'
   - '18 Fox'
   - '19 Comedy Central'
   - '20 National Geographic'
   - '21 History'
   - '22 TV 2 Homor'
   - '23 Matkanalen'
   - '29 Eurosport'
   - '30 Eurosport Norge'
   - '31 Disney Channel'
   - '32 Disney Junior'
   - '33 Disney XD'
   - '36 Animal Planet'
   - '37 TV6'
   - '38 BBC World News'
  initial: '3 TV2'
  icon: 'mdi:television'
- alias: Change Channel
  trigger: 
    - platform: state
      entity_id: input_select.tv_kanaler_stuen
  action:
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[0] | int] }}
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 2 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[1] | int] }} 
    - condition: template
      value_template: >
        {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
        {{ indexes | count >= 3 }}
    - delay:
        seconds: 1
    - service: switch.broadlink_send_packet_10_0_0_116
      data_template:
        packet: >
          {% set numbers = [ 'JgDSAJOVETgRORE4ERQRFBETERQRFBE4ETkROBEUERQRExEUERQROBEUERQRExI4ERQRExITERQROBE5ETgRFBE4EjgROBEABgGTlBI4ETgROREUERMRFBEUERQROBE4EjgRFBETEhMRFBEUETgRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgRAAYBk5QSOBE4EjUUFBETERQRFBEUETgROBI4ERQRExEUERQRFBE4ERQRExITETkRExEUERQRFBE4ETgSOBEUETgRORE4EQANBQAAAAAAAA==', 'JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETYUOBEUERQRExEUERQRFBETETkRExITERQRFBETETkROBEUETgRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBE5ETgRFBEUERMSExEUERQRExE5ERMSExEUERQRExI4ETgRFBE4EjgROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOUETkROBE5ERMRFBEUERQRExE5ETgRORETEhMRFBETEhMRORETETkRFBETERQRFBETEhMRORETEjgROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExEUERQRExITETkRExI4ERQRExEUERQRExITETkRExI4ETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJOVETgROBI4ERQRExEUERQRFBE4ETgSOBEUERMRFBEUERMSExE5ETgRFBEUERMRFBEUETgRFBEUETgROBI4ETgSOBEABgCTlRE4ETgSOBEUERMRFBEUERQROBE5ETgRFBETEhMRFBEUERMRORE4ERQRFBETEhMRFBE4EhMRFBE4ETkROBE5ETgRAA0FAAAAAAAAAAAAAAAA==', 'JgCMAJKVETkROBE5ERMRFBEUERMSExE5ETgRORETERQRFBETEhMRFBEUERMROREUERMRFBEUETgRORE4ERQROBE5ETgROREABgCTlBI4ETgROREUERMRFBEUERMSOBE4ETkRFBETERQRFBETEhMRFBEUETgRFBEUERMRFBE4EjgROBITETkROBE4EjgRAA0FAAAAAAAAAAAAAAAA==','JgDSAJOUEjgROBE5ERQRExITERQRExI4ETgROREUERMRFBEUERMSOBEUERMROREUERMRFBEUERMSOBE4EhMRORE4ETgSOBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUETgRFBEUETgRFBEUERMSExEUETYTOREUETgROBI4ETgSAAYAk5UROBE5ETgRFBEUERMRFBEUETgRORE4ERQRFBETERQRFBE4ERQRFBE4ERQRFBETEhMRFBE4EjgRFBE4ETgSOBE4EgANBQAAAAAAAA==', 'JgCMAJOUEjgROBE5ERQRExEUERQRExI4ETgROREUERMRFBEUERMSExE5ERMROREUERMRFBEUETgRFBE4EhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExEUERQROBE5ETgRFBEUERMSExEUERQROBEUETgRFBEUERQRExE5ERMSNhMUETgRORE4ETgSAA0FAAAAAAAAAAAAAAAA==','JgCMAJOUEjgROBI4ERQRExEUERQRExI4ETgSOBEUERMRFBEUERQROBEUETgRORETERQRFBEUERMRORETEhMRORE4ETkROBEABgCTlRE4ETkROBEUERQRExITERQROBI4ETgRFBEUERQRExEUETgSExE5ETgRFBEUERMRFBEUETgRFBEUETgRORE4ETkRAA0FAAAAAAAAAAAAAAAA==','JgCMAJOVETgRORE4ERQRFBETEhMRFBE4ETkROBEUERQRExITERQRFBE4ETkROBEUERMSExEUETgSExEUERQROBE5ETgROBIABgCTlBE5ETgRORETERQRFBEUERMRORE4ETkRExITERQRFBETERQROBI4ETgSExEUERQRExE5ERMSExEUETgSOBE4EjgRAA0FAAAAAAAAAAAAAAAA=='] %}
          {% set indexes = states.input_select.tv_kanaler_stuen.state.split(' ')[0] %}
          {{ numbers[indexes[2] | int] }} 

I forgot to convert a string to in in the lines:

{{ numbers[indexes[0]] }}

This is an advanced jinja template. I suggest you do some python tutorials and jinja tutorials. Otherwise you will always need support for this and I will not always be around.

Works perfect now :slight_smile:
I will try to find some tutorials and start learning this.

1 Like

Hello! I have been trying to adapt the code for the new seetings of the Broadlink Integration, and came up with this, adapted from @petro , but it keeps sending me “000” to the device. What am I doing wrong? This is a script, btw!

mudar_canal_meo:
  variables: 
    canal_escolhido: states.input_select.meo_canal.state.split(' ')[0]
    comandos_ir: ['b64:JgAwAAcTFBUUFhMLCRcTFggMCQwUFRQWEwALZAwTExYUFRQLCRYUFQkMCQwTFhQVFAANBQAAAAAAAA==','b64:JgA4AAkTExYUFRQLCRYUFQkMCAwJDAkMCAwUFggAC1kLFBQVFBUUCwkWFBYIDAkMCQsJDAkMExYIAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAcTExYUFRQLCRYUFQkMCQwIDAkMFBUUAAtiCxQUFRQWEwsJFhQWCAwJDAkLCQwUFRQADQUAAA==','b64:JgA4AAYUExYUFRQLCRYUFQkMCA0IDAkMEwwIFwgAC1oLExQVFBYTCwkXExYIDAkMCQwIDBQLCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYUExYTFhQLCRYUFQkMCAwJDBQVCQwUAAtiCRYTFhMWEwwJFhMWCQoLDAgMExcIDBMADQUAAA==','b64:JgA0AAcTExYUFRQLCRYUFQkMCAwJDBQVFBYIAAtbChQUFRMWFAsIFxUUCQwIDAkMFRQUFQkADQUAAA==','b64:JgA0AAQWFBUUFRQLCRYUFggMCQwIDBMMCRYTAAtlChQUFRUVEwsJFxMWCAwJDAkMEwsJFxMADQUAAA==','b64:JgA4AAQVFBUUFhMLCRYUFggMCQwIDRMLCQwJFgkAC1oJFRQVFBYTCwkWExcIDAkMCA0TCwkMCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYTFBYTFhQLCBcTFgkMCAwUFggMCQwTAAtkCRUVFBQWFAkKFhUVCAwJDBMWCQwIDBUADQUAAA==','b64:JgA0AAYTFBYTFhMMCBcTFggNCAwUFQkMFBUJAAtZDBMUFhMWFAsIFxMWCA0JCxQVCQwUFQkADQUAAA==']
  alias: Muda Canal
  icon: mdi:play
  sequence:
    - service: remote.send_command
      entity_id: remote.broadlink_ir_rf_rm4
      data_template:
        entity_id: remote.broadlink_ir_rf_rm4
        command: '{{ comandos_ir[(canal_escolhido[0] | int)] }}'
    - condition: template
      value_template: '{{ (canal_escolhido|count) > 1 }}'
    - delay:
        seconds: 1
    - service: remote.send_command
      entity_id: remote.broadlink_ir_rf_rm4
      data_template:
        entity_id: remote.broadlink_ir_rf_rm4
        command: '{{ comandos_ir[(canal_escolhido[1] | int)] }}'
    - condition: template
      value_template: '{{ (canal_escolhido|count) > 2 }}'
    - delay:
        seconds: 1
    - service: remote.send_command
      entity_id: remote.broadlink_ir_rf_rm4
      data_template:
        entity_id: remote.broadlink_ir_rf_rm4
        command: '{{ comandos_ir[(canal_escolhido[2] | int)] }}'

Your variable canal_escolhido needs to be a template and you can use a repeat sequence to handle the counting. You just need to use the repeat.index variable and subtract 1 from it.

This should work.

mudar_canal_meo:
  variables: 
    canal_escolhido: "{{ states('input_select.meo_canal').split(' ')[0] }}"
    comandos_ir: ['b64:JgAwAAcTFBUUFhMLCRcTFggMCQwUFRQWEwALZAwTExYUFRQLCRYUFQkMCQwTFhQVFAANBQAAAAAAAA==','b64:JgA4AAkTExYUFRQLCRYUFQkMCAwJDAkMCAwUFggAC1kLFBQVFBUUCwkWFBYIDAkMCQsJDAkMExYIAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAcTExYUFRQLCRYUFQkMCQwIDAkMFBUUAAtiCxQUFRQWEwsJFhQWCAwJDAkLCQwUFRQADQUAAA==','b64:JgA4AAYUExYUFRQLCRYUFQkMCA0IDAkMEwwIFwgAC1oLExQVFBYTCwkXExYIDAkMCQwIDBQLCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYUExYTFhQLCRYUFQkMCAwJDBQVCQwUAAtiCRYTFhMWEwwJFhMWCQoLDAgMExcIDBMADQUAAA==','b64:JgA0AAcTExYUFRQLCRYUFQkMCAwJDBQVFBYIAAtbChQUFRMWFAsIFxUUCQwIDAkMFRQUFQkADQUAAA==','b64:JgA0AAQWFBUUFRQLCRYUFggMCQwIDBMMCRYTAAtlChQUFRUVEwsJFxMWCAwJDAkMEwsJFxMADQUAAA==','b64:JgA4AAQVFBUUFhMLCRYUFggMCQwIDRMLCQwJFgkAC1oJFRQVFBYTCwkWExcIDAkMCA0TCwkMCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYTFBYTFhQLCBcTFgkMCAwUFggMCQwTAAtkCRUVFBQWFAkKFhUVCAwJDBMWCQwIDBUADQUAAA==','b64:JgA0AAYTFBYTFhMMCBcTFggNCAwUFQkMFBUJAAtZDBMUFhMWFAsIFxMWCA0JCxQVCQwUFQkADQUAAA==']
  alias: Muda Canal
  icon: mdi:play
  sequence:
  - repeat:
      count: "{{ canal_escolhido }}"
      sequence:
      - service: remote.send_command
        data:
          entity_id: remote.broadlink_ir_rf_rm4
          command: "{{ comandos_ir[repeat.index - 1] }}"
      - delay:
          seconds: 1
1 Like

Really??? OMG, still haven’t tested, and I will in a couple of hours, but if that works, it’s AMAZING for me! Genious! THANKS!

Well, I tested, and at least it doesn’t send 000, but sends 0123456789 in order, any thoughts? Tested with:
input_select.meo_canal = “76 ScyFy”

I tryed with this, but somehow it’s not working, desn’t send any signal:

mudar_canal_meo:
  variables: 
    canal_escolhido: "{{ states('input_select.meo_canal').split(' ')[0] }}"
    comandos_ir: ['b64:JgAwAAcTFBUUFhMLCRcTFggMCQwUFRQWEwALZAwTExYUFRQLCRYUFQkMCQwTFhQVFAANBQAAAAAAAA==','b64:JgA4AAkTExYUFRQLCRYUFQkMCAwJDAkMCAwUFggAC1kLFBQVFBUUCwkWFBYIDAkMCQsJDAkMExYIAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAcTExYUFRQLCRYUFQkMCQwIDAkMFBUUAAtiCxQUFRQWEwsJFhQWCAwJDAkLCQwUFRQADQUAAA==','b64:JgA4AAYUExYUFRQLCRYUFQkMCA0IDAkMEwwIFwgAC1oLExQVFBYTCwkXExYIDAkMCQwIDBQLCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYUExYTFhQLCRYUFQkMCAwJDBQVCQwUAAtiCRYTFhMWEwwJFhMWCQoLDAgMExcIDBMADQUAAA==','b64:JgA0AAcTExYUFRQLCRYUFQkMCAwJDBQVFBYIAAtbChQUFRMWFAsIFxUUCQwIDAkMFRQUFQkADQUAAA==','b64:JgA0AAQWFBUUFRQLCRYUFggMCQwIDBMMCRYTAAtlChQUFRUVEwsJFxMWCAwJDAkMEwsJFxMADQUAAA==','b64:JgA4AAQVFBUUFhMLCRYUFggMCQwIDRMLCQwJFgkAC1oJFRQVFBYTCwkWExcIDAkMCA0TCwkMCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYTFBYTFhQLCBcTFgkMCAwUFggMCQwTAAtkCRUVFBQWFAkKFhUVCAwJDBMWCQwIDBUADQUAAA==','b64:JgA0AAYTFBYTFhMMCBcTFggNCAwUFQkMFBUJAAtZDBMUFhMWFAsIFxMWCA0JCxQVCQwUFQkADQUAAA==']
  alias: Muda Canal
  icon: mdi:play
  sequence:
  - repeat:
      count: "{{ canal_escolhido | count }}"
      sequence:
      - service: remote.send_command
        data:
          entity_id: remote.broadlink_ir_rf_rm4
          command: "{{ comandos_ir[canal_escolhido[repeat.index-1]] }}"
      - delay:
          seconds: 0.8

Just changed two lines that maked more sense, but i’m doing something wrong… Thanks in advance!

nope, the template I wrote above should work without altering. Your changes don’t make sense.

Verify that your IR commands are correct. Or break it out into a yaml list to ensure that each one is separated

    comandos_ir: 
      - 'b64:JgAwAAcTFBUUFhMLCRcTFggMCQwUFRQWEwALZAwTExYUFRQLCRYUFQkMCQwTFhQVFAANBQAAAAAAAA=='
      - 'b64:JgA4AAkTExYUFRQLCRYUFQkMCAwJDAkMCAwUFggAC1kLFBQVFBUUCwkWFBYIDAkMCQsJDAkMExYIAA0FAAAAAAAAAAAAAAAAAAA='
      - 'b64:JgA0AAcTExYUFRQLCRYUFQkMCQwIDAkMFBUUAAtiCxQUFRQWEwsJFhQWCAwJDAkLCQwUFRQADQUAAA=='
      - 'b64:JgA4AAYUExYUFRQLCRYUFQkMCA0IDAkMEwwIFwgAC1oLExQVFBYTCwkXExYIDAkMCQwIDBQLCRYJAA0FAAAAAAAAAAAAAAAAAAA='
      - 'b64:JgA0AAYUExYTFhQLCRYUFQkMCAwJDBQVCQwUAAtiCRYTFhMWEwwJFhMWCQoLDAgMExcIDBMADQUAAA=='
      - 'b64:JgA0AAcTExYUFRQLCRYUFQkMCAwJDBQVFBYIAAtbChQUFRMWFAsIFxUUCQwIDAkMFRQUFQkADQUAAA=='
      - 'b64:JgA0AAQWFBUUFRQLCRYUFggMCQwIDBMMCRYTAAtlChQUFRUVEwsJFxMWCAwJDAkMEwsJFxMADQUAAA=='
      - 'b64:JgA4AAQVFBUUFhMLCRYUFggMCQwIDRMLCQwJFgkAC1oJFRQVFBYTCwkWExcIDAkMCA0TCwkMCRYJAA0FAAAAAAAAAAAAAAAAAAA='
      - 'b64:JgA0AAYTFBYTFhQLCBcTFgkMCAwUFggMCQwTAAtkCRUVFBQWFAkKFhUVCAwJDBMWCQwIDBUADQUAAA=='
      - 'b64:JgA0AAYTFBYTFhMMCBcTFggNCAwUFQkMFBUJAAtZDBMUFhMWFAsIFxMWCA0JCxQVCQwUFQkADQUAAA=='

But to be honest, it sounds like your commands are wrong.

what’s the format of states('input_select.meo_canal')? Maybe that portion is incorrect.

Hello again, and thanks for your time helping me.
The input select is a list of strings according to the format used here, a list with “channel numberchannel name”. Your code sends 0123456789 in order, so the commands seem ok.
I tryed with the commands in list, and the result was the same.
Example test channel “76 ScyFy”
Assumed states, for me:
canal_escolhido = “76” (string)
(canal_escolhido | count) = 2 (2 characters, right? without count I don’t know)
For the command:
“{{ comandos_ir[repeat.index - 1] }}” - I think it will not use the correct command, since it will ignore the chosen_channel (not used) and use the repeat index only, I think, that’s why I changed to:

“{{ comandos_ir[canal_escolhido[repeat.index-1] |int ] }}” (added the integer conversion after the post)

But doesn’t work, does not send anything, and that’s why I thought it could be a formatting issue.
Thanks again for your help, really appreciate it!

ok, then this should work

mudar_canal_meo:
  variables: 
    canal_escolhido: "{{ states('input_select.meo_canal').split(' ')[0] | map('int') | list }}"
    comandos_ir: ['b64:JgAwAAcTFBUUFhMLCRcTFggMCQwUFRQWEwALZAwTExYUFRQLCRYUFQkMCQwTFhQVFAANBQAAAAAAAA==','b64:JgA4AAkTExYUFRQLCRYUFQkMCAwJDAkMCAwUFggAC1kLFBQVFBUUCwkWFBYIDAkMCQsJDAkMExYIAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAcTExYUFRQLCRYUFQkMCQwIDAkMFBUUAAtiCxQUFRQWEwsJFhQWCAwJDAkLCQwUFRQADQUAAA==','b64:JgA4AAYUExYUFRQLCRYUFQkMCA0IDAkMEwwIFwgAC1oLExQVFBYTCwkXExYIDAkMCQwIDBQLCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYUExYTFhQLCRYUFQkMCAwJDBQVCQwUAAtiCRYTFhMWEwwJFhMWCQoLDAgMExcIDBMADQUAAA==','b64:JgA0AAcTExYUFRQLCRYUFQkMCAwJDBQVFBYIAAtbChQUFRMWFAsIFxUUCQwIDAkMFRQUFQkADQUAAA==','b64:JgA0AAQWFBUUFRQLCRYUFggMCQwIDBMMCRYTAAtlChQUFRUVEwsJFxMWCAwJDAkMEwsJFxMADQUAAA==','b64:JgA4AAQVFBUUFhMLCRYUFggMCQwIDRMLCQwJFgkAC1oJFRQVFBYTCwkWExcIDAkMCA0TCwkMCRYJAA0FAAAAAAAAAAAAAAAAAAA=','b64:JgA0AAYTFBYTFhQLCBcTFgkMCAwUFggMCQwTAAtkCRUVFBQWFAkKFhUVCAwJDBMWCQwIDBUADQUAAA==','b64:JgA0AAYTFBYTFhMMCBcTFggNCAwUFQkMFBUJAAtZDBMUFhMWFAsIFxMWCA0JCxQVCQwUFQkADQUAAA==']
  alias: Muda Canal
  icon: mdi:play
  sequence:
  - repeat:
      count: "{{ canal_escolhido | count }}"
      sequence:
      - service: remote.send_command
        data:
          entity_id: remote.broadlink_ir_rf_rm4
          command: "{{ comandos_ir[canal_escolhido[repeat.index - 1]] }}"
      - delay:
          seconds: 1
1 Like

That… IS… BEAUTIFULL! Thanks!, that solved it!!! :slight_smile: Very gratefull to you!