Model: Broadlink RM 4 mini IR
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)
- 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
To learn IR codes (learnt IR code will be stored in a file in cli folder of file name aircon.poweron)
python broadlink_cli —device @BEDROOM.device —learnfile aircon.poweron
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:
1 2 3 4 5 6 7 8 9
..- 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
1 2 3 4 import broadlink devices = broadlink.discover(timeout=5) devices.auth() devices.enter_learning
Comments powered by Disqus.