Generating SmartIR codes with the help of AI

Broadlink box: Broadlink RM4 Mini (Amazon)

The Bosch heat pump (Bosch Climate 6101i) in one of our installations is controlled via a Broadlink IR hub and SmartIR in Home Assistant – no cloud, no official integration, just an IR hub that learns and re-transmits the same signals as the original remote control. The original setup is described in more detail in Case: IR Control of a Heat Pump in Home Assistant.

The learning itself was done by setting the heat pump to each temperature via the physical remote and, for each one, calling Home Assistant’s remote.learn_command service, which put the Broadlink hub into a temporary listening state and recorded the IR signal under a chosen name. This is how I originally got 10 heating codes – one per degree from 16 to 25°C, all with the fan set to auto. Recently I went through the same process for cooling and got 10 cooling codes added to the SmartIR file. 20 codes in total, all with auto fan.

The hub operates at the raw signal level – it simply records and re-transmits a fixed sequence of infrared pulses, stored under a name. It’s SmartIR that adds the abstraction layer: a regular climate entity with temperature, mode and fan speed, which looks up an entity file to find the right code and sends a command to the hub to play back exactly that one.

That didn’t provide all the control options I wanted, and it would have been nice to also be able to choose fan speed. But with 5 speeds times 10 temperatures times 2 modes, the math quickly became unmanageable – potentially 80 new recordings, each with its own trip to the remote, its own remote.learn_command, its own name to keep track of. That’s when I decided to try something different: instead of recording my way through every combination, I wanted to see if an AI could find the pattern in the codes I already had, and work out the rest itself.

How the process with AI went

I had 20 full codes (10 heating + 10 cooling, all with auto fan) – already learned and working. Instead of testing all 80 combinations, the AI (Anthropic Claude) suggested a controlled experiment: learn just 4 new codes – the 4 fan speeds at one fixed temperature (22°C).

Claude then decoded all 24 codes into their raw bytes and compared them. By keeping the fan fixed and varying temperature (the 20 original codes), one byte could be isolated as “temperature”. By keeping temperature fixed and varying the fan (the 4 new codes), other bytes could be isolated as “fan speed” – the two were separate and predictable.

One byte, however, remained unexplained – a kind of checksum with no visible pattern. Here the AI searched a number of sources (GitHub issues, open source IR libraries, forums on IR protocols) to see if anyone had already documented something similar. That led to a publicly documented checksum formula, which matched 100% against my own 24 codes.

With the formula known, the AI set up a hypothesis: that the fan speed’s contribution to the checksum byte was the same regardless of temperature. I tested the hypothesis with a single generated code – a combination I had never recorded – directly on the heat pump. It worked, and the AI could then generate all the remaining codes at once.

So now I’ve managed to create SmartIR codes for all combinations of temperature for heating, cooling, and fan speed, as well as fan-only mode. A big job, but much less than if I’d had to learn in every single code.

Feel free to check out my SmartIR codes for Bosch Climate 6101i.