The stars of this article will be the Universal Remote control Broadlink RM4 Pro with Home Assistant and Node-RED. The secondary roles will go to your existing remote controls and at the end we are going to retire them with honors.

Broadlink RM4 Pro with Home Assistant and Node-RED setup – part 2

What will you see in this article?

Last week we unbox, pair and setup Broadlink RM4 Pro with Amazon Echo Device (Alexa) and Siri. We added some appliances and we created some Scenes.

This time we will deep dive and we will integrate Broadlink RM4 Pro with Home Assistant and Node-RED.

Don’t be afraid if you can’t swim (You don’t have Home Assistant & Node-RED) and I’m asking you to dive – the water is really shallow. If you don’t believe me check these articles (Install HA, Install NR) and you will learn to swim in no time.

Why to Integrate Broadlink RM4 Pro with Home Assistant and Node-RED?

Question: Why should I Integrate Broadlink RM4 Pro with Home Assistant and Node-RED when everything is already working with the Broadlink app and my voice assistant?

Answer: You need Broadlink RM4 Pro with Home Assistant and Node-RED integration if you want to go local only and to smarten the things up a bit, actually not a bit, but a lot.

What can you do after integration?

You can make time and presence based Automations and you can involve all of your already existing devices to create useful and beautiful scenes. For example: to turn on an appliance and to switch off the lights only if you are at home and the time is right.

Let’s see how we can integrate Broadlink RM4 Pro with Home Assistant and Node-RED.

Factory reset Broadlink RM4 pro

If you already setup your device with the Broadlink app you have to reset it in order to unlock it and to use the Broadlink RM4 Pro locally without the cloud.

If you setup the device for the first time you just have to add it to your Wi-FI and stop right there. Same is valid for the factory reset devices as well. Here is how you can do it.

Factory Reset Broadlink RM4 Pro using SIM card tool.
Factory Reset Broadlink RM4 Pro using SIM card tool.

You have to use paperclip or SIM card tool to press the little button next to the power socket of your Broadlink RM4 Pro until the LED start to flashing quickly (around 10seconds).

Next, you have to open the Broadlink Mobile Application that you can find in App Store for iOS devices or Google Play for Android devices. And you have to start the pairing process as usual, but not finish it till the end.

Broadlink RM4 PRO with Home Assistant and Node-RED Integration requires unlocked device.
Broadlink RM4 PRO with Home Assistant and Node-RED Integration requires unlocked device.

To use the Broadlink RM4 Pro with Home Assistant and Node-RED (only locally) you have to stop right after your device is found and the Broadlink Mobile app is asking where the device is located (check the GIF above)!

At least for now you do not have to finish the entire process in your Broadlink app. Otherwise you will loose the local connection and the RM4 Pro will start working only from the Broadlink App – that means from the cloud.

If you finish the setup by mistake don’t worry you can factory reset the device and you can start from the beginning.

Broadlink RM4 Pro Home Assistant integration

That is very easy if you already executed the steps from above.

In Home Assistant you just have to open Configuration > Integrations > Plus Button > and search for Broadlink.

Then you have to enter the IP of the Broadlink RM4 Pro device – you can get it from your router and to click SUBMIT button.

Broadlink RM4 PRO Home Assistant Integration
Broadlink RM4 PRO Home Assistant Integration

Choose a name for the device and SUBMIT & FINISH.

Add Broadlink Temperature & Humidity sensors in Home Assistant

We can add the Broadlink Temperature & Humidity sensors in Home Assistant. You can skip this part if you have the regular cable without these sensors and go straight to the next section.

To do that you just need to add an Entities card in Home Assistant and to select the entities from the Broadlink integration that you finish in the previous step.

Adding Broadlink Temperature & Humidity Sensor in Home Assistant
Adding Broadlink Temperature & Humidity Sensor in Home Assistant

Broadlink Temperature and Humidity sensors are now added in Home Assistant.

Let’s try to learn and send some Infra Red codes.

Learning IR remote commands in Home Assistant

The fastest way to learn new IR & RF codes is to use the Home Assistant Developer tools.

Open Developer tools and and go to the Services Tab, select remote.learn_command as Service and as Service Data you can use the following:

entity_id: remote.YOUR_BROADLINK_DEVICE_NAME
device: the_device_name
command: name_of_the_command

