A knack for controlling RF and IR devices

Kerry Clendinning of the Smarter Home Club has taken some time to help us learn to control IR and RF devices with our home automation systems!

Most RF and IR devices use protocols that are missing any “acks,” the acknowledgement of receipt of a message which is at the heart of how almost all reliable digital communications work, well,… reliably. Your cell phone, your computer, anything that’s connected to the internet, all constantly send replies in both directions, saying, basically “I got it”.

Infrared remote controls are almost always a one-way conversation. You point the clicker at the TV and press a button. In a way you are part of the conversation, in that you see the TV respond, so that’s kind of an “ack”. If you are holding down the “channel up” button and stop when you get to your favorite channel, it’s an even better analogy because there’s a feedback loop. Many RF devices, like those that operate in the 315 or 433MHz bands suffer from the same one-way limitation. With no return path, there are no “acks” being transmitted in either IR or RF protocols, so it’s really just hit or miss whether the message gets received.

Now enter the Home Automation landscape, where it’s a computer trying to send a message to control an IR or RF device, not a human. We’ve taken away the only means of feedback that were possible. The computer sends “ON” and maybe the TV gets the message. Maybe not. It can be really frustrating when your routines/automations don’t work reliably.

There are many things that interfere with IR and RF, just to make things worse. They are both subject to RF noise and IR can be blocked by ambient light. Both also suffer from something called multipath interference. Here’s a blog post I did about improving IR reception, some time ago, http://blog.smarterhome.club/2018/12/01/ir1/, which also talked about multipath interference.

Regardless of why the signals aren’t getting through reliably, here are some time-tested ways to improve on the situation.

(1) Use DISCRETE codes.

Many devices, including most everything that Sony has ever built with a remote control, have features, or you might say “buttons” that aren’t on the remote control that shipped with the device. Some of these extra “buttons” are called discrete codes by the IR hacking community. The big ones: ON and OFF.

Most remote controls have a POWER button. If you can’t see or hear the device you are controlling, you don’t know what the next press of the button will do. You have to have the very same kind of feedback that HA is missing: Knowing the current state.

Well, the discrete ON/OFF codes are “ON and I mean ON” and vice versa. If you aren’t sure a signal is going to get through, it’s far better to sending a clear message like “ON” instead of something that toggles each time, like “POWER.” If you research discrete codes and investigate your own devices and their remote protocols, you might find things like direct choice for the “DVD” input, when the handheld remote requires repeatedly pressing “INPUT SELECT”. Far better for home automation to use the direct DVD choice.

(2) Using a discrete code, you can now send it repeatedly, to help mitigate reception problems.

If all you can send is POWER, which toggles a device, repeating the same signal is counterproductive. See if you device supports discrete ON/OFF, or some other clever approaches I’ll cover in #3.

It should also be mentioned here that most remote controls repeatedly send a code when you hold down a button (especially buttons like volume up/down). This allows the operator to send until it’s apparent that the device has received the code. I’ll cover how you can make a device called a Broadlink RM Pro or other similar devices send a longer code, which works even if you don’t have discrete codes in #4.


So with a discrete “ON” and “OFF”, you can tell your smart home routine or automation to send a signal multiple times to help insure that the device gets the signal. That’s a good step towards insuring that you get the result you want.
(3) Some devices that don’t have a discrete ON/OFF code do have an interesting alternative, which effectively allows turning the device on more reliably. Check every other button on the remote that came with the device, and see, with the device in an OFF state, if something like INPUT SELECT might trigger the device to come ON.

I have used this in the past to more reliably control ON as well as OFF. To insure a device is ON, repeatedly send whatever the alternative button you found that causes it to come on. To hopefully insure the device is OFF, doing that followed by one “POWER” signal might improve the situation, by first getting in sync with the ON state of the device.

(4) If you are using a Broadlink device in particular, there’s actually a way to disassemble the code you are using and change it so that it automatically repeats–and this works* even with the POWER button if you don’t have discrete codes! Here’s the tool: https://dimagoltsman.github.io/Random-Broadlink-RM-Code-Generator/ Click on the tab that

*Every IR receiver I’m aware of won’t receive a new code until a pause following the previous burst. Only then will a new, different button press be recognized. What this means is that the remote control can continue to send a signal in order to make it a better chance that it is received. It works the same way with a smart home device.

(5) Forcing the state with secondary control over power.

Many devices will go to a known state when you break and restore the AC power. Usually the known state is “OFF”, but I have bluetooth controlled light bulbs that default to ON.

By controlling the power with a secondary means (smart switch or plug) a known state can be established, then a single POWER remote signal can be sent if needed.

(6) Feedback… detecting the state of the device.

If you can determine by some other means whether a device has responded to a previous automated request the routine or automation can more intelligently repeat the request when it fails.

A “smart” TV might have an ethernet connection that can be “pinged” to find out if it’s on. That’s one approach. Sensors that detect the current draw of an operation device is another. Sound, temperature, light… All sorts of things could be used as feedback. If a device has a power indicator LED, detecting that with a small photodetector stuck onto it is a good way to determine the state.

Once you have feedback, controlling a device with HA to put it in a known state is fairly straightforward, but you might need to work out the timing.


Automating otherwise “dumb” remote controlled devices as part of a smart home can be fun, but at times challenging due to reception issues. The more you understand about how the communications protocols for IR and RF actually work, the better you can diagnose problems and work on more reliable solutions. Hopefully the ideas presented here added to your toolkit.

SmarterHome.club is the website for our Facebook community, The Smarter Home Club – which is an umbrella for all kinds of smart home technologies – home automation, security, custom electronics, weather stations, alternative energy, you name it. DIY focused.

If you’re interested in joining the Smarter Home Club’s Facebook group, please follow this link:

The Smarter Home Club on Facebook