Broadlink Universal Remote

Model: Broadlink RM 4 mini IR

Home Assistant now has a broadlink integration to directly learn and send remote commands without using base64 raw codes.

  1. Install Broadlink integration and identify the IP address of Broadlink remote device

Learn remote commands

  1. Go to HA developer tab -> Services
  2. Select remote.learn_commands
  3. Select the entity id for the remote
  4. Tick the checkbox beside device and enter a name for the device to control. Can be anything as long as it is identifiable.
  5. Tick the checkbox beside command and enter any name for the command as long as it is identifiable. It will be used for sending commands
  6. Click call service. Broadlink remote will blink. Use the IR remote to send the command.
  7. Thats it! Commands is learnt and stored in HA.

Send remote commands

  1. Go to HA developer tab -> Services
  2. Select remote.send_commands
  3. Select the entity id for the remote
  4. Tick the checkbox beside device and enter device name entered from learn_commands
  5. Tick the checkbox beside command and enter command name entered from learn_commands
  6. Click call service. Command should be sent to the device and your IR device should react accordingly.

Old Manual Method

In order for home assistant to interact with broadlink connected devices, home assistant is required to learn the IR codes first.

Python Broadlink GitHub

  1. Create virtual environment first and pip install broadlink before using below commands
  2. Obtain broadlink RM device details (make sure in cli folder first)

python broadlink_discovery
3. To make things easier for cli to reference to the device information, create a file in cli folder named BEDROOM.device with contents of RM device details from above command e.g 0x613a 192.168.1.xx a04bcde3351
4. To learn IR codes (learnt IR code will be stored in a file in cli folder of file name e.g aircon.poweron)

python broadlink_cli —device @BEDROOM.device —learnfile aircon.poweron
Note: Command parameters is double dash! e.g —device is double dashes

In order for the learnt code to be usable in Home Assistant, convert the string to base64 using Hex to Base 64 Converter

Using IR codes in Home Assistant

  1. Open Configuration.yaml with in-built file editor
  2. Look for section under switch and add the following:
 ..- platform: broadlink
..host: 192.168.1.93
....mac: a0:43:b0:31:f5:81
....switches:
....- name: fan
......command_on: IR base64 code from above
......command_off: IR base64 code from above
....- name: aircon
# and repeat as neccessary
  1. Save configuration,yaml, proceed to server control and check configuration before restarting home assistant.
import broadlink
devices = broadlink.discover(timeout=5)
devices[0].auth()
devices[0].enter_learning

Using IR codes in Home Assistant Scripts

b64:raw_IR_codes