Using ESPHome to control outdoor IR RGB lights

I’m trying to use ESPHome with an esp32 to control some outdoor RGB lights that have an IR remote control. What I can’t figure out how to do is expose this as a (custom?) light. Is there an easy way to call the IR remote actions from within the (Arduino) C++ code of the custom light? Or perhaps a better way to expose the light?

I know that I can expose the remote as buttons directly, but I’m trying to get the Home Assistant UI to show this as a light (although it would only ever approximate the RGB values since I don’t think the IR protocol allows specific RGB levels).

I don’t think it will work because Your lamps only support the colors that are on the remote

What if you set up a template light in HA and use automations to send the commands to the ESP.
So when you press a red-ish color then the automation would have to interpret that as red and send that command to the ESP.

I hadn’t thought of that - I was trying to do everything within ESPHome. Thanks for the suggestion! I’ll try to use the template and a script in HA.

Yes and no - while I can’t set individual RGB values to these lights, my thought was that the script (template) would approximate the closest color available and then set the lights to that.

For example, setting the light to #FF4040 might actually select #FF6030 (the closest color available on the remote)