A guide for setting up an remote control with Broadlink and Grid Card (momentary buttons)

This is my guide on how to set up a remote control using the Broadlink integration, never having to touch codes generated by the remotes/broadlink. This is completely through the Homeassistant UI. This will give you momentary buttons that have no “state” in home assistant, instead of setting up switches this method uses scripts that can be used throughout home assistant and node red.

This is the remote I am copying

N.B. You don’t really need individual scripts for each button as once a remote is learned it can be used by the call_service option throughout but I find this way once set up scripts can be added with icons etc without the hassle. It depends on how your head works (or doesn’t in my case)

This is assuming the integration is already set up, there are loads of videos on how to do this.

It works purely with text links to a file created in the home assistant by the Broadlink integration.

These will be
entity_id: (your configured broadlink device i.e. RM Pro)
Device: which is your remote control
Command: which is each button

To set up (learn) a remote control create a new script, in configuration/scripts

Add Script

and fill in

Name: (name of the script)
Icon: (if you want) i like hass:remote-tv
Entity ID: (this will generate itself, I don’t change this)
Mode: (leave it single)

Action Type: set this to Call Service
Service: Set this to remote.learn.command
This then presents a drop down box (if you have more than one broadlink), set this to the broadlink you want to use that has been set up in the integrations

In the service data box

entity_id: your_device
device: your remote control name
command:
power (list all of your buttons here keeping this format)

entity_id: your broadlink
device: your remote control
command: 
  - power (example)

Save the script and find it in your list of scripts, this will prompt you to learn each button. Please note that this also records the length of time you press the button as well.

Run the script by pressing play

run the script

You will see a notification

notification

Open notifications and you will see a dialogue box, this will prompt each button in your list within the script you have created,
Don’t worry about getting it wrong as it can be repeated. When it’s finished your codes are saved.

learn command

That is your remote stored

Now it’s time to create a script for each button

Once again create a new script

Name: (each button is a script, there will be many scripts so try and put something common in each script name so it’s easy to find later, in this case I am using BR Amp)
Icon: Representative of your button
Mode: leave as single

Action Type: Call Service
Service: remote.send_command
Name(s) of entities: your configured broadlink

Service data
device: reciever (this is the name you set up in your learn script, which links your buttons to the file in Homeassistant)
command: the button name (from the list in your learn script, another reason why I like this method is there is a record of all of your stored buttons)

device: your remote control
command: your button

Save, you now have a useable momentary button

Repeat this step for each button

Go nuts, add to lovelace grid card

Finished

To Add one button or re-teach one button, can be done in the developer console, on the call service tab

Have Fun

6 Likes

Thanks for your work Jamie, I fully used your solution, and even I went nuts and tried the lovelace grid, but I found another realistic solution:


AS you can see, I just created the most used buttons, and with an image card, set the buttons call on the picture!!! I hope somebody likes it to.

4 Likes

Great integration! I was looking to implement a push/momentary button and this idea is awesome. Thanks!

This improvement is the cherry on the top of cake. Can you please detail how you select zones over an image? I’m not very familiar with the image card. Thanks.

Hi Joao, here I attach part of the remote. I builded up scripts, one per selected button (I show 4 of them, power, input, settings and info), using a Broadlink rm4 pro. You need to take a photo of the remote (or download it from google), and set it in the local folder (as jpg of png). then the programming is:

type: picture-elements
image: local/ico/LGremote.png
elements:

  • type: state-icon
    entity: script.lg_power
    style:
    top: 12%
    left: 30%
    tap_action:
    action: toggle
  • type: state-icon
    entity: script.lg_input
    style:
    top: 17%
    left: 30%
    tap_action:
    action: toggle
  • type: state-icon
    entity: script.lg_settings
    style:
    top: 17%
    left: 45%
    tap_action:
    action: toggle
  • type: state-icon
    entity: script.lg_info
    style:
    top: 17%
    left: 60%
    tap_action:
    action: toggle
2 Likes

Thank you for your help. It works now!

Wow,

I was hoping someone would find this useful. I hated having a load of switches in lovelace that weren’t actually switches. Your remote looks brilliant.

I am rather new to HA so please I am probably missing a step (or two) but I have the RM4C mini connected and working with the Broadlink integration (or at least I think so) I tried to test it by creating a script per you tutorial:

alias: Learn IR commands
sequence:
  - service: remote.learn_command
    data:
      command: power
    target:
      entity_id: remote.rm4c_mini_remote
      device_id: 4fd360171f092295e269a1f19cbe0b16
mode: single

but if run it , nothing happens (no Notification to learn the command)
Can you tell me where I have gone wrong?

You can learn IR codes by directly calling the service in the developer tools section. I find that so much easier than writing a script. This is what it looks like in my case:


I usually just start with just one command and once that works, multiple together, like all fan modes, all temp settings, etc.

Keep in mind, that (most times) you need to be able to send the exact command, e.g. in order to send power_off, the device needs to be on before you start. Or in order to send “71” degrees, it needs to be at 70 or 72.

2 Likes

As a follow up to how I initially did this, I now just go straight to developer tools an remote: learn command and keep a one note record of what “device” and “command” I have learned, and use the call service option in automations and in the dashboard, not clogging up my scripts section. It’s a lot cleaner that way