Automate Your Projector Setup with the Broadlink RM4 Pro

Hey Smart Homers! In this article I’ll show how I used the Broadlink RM4 Pro to automate my projector and motorized screen for a hands free experience. If you prefer a video, I’ve posted one on YouTube. If you watch it and enjoy it, please consider subscribing!

Before I really started building my smart home, I bought a 100-inch motorized projector screen (controlled by an RF remote) and a projector (controlled by an IR remote) for watching movies. As I added more to my smart home, I really wished I could automate these devices. This problem is now solved with a Broadlink RM4 Pro and Home Assistant. Now I can control both without needing the remotes, and can even use Alexa voice commands to control them.

RF vs. IR

Before I actually show how I did it, I want to quickly explain the difference between RF and IR. This is important information so that you are able to troubleshoot any future potential issues with your setup. Basically RF and IR are two different wavelengths on the electromagnetic spectrum. RF stands for Radio Frequency, and IR stands for Infrared. Both of these have longer wave-lengths than actual visible light, so you can’t see them. As you can see on the diagram below, RF has a longer wavelength than IR. This is important because it results in RF signals being able to pass through walls and other solids (to a certain extent of course). Though invisible, Infrared light cannot pass through solids because it of its longer wavelength.

Electromagnetic Spectrum

This difference between RF and IR will be important later.

How the RM4 Pro Works

Ok, so now I’ll explain how the RM4 Pro works. The RM4 pro works as both a transmitter and receiver for RF and IR signals. The device can “learn” signals from IR/RF remotes, and then can transmit those signals to the various devices that those remotes control. The RM4 Pro can be integrated with Home Assistant to allow for automations and scripts using these remote signals.
Important Note: The RM4 Pro only supports RF devices that operate at 433 MHz, so you check your remote to see what frequency your RF devices use before you buy this.

Connecting the RM4 Pro to WiFi

The first thing you’re going to need to do is set up the RM4 Pro in the Broadlink app. The only use we will have for the Broadlink app is that it will connect your RM4 Pro to your WiFi network. Once this is done, the app won’t be needed anymore.

First, plug in your RM4 Pro (power) and download the “Broadlink – Universal Remote” app. Once it is installed, open it follow the required steps in order to sign in. If you haven’t already, you’ll need to create a Broadlink account. Once you’re all signed in you should be at the “Welcome home” screen. Tap “Start to use” and then tap “Add device”. Allow any permissions it requests, and then it will begin scanning for nearby devices. Tap “WiFi devices” and then follow the instructions it shows. Once connected, you should see your RM4 Pro in the device list on this screen. Now you’re done with the app! Just close it out without proceeding any further.

Next, head over to your router settings (this will vary depending on what router you have) and find the IP address of your connected RM4 Pro. It’s a good idea to reserve that IP address for Home Assistant integration.

Setup in Home Assistant

Next, It’s time to head over to Home Assistant. Click on “Configuration”, “Integrations”, and look for the Broadlink integration. Your device should already be discovered and show up on this page, but if it doesn’t, click “Add Integration”. Search for Broadlink, and click the Broadlink integration. The “Connect to the device” box will pop up, requiring you to enter the IP address of your Broadlink device that you found earlier. Enter that IP address and click Submit. Once it’s integrated, click “Configure” on the integration, and give your RM4 Pro a name and area if you like.

Teaching a New Dog Old Tricks

Ok, now comes the grind. We’re going to have the RM Pro listen for codes sent by remotes, and save those codes so Home Assistant can send them. This part is really not too difficult, but just takes some time depending on how many remotes you want to learn from. I only had two remotes for this project: one for my projector and one for my projector screen. The projector remote uses Infrared while the screen’s remote uses RF. Each button press must be learned individually. The first thing we do is head over to developer tools. From there, click services, and on the services page, search for the “remote.learn_command” service. In the Targets field, click “Pick entity” and choose your RM Pro from the list. We are going to run this service for each button press we want to “learn”, changing the information in the fields shown below each time. Check the boxes next to Device, Command, and Command Type. The Device field lets you give a name to the device that you will control, for example, “projector”. The Command field lets you give a name to the command, for example, “power”. These two fields are completely custom, so you can call them whatever you want. After this, choose the Command Type from the dropdown menu for the 3rd field. My projector operates via IR, so I chose IR. Finally, click call service, and you should see a notification appear in Home Assistant telling you to press the button on the remote. Point the remote at the RM Pro and press the button. This should cause the notification to be cleared, and there you have it, you’ve learned the first code!

Now you can repeat this step for each button on your remote that you want to have the RM Pro learn. Note that, because of what I explained before about IR not being able to pass through solids, I found that you need to point the remote straight on at the RM Pro’s orange light where the IR receiver is. This is important for when you decide where you want to put the RM Pro – it needs to be in the same room as the projector, and facing it properly so that the projector can receive the signal it sends.

Next we can program our RF remote, which is only a slightly different procedure than with IR. In the service tab again, change the name of the device in the Device field to the name of the RF device. I name it “projectorscreen”. For my screen, I’m only programming up, down, and ok buttons, so in the Command field I put “up”. Change the command type to RF, and then click “call service”. You’ll see a notification appear in Home Assistant telling you to hold the button that you are programming. The RM Pro then sweeps across a range of frequencies looking for the signal that your remote is putting out. Keep holding until the notification goes away and then let go. Another notification will appear telling you to press the button once again, so give it a single press (no need to hold it) and that notification should also be cleared. As with the IR remote, repeat this step for each button you want to program. Once that’s complete, you’re all set to start sending commands via Home Assistant! Not so bad, eh?

