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
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
You will see a 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.
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