In this guide, we'll go over how to install and configure Alarmo with Home Assistant
Today, we are going to set up the BroadLink RM4 Pro universal remote. We’ll set it up with Home Assistant, and I’m also going to show you how to configure remote controls so you can control devices like TVs directly from Home Assistant.
What is a BroadLink RM4 Pro?
The BroadLink RM4 Pro is a universal remote just like the Logitech Harmony hub. You can configure it to control devices that use an IR or RF remote control. Then, using the BroadLink app on a mobile device, you can send commands to those devices. However, we are going to integrate the BroadLink RM4 Pro with Home Assistant, so you will only need to use the app to configure the RM4 Pro remote to connect to the Home Network. After that, you can continue the configuration in Home Assistant.
BroadLink RM4 Pro initial set up
To set up a BroadLink RM4 Pro for the first time, the device out of the box should be in setup mode. So, after you plug it in, the light on the front should start flashing intermittently.
Open the BroadLink app on a mobile device, tap on the Plus icon and then Add device. Select the Wi-Fi Devices option and on the next screen, select Universal Remote. On the following page, the setup page shows you how your device should be blinking when it’s in setup mode. Tap Next, and now you need to go to your WiFi settings and connect to the BroadLink_WiFi_Device network. Go back to the BroadLink app and tap on Done.
BroadLink recommends disabling mobile data while you are doing the setup. So, in the notification panel (If you are on Android), turn Mobile data off. Then, in the app, tap on Setup completed. Next, select the WiFi network that you want the universal remote to connect. After the WiFi setup completes, Select the universal remote and then tap Join the room to add the remote to a specific room. Tap on Next, and rename the universal remote. Tap Save, and if you purchased the RM4 Pro with the temperature sensor in the cable, you could tap on Save on the next screen. Otherwise, tap on Skip.
Now to integrate the BroadLink RM4 Pro to Home Assistant, you need to unlock the remote. So, tap on Use device now to exit the setup. Tap on the menu icon on the top right, uncheck the option, Lock device, and tap OK to confirm on the pop-up that comes up.
The BroadLink remote is now connected to the home network, and it is also unlocked. At this point, you no longer need the BroadLink app. However, before you integrate the BroadLink remote with Home Assistant, you need to set it up in your router with a static IP address. If you need to locate the remote’s MAC address, you can go back into the BroadLink app, select the universal remote, tap on the menu icon on the top right, and you can find the MAC address under Device info.
Integrating BroadLink with Home Assistant
After you have the BroadLink remote set up with a Static IP address In your network, open your Home Assistant instance and go to Configuration, Integrations, click on Add Integrations, search for BroadLink and select it.
On the pop-up that comes up, enter the remote’s static IP address under Host. Click Submit, then set up a name for the remote and click Submit again. Lastly, add the remote to a specific area and then click on Finish.
Add remote controls
The process to add new remote controls to Home Assistant could be a little time-consuming, depending on how many remotes you would like to add. The reason for that is that you would need to register each button on a remote. However, the process is still simple.
To add a new remote and register the buttons, open Home Assistant, go into Developer Tools, Services, search for remote.learn_command, and select that service. Under Target, click on Pick device and select the BroadLink remote. Then, select Device and add a name for the specific device that the remote control is for. After that, select Command and add the name for the button you would like to register. To make the process faster, you can also register several buttons when you run this service. You would need to add the names for the buttons one below the other. Then, when you have the list of commands you would like to register, click on Call service.
After you call the service, open the notification panel, and you will see the instruction to press the button on your remote. Then go to your BroadLink remote, and the light on the front would be in red. Hold your device’s remote control directly at the BroadLink remote and press the button that you would like to register. If you are adding several buttons, after you register the first one, the notification panel will tell you the next button you need to press on your remote control.
Adding RF remotes
When you register buttons, the command type is set up by default to IR (Infrared). However, to register an RF (Radio frequency) button, you need to change the Command type from IR to RF. When you call the service, the notification panel shows the instruction to press and hold the button you want to register. The light on the Broadlink remote will be lit in red while it is checking the frequency. Then after a few seconds, the notification goes away, and another notification comes up asking to press the same button again to register the new RF command.
If you register the wrong button by mistake, you can run the process again to register the right button. When you call the service to register a button already registered, Home Assistant will overwrite the existing one with the code for the new button that you press.
If you want to delete one of the registered buttons, you can use the service remote.delete_command, select the BroadLink remote under Target. Select Device and enter the name of the device’s remote control. Then, under Command, enter the button’s name that you would like to delete and then click on Call service.
To test if a command is working. You can call the service remote.send_command. Under Target, select the BroadLink remote. Under Device, select the device that you would like to send the command to. Then, under Command, enter the name of the button and then click on Call service.
Where to find the list of registered commands
If you need to see the list of commands you have registered for your remotes, go to the Home Assistant configuration files and locate the Storage folder. This folder is hidden, so you would need to enable the option to show hidden items in the File Explorer. Once you open that folder, locate the broadlink_remote_codes file, and you’ll be able to see the names and codes for the buttons of your remotes.
One thing to have in mind is that you do not want to edit this file manually. If you need to change, add or remove a command, you need to do it directly from the web interface using the process I showed you before.
Set up scripts to trigger commands
To execute the commands from the web interface, you now need to create scripts for those commands. This would create entities that you can add to your Home Assistant interface and easily trigger those commands.
So, in your Home Assistant, go to Configuration, Scripts, and click on Add script. Set up a name for the script and also an icon. Then, under Sequence, Set the Action Type to Call service. Under Service, search for remote.send_command and select it. Now, under Target, click on Device and select the BroadLink remote. After that, select the Device option and enter the device’s name that you would like to send the command to. Then, under Command, enter the name of the button that you would like to execute.
There are other useful variables here that you can use. For example, the Repeats option comes in handy when setting a script to raise or lower the volume a specific number of times with just one click. The Delay option can also help when you are executing several commands in one script. And the Hold option is good for remotes with a button that triggers a second command when held for a few seconds. Save the script and run it to verify that it’s working properly. You can then add the script as a button on your dashboard and easily trigger the command to control your device.