Of course you can change the_device_name & name_of_the_command to whatever is suitable for you. And don’t forget to change YOUR_BROADLINK_DEVICE_NAME with your Broadlink name. At the end you should have something similar as below:

Learning IR command in Home Assistant using Broadlink RM4 Pro
Learning IR command in Home Assistant using Broadlink RM4 Pro

When you are ready, click on the CALL SERVICE button and a new persistent notification will appear in your Home Assistant. This notification will tell you to point your remote to your Broadlink RM4 Pro device and to press a button. That way Home Assistant will learn this command.

Learning a IR command in Home Assistant using Broadlink RM4 Pro
Learning a IR command in Home Assistant using Broadlink RM4 Pro

If the notification disappear after you press the button that means you are in the game and you are wining the match!

If you want to continue to win every week now is the time to Subscribe for my Newsletter!

NOTE! You have to repeat the learning process for every button that you wish to learn.

Send IR remote commands in Home Assistant

That is pretty similar to the learning process described above, but this time we will use different Service – remote.send_command.

Go again to the Home Assistant > Developer Tools > Services.

Choose remote.send_command as Service and as Service Data you can type the same YAML that you used in your learn command:

entity_id: remote.YOUR_BROADLINK_DEVICE_NAME
device: the_device_name
command: name_of_the_command

This is what I used in sync with the learn command that I used above:

Send IR command from Home Assistant using Broadlink RM4 Pro
Send IR command from Home Assistant using Broadlink RM4 Pro

And the command should be transmitted from your Home Assistant using Broadlink RM4 Pro device and your appliance should obey the command.

Good job!

Home Assistant Script and a Card for IR remote

To make the things easier for you and to skip using the Home Assistant Developer Tools every-time that you wish to send an IR command it is good idea to create a Home Assistant Script.

Go to Configuration > Scripts > Plus Button and follow the steps from below.

Home Assistant Script and a Card for IR remote button
Home Assistant Script and a Card for IR remote button

Alternatively you can paste the following code in your scripts.yaml file located in your Home Assistant configuration folder.

# scripts.yaml entry
turn_on_tv:
  alias: Turn on TV
  sequence:
  - service: remote.send_command
    data:
      entity_id: remote.YOUR_REMOTE_CONTROL_NAME
      device: television
      command: power on
  mode: single
  icon: mdi:television

When you have your script ready you can add a card in your Home Assistant Dashboard.

For example: add an Entities card with your newly created script and you will have an easy access to your leaned IR commands.

Home Assistant TV power on and bulb off automation

We can use one simple, but useful automation just to reveal a little what is possible. The automation will turn on a TV and will turn off a bulb at Sunset.

To create this automation you can use the graphical editor as shown in my video or you can paste the following YAML code in your automations.yaml file.

#automations.yaml entry
- id: '1602231020502'
  alias: tv scene
  description: ''
  trigger:
  - platform: sun
    event: sunset
  condition: []
  action:
  - service: light.turn_off
    data: {}
    entity_id: light.kitchen_lights
  - service: script.turn_on_tv
    data: {}
  mode: single

Of course you should adapt the code above to suit your needs. You may wish to change the entity_id: light.kitchen_lights with your lights and the service: script.turn_on_tv if the script name for your remote is different .

For the Broadlink RM4 Pro Node-RED integration you will need few things:

  • Your Broadlink RM4 Pro must be unlocked.
  • To install one new pallete – node-red-contrib-broadlink-control.
  • To get the Broadlink RM Pro IP and MAC address.

To install the new palette in Node-RED click on the Hamburger menu at top right corner > Settings > Palette > Install and search for Broadlink.

Click Install on the node-red-contrib-broadlink-control pallete.

Now you will have the needed nodes for learning and sending IR codes from Node-RED using Broadlink RM4 Pro.

Click again on the Hamburger menu > Import and copy and paste the JSON code from the following link

https://gist.github.com/peyanski/fa5c835e82d9844eb92d4047eef8d9a2

Then click Import button.

At the end you should have something similar in your Node-RED:

Broadlink RM4 Pro Node-RED integration
Broadlink RM4 Pro Node-RED integration

When you have the flow imported, you may want to change few things. Double click on the RM4 Pro node, then on a Pencil button and enter your MAC (don’t forget to remove colons in your MAC if any) and IP address. Eventually you can change the Catalog location if you wish.

Broadlink RM4 Pro Node-RED Integration
Broadlink RM4 Pro Node-RED Integration

Learning IR Codes in Node-RED

