Can I create virtual devices/entities that map to learned commands for my Broadlink RM4 Pro IR/RF transmitter?

I have a Broadlink RM4 Pro IR/RF transmitter. I added it to HA and was able to use it to learn/send commands for my RF devices like ceiling fans.

I can invoke those commands by using the remote send commands function.

I wanted to create some kind of “virtual device” for things, like my ceiling fan, with 1+ entities for various things (e.g. fan speed 1, fan speed 2, light toggle, etc.).

I know I can add button cards to my dashboard but I’m wondering if there is a way to create virtual devices instead?

Or create a template helper from gui

People often create a script for a command, then call the script when they want to invoke it.
Here’s what I did.

Right now I have created 7 template buttons (one for each speed, one to turn the fan off, and one to toggle the light). This mimics the buttons on the remote.

It works but I don’t like that I have to create/manage/maintain 6 template buttons that aren’t related/grouped.

I thought I could use the template fan entity but it requires a way to get the state of the fan and that won’t work since I have no way to know the current state of the fan. Someone could do something with the physical remote and HA wouldn’t know.

That’s really the whole issue with IR/RF… You can always use helpers to store the current state (but that only works if you only use HA to interact with the device AND the signals are reliably received).

The simplest advice is to remove the batteries from the remote, so that it increases the friction / encourages people to use the automation.

I am aware of three ways to get feedback:

  • Monitor the power consumption.
  • Some devices have a door that opens, hence you can use a contact sensor.
  • Use a vibration sensor.

Its unlikely that you will get perfect feedback - for example to know the exact fan speed, however you may not need it.

I have a “dumb” AC that I control using IR, specifically

  • Toggle on/off
  • Cycle through the modes: Eco, Cool, Fan, Heat
  • Set the target temperature.

The only feedback I have is a single Vibration sensor.

I remember the state of the AC (inside HA) then fix it if I detect an anomaly.

Hint: What happens if you power cycle a device?
… They usually go back to a known configuration.

You could set up a IR receiver to read whatever is sent from the physical remote.

That still isn’t reliable, commands can easily be missed.