Broadlink Universal Remote
Model: Broadlink RM 4 mini IR
Broadlink Integration
Home Assistant now has a broadlink integration to directly learn and send remote commands without using base64 raw codes.
- Install Broadlink integration and identify the IP address of Broadlink remote device
Learn remote commands
- Go to HA developer tab -> Services
- Select remote.learn_commands
- Select the entity id for the remote
- Tick the checkbox beside device and enter a name for the device to control. Can be anything as long as it is identifiable.
- 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
- Click call service. Broadlink remote will blink. Use the IR remote to send the command.
- Thats it! Commands is learnt and stored in HA.
Send remote commands
- Go to HA developer tab -> Services
- Select remote.send_commands
- Select the entity id for the remote
- Tick the checkbox beside device and enter device name entered from learn_commands
- Tick the checkbox beside command and enter command name entered from learn_commands
- 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.
- Using python-broadlink allows the extraction of raw IR code which can then be used in home assistant.
Usage of Python Broadlink CLI
- Create virtual environment first and pip install broadlink before using below commands
- 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
- Make sure to add Broadlink integration in Home Assistant first.
- Broadlink - Home Assistant
- Open Configuration.yaml with in-built file editor
- 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
- Save configuration,yaml, proceed to server control and check configuration before restarting home assistant.
Using Python Broadlink python library as Python script
import broadlink
devices = broadlink.discover(timeout=5)
devices[0].auth()
devices[0].enter_learning
Using IR codes in Home Assistant Scripts
- Use āRun Serviceā command
- Entity select broadlink device
- Command will be:
b64:raw_IR_codes