Automating IR Devices With Homebridge

Why? Because it’s cool to come home from work and have your TV and other favorite IR controlled hardware power on. Automatically turn the tower fan on when it gets over 75º in the bedroom after sunset. “Hey Siri, it’s movie time”; mute the TV, turn on the surround sound, and dim the lights. Trigger a music playlist to run on your sound system via AppleScript when you arrive home at the end of the day, every Friday obviously. Maybe I’ll explore that last one later.

Previously, Apple required all HomeKit products to use their certified chips for security purposes. On June 5th, 2017, Apple announced they were replacing this policy with the ability to authorize new HomeKit devices via software. This guide may be completely obsolete in the future if companies such as Broadlink are allowed to provide firmware updates that take advantage of the software authorization process. Until then, I’m hoping this guide can come of use to someone.

The official Git repo will tell you to update your config.json with HEX codes captured in Wireshark. While that’s true, it’s incredibly vague, I’ll do my best to expand on the process. By now you should have installed Homebridge and its dependencies on your pi or other device. Make sure you have already installed Xcode as well (you won’t need to know how to use it). This tutorial assumes you have already set up the RM Mini3 on your network, and have already added/controlled an IR device through the official Broadlink App.

Caveats

So far there only seems to be one problem I’ve ran across. There appears to be an issue with the dummy signal broadcasted after the initial signal is sent, which can cause inconsistencies when controlling a device. The only way to get around this is to send a different IR command before returning to the original IR command. This issue does not seem to be present for everyone. It could be as easy to fix as performing a reinstall, I haven’t tried yet.

Let’s get started!

  • Install the RM Mini3 Homebridge plugin:
install -g homebridge-rm-mini3
  • Connect your iPhone to your computer and launch iTunes.
  • Select your iPhone, click your iPhone’s IUID and copy it.
  • Leave your phone plugged into the computer, move to the next steps.
  • Fire up Terminal and enter:
rvictl -s "YOUR IUID HERE"
  • Be sure to paste your IUID that you just copied from iTunes.
  • Confirm Terminal displays a success message. Keep your phone plugged in.

We need to capture packets sent over the network. The data sent from your iPhone to the RM Mini3 is encrypted, which is why the previous set of steps is crucial.

  • Launch Wireshark and select rvi0
  • Start capturing packets by clicking the blue fin icon at the top-left.
  • Leaving your phone plugged in, open Broadlink app. Navigate to the IR command you wish to automate and tap it a couple times for good measure.
  • Stop the current capture by hitting the red square icon.
  • Sort the capture by the source. Chances are there are several devices on your local network already, so you will need to know both your phone’s and the Mini IR3’s local IP addresses in order to locate the correct traffic in this list. When you locate your phone it should indicate that a UDP signal was broadcasted to the RM Mini3. Right click the packet and select “copy as hex stream”. Paste it into a text editor to come back to.
  • Go back to Terminal and update your Homebridge configuration:
sudo nano /home/pi/.homebridge/config.json
  • Add your IR device:
"accessory": "RM mini3",
			"name": "Tower Fan",
			"host": "10.0.1.8",
			"data": [
				{
					"type": "on",
					"on": "5aa5aa555aa5aa55000000000000000000000000000000000000000000000000e6f6000037276a005c8270fafb0d43b4010000005dc8000040ed16df05dd04b7e25d99740c1c987382431ad19851000ff4259644999396fe4095c553d5772d16fc171973d6f20d4faa1d97cef81641ada7cffcd35b7d06b2acd916552b821e05fa34fc15fb8bf2010a9bb27c40fa0f82ef18be383eed36bd", 
					
					"off": "5aa5aa555aa5aa5500000000000000000000000000000000000000000000000027f7000037276a009f8070fafb0d43b4010000005dc8000040ed16df05dd04b7e25d99740c1c987382431ad19851000ff4259644999396fe4095c553d5772d16fc171973d6f20d4faa1d97cef81641ada7cffcd35b7d06b2acd916552b821e05fa34fc15fb8bf2010a9bb27c40fa0f82ef18be383eed36bd"
				}



				
			]
  • Go back to the code you pasted into the text editor. In this case it’s the tower fan’s on and off. Just be sure to remove all characters before “5aa5aa55…”, the commands will not work if you do not do this. Make sure to update the host with the correct IP of your Broadlink Mini3.

You’re all set! Save your config and reboot Homebridge.

Protip: Sign into your router and reserve the IP of your Broadlink Mini3 and all your other devices. It will save you the headache of having to edit your config every time your network gets restarted.


  1. Thanks a lot for the detailed description. I figured out to install XCode for the rvi monitoring, that one I missed from the desciption. But really, really, thanks a lot for the detailed description, you saved a lot of hours probably to install my rm mini3 to control my air conditioner. thanks again!


    • Glad it helped! After having XCode installed for so long I guess I just blanked on it. I’ll definitely update the guide to include it. I will also be adding a new guide for IR stuff using a better library soon. Thanks for the comment!


  2. Hello

    I did everything as told over here. But my Broadlink mini 3 doesn’t seem to respond. I can see the UDP packet sent message in my home bridge .
    The only thing I notice is the following:
    1. UDP packet sent message happens twice every command (probably due to the dummy message?)
    2. In Wireshark, the broadlinkrm RM mini 3 message was in QUIC protocol (not UDP. I guess QUIC is a derivation of UDP but still does it make a difference here?)
    3. the content of the message beyond 5aa5aa… is not EXACTLY the same every time. It is slightly different even though command is same. Is that expected?


    • Hi Mushfique,

      Yes, the second signal you are seeing broadcasted over your network is the dummy command.

      I am unsure about the compatibility with QUIC unfortunately. I’m running on a brand new machine right now and haven’t got around to setting my environment up yet fully.

      I don’t see why the string should differ if it’s the same command you are trying to invoke each time.

      Based off what you said, it sounds like a couple of things are going wrong. Are you sure you are using the correct IP address? When you issue the command in HomeKit you should see the led indicator on the RM mini 3 lighting up. I’d start there. Once you’re sure you have the correct destination you can poke around in Wireshark a bit more.

      After I wrote this guide, I found out about a new RM mini 3 plugin forked from this repo. It’s a huge upgrade and packed with a ton of features. I plan on giving it a shot when I get around to it eventually.

Responses to Josh

Click here to cancel reply.