Script learn send/ braodlink ir code (learn and send)

hello world,
i want to speak about script with braodlink IR sorry i french, the follow is in french
tu sélectionne ton braodlink, ton appareil, ta commande. tu exécute le scripte.

1/ 3 input_select.
dans input_select.yaml


    #############################
    ######## broadlink ##########
    #############################
    entity_id:
        name: Text 1
        options:
           - remote.braodlink_salon_remote
           - autres
    device: 
        name: Text 2
        options:
           - aspirateur
           - television
           - autres
    command:
        name: Text 3
        options:
           - marche
           - arret
           - son+
           - son-
           - son mute
           - menu
           - retour
           - netfix
           - av
           - autres

à modifier selon tes besoins / modify that you need

2/ puis 2 scripts :

alias: braodlink(send)
    sequence:
      - service: remote.send_command
        data:
          entity_id: '{{ states(''input_select.entity_id'') }}'
          device: '{{ states(''input_select.device'') }}'
          command: '{{ states(''input_select.command'') }}'
    mode: single  

    alias: braodlink (learn)
    sequence:
      - service: remote.learn_command
        data:
          entity_id: '{{ states(''input_select.entity_id'') }}'
          device: '{{ states(''input_select.device'') }}'
          command: '{{ states(''input_select.command'') }}'
    mode: single

enfin dans ton lovelace 1 carte / the card

type: entities
    entities:
      - entity: input_select.entity_id
      - entity: input_select.device
      - entity: input_select.command
      - entity: script.broadlink (executer)
      - entity: script.broadlink (enregistrer)

ce qui donne:
1

ne pas oublier de recharger avant la première utilisation. redémarrage ou recharger les entité et les scripts)

du coup pour enregistrer les commandes. tu les crées dans tes input_select (recharge des input select), puis tu choisi et exécute le script (enregistrer).

je comprend pas pourquoi je n’ai pas fait ca avant.:slight_smile:

3 Likes

Excellent, thank you very much this was super useful!
I added in an extra textbox for IR / RF learn but once set up, this made learning all of the buttons very quick.

1 Like

Which one? Can you post it?

my input_select.yaml:


#############################
######## broadlink ##########
#############################
entity_id:
    name: Text 1
    options:
       - remote.broadlink_remote
       - other
device: 
    name: Text 2
    options:
       - screen
       - television
       - Projector
command:
    name: Text 3
    options:
       - 'On'
       - 'Off'
       - Ch+
       - Ch-
       - Vol+
       - Vol
       - Mute
       - Back
       - Exit
       - Netflix
       - Youtube
       - av
       - Menu
       - Up
       - Down
       - Left
       - Right
       - Select
       - 1
       - 2
       - 3
       - 4
       - 5
       - 6
       - 7
       - 8
       - 9
       - 0
       - other
       
command_type:
    name: Text 4
    options:
       - ir
       - rf

I think you have to add “input_select: !include input_select.yaml” to your config though not 100%

scripts:

broadlink_send:
  alias: broadlink (send)
  sequence:
  - service: remote.send_command
    data:
      entity_id: '{{ states(''input_select.entity_id'') }}'
      device: '{{ states(''input_select.device'') }}'
      command: '{{ states(''input_select.command'') }}'
  mode: single
broadlink_learn:
  alias: broadlink (learn)
  sequence:
  - service: remote.learn_command
    data:
      entity_id: '{{ states(''input_select.entity_id'') }}'
      device: '{{ states(''input_select.device'') }}'
      command: '{{ states(''input_select.command'') }}'
      command_type: '{{ states(''input_select.command_type'') }}'
  mode: single

lovelace card:

type: entities
entities:
  - entity: input_select.entity_id
  - entity: input_select.device
  - entity: input_select.command
  - entity: input_select.command_type
  - entity: script.broadlink_send
  - entity: script.broadlink_learn

note that my broadlink is “remote.broadlink_remote” and is an RM4c with IR and RF capibility.

also if you wish to use any of the commands in other scripts, note that it is case sensitive which I spent some time figuring out last night!

Good luck!

3 Likes