Broadlink RM4 Mini - Unable to find service remote.learn_command

Hello!

I have a Logitech Z906 system at my desk that I control with a Klikr from my phone. But since its battery has the habit of running out when I use it - I don’t actually use it that often - I felt to replace it with something that is plugged into power. And besides, Android likes to complain the Klikr app uses an outdated Bluetooth API, which is also why the app was removed from the store and can only be installed from the manufacturer’s website. So even more reason to look for an alternative.

What caught my eye was the Broadlink RM4 Mini, and because I saw Home Assistant has an integration that supports it I bought one. I was a little disappointed when I saw the device configured in the app didn’t get carried over into Home Assistant like I know from other integrations (IKEA & Hue), but I guess the little device (compared to the Klikr it’s actually quite chunky) doesn’t actually store the configured devices, they’re only known in the app…

So following the documentation I wanted to create a script to learn the codes:

alias: Learn Logitech Speaker Commands
sequence:
  - service: remote.learn_command
    data:
      entity_id: remote.wi_fi_remote_remote
      device: logitech_speaker
      command:
        - turn_on
        - turn_off
        - select_source
        - volume_up
        - volume_down
        - volume_mute
mode: single

However, trying to execute the script I get the error message

If I recall correctly, at some point I read in the changelogs that some namespaces were moved around, and I also found other topics that say that for an apparently similar Xiaomi device the service name is i.e. xiaomi_miio.remote_learn_command so I tried wi_fi_remote_remote.remote_learn_command or broadcom.remote_learn_command in the service panel but neither seem to exist.
I also can’t seem to find any remote related service if I search in the service panel:

After registering the commands I’d like to bind them to a universal media player entity hoping lovelace will put a nice UI for it onto the dashboard :slight_smile: .

Do you have any tips for me on how to proceed with the missing service?

System Health
version: 2020.12.2
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
virtualenv: false
python_version: 3.8.6
os_name: Linux
os_version: 4.19.118-v7+
arch: armv7l
timezone: Europe/Berlin


logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok


dashboards: 2
mode: auto-gen
resources: 0

Hi, Is the RM4 device recognized? Did you use the Broadlink integration through user interface or yaml? You should see something like this

.

Then check the Services in Developer tools and try to find remote.learn_command with that device

Haven’t test the scripts, but you can do it one at the time through the service.
The codes are stored in the config/.storage/ (hidden folder) and in a file like Broadlink_remote_xxxxxxxxxx_codes

1 Like

Hi,
thank you for your reply.

Yep

I configured it with the UI.

Nope, unfortunately there are no remote services there to select as I’ve shown in the screenshot in my original post :frowning: .

Did you try removing the integration and set it up again?

I had tried that before, yes. But I just removed it again anyways, restarted Home Assistant and then readded it. Now it works. Thanks :smiley: .

Now I just got to figure out how the states for the universal media player work. After all I’m not getting any feedback whether the device is turned on or off…

After a bit of looking around I found SmartIR which takes care of a couple of things for me and provides me with exactly what I was looking for. Sweet :slight_smile:

Very nice, I hadn’t seen that one!

I’ve been struggling with this. Currently got it in nodered learned but would like the code as a script to automation.

Where am I going wrong here? learn command> Rmmini selected> command ‘turn on’

Getting this error:

got similar problem but my error message is:
Failed to call service remote.learn_command. Expecting property name enclosed in double quotes: line 17 column 9 (char 7040)

@yonny24

Are you able to fix this? If so can you please give me the structure of yaml? It’s been half month I cannot learn any IR code… Thanks!

Hi @sirhideo,

Below is an example of a yaml structure defined within the GUI script interface for learning command:

Hope this helps!

@guymaurier Thank you very much for your reply. However, it does not work. Doing the yaml at Services or Script has the exact same error, as attached. It is so frustrating there is no support for this… :frowning:

Hello,
did you solve the “double quotes” problem?
thanks

@crionline no, still getting this error…

Solved deleting the config file

/config/.storage/broadlink_remote_xxxxxxxxxxx_codes

Sorry to revive this, but I ran into the same issue.

Turns out I had a comma in the file after the very last command because I was copy-pasting things around. Removed the unnecessary comma and it works. That’s probably why deleting the codes config file worked for you.