Now when you want to learn new IR Code just click on the first inject (upper timestamp node) and the Broadlink RM4 Pro will enter in learning mode. You can tell that if your LED is red.

  • You have to point a remote and press a button of your choice towards the Broadlink RM4 Pro.
  • You will then receive the code in your debug tab in Node-RED.

Sending IR Codes in Node-RED

To transmit an IR code from Broadlink Node-RED integration, follow these steps:

  • Copy the code that you received from the learning and paste it your var data = [] variable located in the functions node.
  • Click on the inject (lower timestamp node) from the imported flow to send the code.
Paste the IR code for transmission
Paste the IR code for transmission

Note about RF Codes

I failed to test the RF (radio frequency) learning and transmitting codes in both Home Assistant and Node-RED.

I actually tried only in Home Assistant by using my no-name smoke detectors from China, but the code was never learned.

In theory and according to the documentation when a new code is learned a new folder called .storage will be created in your Home Assistant configuration folder. Inside this folder there should be a file called broadlink_remote_xxxxxxxxxxx_codes.json. In this file the learned codes will be stored and you can use them in the remote.send_command.

But as I said I was unable to reproduce this. If you manage to do it – please share in the comments how you did it.

Support my Work!

If you want to secure this blog existence you can become one of my supporters you can see exactly how in this section of my site.

Any other sort of engagement on this site and my YouTube channel does really help out a lot with the Google & YouTube algorithms, so make sure you hit the subscribe, as well as the Like and Bell buttons.

You can also buy my Smart Home Getting Started Actionable Guide right here -> LINK

Also feel free to add me on Twitter by searching for @KPeyanski.  You can find me on my Discord server as well.

I really hope that you find this information useful and you now know more about Broadlink RM4 Pro how to use it and how to integrate it with Amazon Echo Device and Siri. Next week we will continue with the second part where we will integrate the Broadlink universal remote control with Node-RED and Home Assistant.

Stay safe and don’t forget – Home Smart, But Not Hard!

Thank you for reading, I will see you in the next article.


5 Comments

Rob · 01/11/2020 at 4:12 pm

RF codes and be learnt in HA. The Broadlink HA integration doesn’t currently know how to activate RF learning mode, but you can enable it via the app.

Steps
1. Setup the RM4 Pro in the Broadlink (econtrol) app.
2. Setup required remotes and buttons.
3. Confirm it all works.
4. Under the device settings in the app, make sure the device is unlocked, else the HA integration will not be able to connect.
5. Add the RM4 Pro to HA.
6. Confirm learning IR operates
7. Setup the remote.learn_command devtools service in HA as in above article.
8. Return to the app and then select the option to relearn the buttons.
9. Activate re-learn. The app will then be waiting for a remote button press.
10. Before hitting the remote button, initiate the learn_command service in HA dev tools.
11. HA will then prompt to press the remote button.
12. Press the remoe button and the HA notification should disappear.
13. Cancel the learn action in the Econtrol app, as it will not complete.
14. Open the /config/.storage/broadlink_remote_XXXXX_codes file to confirm the command is learnt.
15. Repeat 7-14 for each RF command.

Credits: Nick2525
https://community.home-assistant.io/t/guide-how-to-learn-broadlink-rf-codes/62119/121

    Kiril Peyanski · 06/11/2020 at 2:14 pm

    Thanks Rob, the only point that is bugging me is “4. Under the device settings in the app, make sure the device is unlocked, else the HA integration will not be able to connect.” I’m not sure that this is available in the latest Broadlink app. Are you able to make it work that way? Otherwise greatly appreciated your comment and efforts. Thanks mate, keep up!

Hal Vaughan · 21/10/2021 at 11:32 am

I’m working with trying to add two BroadLink devices to HA. (RM4 Mini and RM4 Pro – 1st is in our house, 2nd in another building, but they’re on the same LAN.) To add these to HA, I had to unlock the devices in the Broadlink app on my phone. Is there a reason to stop the setup at the point you specify instead of unlocking the devices once they’re setup?

    Kiril · 21/10/2021 at 12:02 pm

    No need to stop, just unlock the device afterwards and try to connect. Man, I have to update that article as well 😉

Mark Henry · 30/11/2021 at 5:49 am

Hi Kiril,
Is there a way to share Scenes with my remote friends who also have Broadlink RM4 mini’s?
Thanks,
Mark Henry

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *