Integrate BroadLink RM4 Mini with Home Assistant
Today, we are going to set up the BroadLink RM4 Mini 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.
Table of Contents
- What is a BroadLink RM4 Mini ?
- Adding a BroadLink RM4 Mini device to BroadLink app via Wi-Fi
- Adding a BroadLink RM4 Mini device to Home Assistant via BroadLink Integration
- Learn a remote controls in Home Assistant via Developer Tools
- Where to find the list of registered commands
- Set up scripts to trigger commands
What is a BroadLink RM4 Mini ?
You can configure BroadLink RM4 Mini to control devices that use an IR 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 Mini 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.
Adding a BroadLink RM4 Mini device to BroadLink app via Wi-Fi
To set up a BroadLink RM4 Mini 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.
Note
unlock device
Now to integrate the BroadLink RM4 Mini 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.
static IP address
You have the BroadLink remote set up with a Static IP address In your network.
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.
Adding a BroadLink RM4 Mini device to Home Assistant via BroadLink Integration
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.
you can configure Broadlink manually by taking the following steps:
Open Home Assistant.
In the sidebar menu click on settings.
From the configuration menu select devices & Services.
In the bottom right, click on the add Integration button.
From the list, search and select “Broadlink.”
Simply follow the instruction on screen to complete the set up.
Device info
RM4 mini by Broadlink
Firmware: 62092
MAC: E8:E8:E8:E8:E8:B3
you will get:
entity_id: remote.zhi_neng_yao_kong
Learn a remote controls in Home Assistant via Developer Tools
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.
This is the remote I am copying
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.
Go to Developer Tools | Services and enter the service name remote.learn_command (you’ll get a drop-down as soon as you start typing “remote”)
UI MODE
YAML MODE
service: remote.learn_command
data:
device: Gree
command: Cool
command_type: ir
target:
entity_id: remote.zhi_neng_yao_kong
or
You can learn IR codes by directly calling the service in the developer tools section.This is what it looks like in my case:
entity_id: your broadlink
device: your remote control
command:
- power on
- power off
Re-register commands
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.
Delete commands
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.
Sending commands
Check everything worked correctly
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.
To test the code, you only need to change the “Service”.To make sure it works after you’ve set it up, just run:
remote.send_command
YAML MODE
service: remote.send_command
data:
command: Cool
device: Gree
target:
entity_id: remote.zhi_neng_yao_kong
Note
1.When you want to send a command in an automation or script, use remote.send_command not remote.turn_on (that turns the Broadlink on…) and use the device ID and command that you created.
2.If it doesn’t work, then learn the code again.
3. the Device and Command are case sensitive. They must be identical.
4.selected Target from “Device” and not from "Entity.
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.
Open .storage/broadlink_remote_{BroadlinkMAC}_codes in a text editor.
It will look like this:
{
"version": 1,
"minor_version": 1,
"key": "broadlink_remote_eeeeeeeeeb3_codes",
"data": {
"gree ": {
"Cool": "JgBSAAABHY8UNRMRFRITNhUQFBITERMSEhQTERMTEjcUEhITExITEhITFRETExITFBETNhMSExITExETFBITEhI3EhMTNhMSExIUNRMTEwAJLRgADQU="
},
"Gree": {
"Cool": "JgBeABAUBwAEnwQAAoIICQoACGAAAR2OFTQUERUREzcUERMTExESExITFBESFRE3FBITERQSEhMSExURExMTEhQSEjUVERMTEhITExIUExETNxISFDUUERQSEzYSFBMADQU=",
"Turn on": "JgA8AAUNCAADuggAAngIAAURBxUIAAVyCREHAAHnCQACgQcAB/sKDwslCAAB2xApBwAE2A4AB5MMEQUaBgANBQ=="
}
}
}
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.
useful links
https://siytek.com/home-assistant-ir-blaster-setup-guide/
http://localhost:4999/boards/topic/14498/broadlink-rm-irrf#43486
Comments
Comments are closed