How to create a custom device with buttons so that it can be added to HomeKit?

I have a light/fan combo that has an infrared remote control with a lot of buttons on it (light on/off, fan off, fan speed 1-6, color temperature, etc.). I bought a Broadlink RM4 mini that can learn the infrared commands and send them on demand.

As I understand it, I have to learn all the codes of those buttons on the remote, then create corresponding scripts for each button. I did so for a few buttons and it works.

I have also succeeded to add scripts when using HomeKit bridge, but they appear as separate buttons instead of a single “appliance” (or entity?) with multiple buttons.

So my question is how to create such “fake/virtual” device and add custom buttons to it so that it appear as single appliance on HomeKit?

Two devices is the best you can do:

1 Like

Thanks for the help. Writing script seems to be overly complicate for me, I just thought there could be simpler way to do this, like the UI.