If you have some appliances that are not smart, i.e., without network capacity, but controllable by a IR/RF remote, then they can controlled from Home Assistant via a universal remote and some add-on or integration in Home Assistant. One universal remote I found to work well is Broadlink universal remote (the model I have is RM4 Pro).
For an initial setup of the Broadlink device, an official Broadlink mobile app is needed to connect the device to the home network. Write down the IP address and Mac address of the Broadlink device that are available from the app. After this is done, the app is no longer needed. Then we install the Broadlink integration according to the instructions. The Broadlink device will be automatically discovered and configured by the integration.
Next, we shall learn commands from the IR/RF remote. For this, go to Developer Tools -> Services and select the Remote: Learn Command service and set the target to the Broadlink device. Also, provide a description of the appliance (e.g., TV) for the Device ID field and a description of the command (e.g., turn on TV) for the Command field, and then click the Call Service button. A notification will be sent to the Home Assistant to instruct us to point your IR/RF remote to the Broadlink device and press the button on the IR/RF remote that we want to learn. We then follow the instruction and the notification will disappear to signify that the command has been learned. To learn another button, we simply change the description of the Command field and call the service again.
The learned commands are stored in a file named broadlink_remote_xxx in the folder /config/.storage. This is folder is accessible from the File Editor. In case that you could not find the folder in the File Editor browser, go to Supervisor -> File Editor -> Configuration, then delete the line - .storage
under the ignore_pattern
block, and restart File Editor. In the data section of the file broadlink_remote_xxx we can see a list of devices, the commands and their related IR/RF codes.
Next, we create entities in the swtich domain to utilize the codes we just learned. For this, we first add a new line switch: !include switch.yaml
to /config/configuration.yaml without leading indent, and then create a new file switch.yaml uder the folder /config. In this new file, we place the following code, where
- the block under switches should be replaced with yours and the codes for command_off and command_on are copied from your broadlink_remote_xxx file;
- the IP address of host is the IP address of your broadlink device ;
- mac is the MAC address of your broadlink device.
After restarting Home Assistant, we can then find the corresponding entities (such as swtich.aircon_study_room and swtich.tv_master_room). These entities act as if they were a real switch, e.g., the can be used in Home Assistant automations. Note that the entity names will be the lower case of concatenation of the words of friendly_name.
platform: broadlink
host: 192.168.1.110
mac: f0:93:b1:a1:cf:5f
switches:
aircon_study_room:
friendly_name: "Aircon Study Room"
command_off: 'JgA2AWY1DA4MKAwODA4MKAwODCgNDgwODCgMKAwoD'
command_on: 'JgA2AWY1DA4MKAwODA4MKA0NDSgMDgwODCgMKAwoDA4M'
tv:
friendly_name: "TV"
command_on: 'JgBYAAABJJITEhMSExIT'
command_off: 'JgBgAAABJpAUERQRFBEUERQRFBEUNBUQFTQ'