Broadlink RM4 Pro and Home Assistant Button

New Broadlink RM4 Pro and Home Assistant Button

Just got this today and I thought it would be simple and straightforward to add it Home Assistant and allow me to control my 10 year old RF Switches from a simple button.

Three hours later and I finally have a working (but ugly) button that works with just a click.

In the time setting it up I have looked at a few threads in here and watched a few linked videos, but nothing seemed to have the whole answer and some were old. So I figured I would upload this here in the hope that it might help someone else click when they are trying to get one working.

Getting the device into Home Assistant was pretty straight forward:

  1. Add the device to your wifi
  2. Then in ‘Devices & Services’, add the Broadlink Integration and configure it with the IP address.

Then the fun bit starts:

Adding codes to Home Assistant using Developer Tools

NOTE - All names are case sensitive

(Seemed to need to add the Broadlink as both an Entity and a Device)

When you are clicking the remote button to get the system to recognize the signal it appears to be doing nothing until suddenly the light goes off. At that point stop pressing the button and wait for the orange light to come back on, then the next press should result in a green tick appearing over the ‘Call Service’ button for a second.

(This appears to be confirming that the button it has learnt is actually the right one)

Testing the button is learnt is simple, just change the Service to ‘Remote: Send Command’.

Getting a Button on Dashboard

I am not sure this is the right way, so I am sure someone will be along to improve it, but this worked.

I created a ‘Helper’ toggle item

And then two Scripts

First, turn on lights and set the helper state to ON

And then do the same for turning the lights OFF and the helper state to OFF

I then made a third script to toggle the lights on/off

This was done using ‘+ Add Building Block’ and selecting ‘Choose’

So if the Helper is showing as ON, run the script to turn the lights OFF etc.

Nearly done, now add a button

It’s not pretty, but it works, and hopefully will help others get it working.

Broadlink is not the most elegant of integrations… :grin:

An alternative is to set up custom switches in the Broadlink integration - the result is very similar.

The problem with that, if I’m reading it right, is that you really need two switches or the ability to know what the current state actually is. The whole point of the old style RF switches is that there is no feedback.

I wanted a single toggle, and also using the scripts also allows other automations to change the settings and also update the current state in one command.

At some point I will mess with the buttons, but the main goal of getting this to work was to try and bring some sense to my parents setup which currently has about 8 remotes with multiple buttons on each and no one has any idea what turns on what. With this I can just get everything on a tablet for them.

I have also ordered some transmitters and receivers to use with ESP boards but thats the future version…

It’s a single switch. On sends the on command and off sends the off command.

  - platform: broadlink
    mac: MAC_ADDRESS
      - name: Philips TV
        command_on: JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=
        command_off: JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=

You’re right, though, you can only ever have an assumed state.