Commands can also be “batch-learned”; multiple commands can be learned in a row. To do this, just put a list of commands (one per line) in the command field. Then you can learn them one by one.

Testing the Commands in Home Assistant

You can then test these commands by changing the service to “remote.send_command”, selecting your RM Pro as the target again, putting the name that you chose for your device in the Device field, putting in the name of the command that you want to send, and then clicking “Call Service”.

Scripts in Home Assistant

Maybe we want to send a sequence of multiple of these commands by tapping a button. In this case, we can write a script, and then call that script with a Lovelace button card. On the scripts page, choose “Add Script”. Give it a name, and then in the “Sequence” section, set the action type to “Call Service”. The service will be the same one you just tested (“remote.send_command”) and the same target. Specify the Device and the command. When making a script, you can add multiple commands in a sequence. You can also add delays in between commands if need, and you can also control other devices as well, like lighting. I’ll show a sample script later on.

Virtual Projector Remote in Home Assistant

Another cool thing that you can do is use the “custom:tv-card” to make a virtual remote in Lovelace. The card has a bunch of pre-defined buttons that can be tied to a service. Tapping the buttons on the card will call the service that you define. I used this card to combine both my projector and projector screen remotes into a single virtual remote. The card has predefined buttons for selecting  a TV’s channels (going up and down), so I used these buttons to raise and lower the projector screen. I used the source button to select the input for my projector. If you do not specify a service for a particular button, that button will not be displayed on the card (pretty nice). Below I have left the config YAML for my custom:tv-card setup.

type: custom:tv-card
 entity: sun.sun
 name: Projector Setup
 tv: true
 power:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: power
 up:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: up
 down:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: down
 left:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: left
 right:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: right
 select:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: ok
 back:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: exit
 source:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: source
 info:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projector
     command: menu
 channelup:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projectorscreen
     command: up
 channeldown:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projectorscreen
     command: down
 home:
   service: remote.send_command
   service_data:
     entity_id: remote.broadlink_rm4_pro_remote
     device: projectorscreen
     command: okCode language: CSS (css)

Automating the Entire Setup

I have a pretty cheap projector, and every time I turn it on I have to change the input source to HDMI so that my Chromecast with Google TV with be displayed. If we want to watch something on the setup, we have to lower the screen, turn on the projector, change the input source, and then we can control the Chromecast with the Chromecast remote. I don’t mind navigating Google TV with a remote, but I wanted to automate the rest of the process so that the kids can get the projector set up by themselves. I created a script that performs all these actions in a sequence as shown earlier. First the script sends the command to bring the projector screen down, and while that’s going (it takes a while), it sends the command to turn on the projector. Since the projector needs to be fully booted up before it can receive the commands to change the source, I put a “wait” action in the sequence. After 10 seconds, the script then sends a command to open up the Input Source menu. To select HDMI, the “right” command needs to be sent twice, and then the “select” or “ok” command needs to be sent. In order to make sure my cheap projector recognizes each command, I put a one-second delay between each. After the input source is selected, the Chromecast remote can be used to control Google TV from there. I set up a button card in Lovelace to that can be tapped to run this script and set up the projector. I also made another script that turns off the projector and retracts the projector screen.

Lovelace Buttons to Call the Scripts

To make this automation much simpler for anyone to use, I wanted trigger the whole sequence with a voice command. If you have Amazon Alexa integrated with Home Assistant, your Scripts will show up as Scenes in the Amazon Alexa app. You can create a simple automation in the Alexa app that triggers these scenes. I made a Routine that triggers the “Projector Setup” script when I say, “Alexa, time to watch a video.”. Then when we’re done watching, we can say “Alexa, turn off the projector” to run the “Projector Shutdown” script.

alias: Projector Setup
sequence:
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projectorscreen
      command: down
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projector
      command: power
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projector
      command: source
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projector
      command: right
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projector
      command: right
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_rm4_pro_remote
      device: projector
      command: ok
mode: single
icon: mdi:projectorCode language: CSS (css)
alias: Projector Shutdown
 sequence:
 service: remote.send_command
 data:
   entity_id: remote.broadlink_rm4_pro_remote
   device: projector
   command: power
 service: remote.send_command
 data:
   entity_id: remote.broadlink_rm4_pro_remote
   device: projectorscreen
   command: up
 delay:
   hours: 0
   minutes: 0
   seconds: 1
   milliseconds: 0
 service: remote.send_command
 data:
   entity_id: remote.broadlink_rm4_pro_remote
   device: projectorscreen
   command: up
 mode: single
 icon: mdi:projector Code language: CSS (css)

Wrap-Up

To sum it up, I’m blown away that I can make my dumb projector and motorized screen into smart devices, and its nuts that they are controlled by one device. This device is super easy to set up and use, and I would highly recommend it for automating your projector setup. Thanks for reading, and if you’re a fan of my work, check out some of the other articles I’ve written or head over to my YouTube channel. See ya!

Posted in Uncategorized and tagged , .

Leave a Reply

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