Broadlink rmc4 mini frustrations

I am getting really ticked off trying to integrate a RMC4 mini into my HA setup. The instructions seem to be all over the place and I have no clue what the latest instructions actually are.
I am using the latest version of HA under Linux Version 2020.12.7 as reported under supervisor - system - supervisor even though I supposedly upgraded earlier today to a 2021 version.
To begin with, what do I need to put into configuration.yaml
I have tried this:
switch:

  • platform: broadlink
    host: 192.168.50.209
    mac: ‘a0:43:b0:18:be:a6’
    type: rm4c_mini
    name: rm4c_mini

I get this error in the log:

Invalid config for [switch.broadlink]: [type] is an invalid option for [switch.broadlink]. Check: switch.broadlink->type. (See ?, line ?).

8:55:45 PM – Hass.io (ERROR)

If I replace ‘switch’ with ‘remote’ I no longer get the error.

Now lets assume I run this as ‘remote’ - everything ‘seems’ to work. The Broadlink integration shows the rm4c mini. I can go to Developer Tools - services -remote.learn_command and select the rmc4 mini as the entity. Next there is an ‘optional’ yaml section that doesn’t seem to be optional at all. I use this:

entity_id: remote.universal_remote_remote
device: television
command: Turn on
command_type: ir

This actually appears to be correct since I can press ‘call service’, the light on the rmc4 lights up steady and I get a notification to press the ‘turn on’ button. When I do this, the notification goes away and all seems fine.
There is no notification of the command string anywhere, there is no file in the config directory that lists the command string, there is no entry in the configuration.yaml file of the command. It seems ike I will need that command string later so where could it be ???

I then run this:
entity_id: remote.universal_remote_remote
device: television
command: Turn on

I get a brief light up on the rmc4 mini and it seems the command was sent but the TV does not turn on or off (this is a toggle type button)

I repeated the experiment withe the button ‘1’ for the TV (ie go to channel 1)
I recorded it and then sent it - the TV did actually receive the ‘1’ button press but multiple times.
I recorded the ‘1’ button again but this time didn’t hold down the button on the remote for as long, played it back and got fewer ‘1’ characters but still more than just one.

Maybe if I could see the command that is sent then I could somehow edit the send string to just send out one character but of course I have no clue where this data is kept.

Very frustrating …

Besides the location of where the command string is located, are there any other things I am doing wrong ? Should it be ‘switch’ or ‘remote’?

Sorry about this lengthy post … it’s just so frustrating when there are many versions of the instructions and things just don’t seem to come together.

1 Like

The custom IR/RF Switches does not have the host as in this Broadlink Integration example.

# Example configuration.yaml entry
switch:
  - platform: broadlink
    mac: MAC_ADDRESS
    switches:
      - name: Philips TV
        command_on: JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=
        command_off: JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=

If you have successfully learn a code, you can find the list in the hidden folder .storage. Look for a file call broadlink_remote_XXXXXXXX_codes.

Thanks fr your input duceduc!

I am using the HA ‘file editor’ plugin. It gets me to the config directory that has, for example, configuration.yaml in it. It does not contain a folder .storage. It does show hidden files as it shows a file .HA_VERSION. Could the .storage folder be in a different directory ?
OK, done some more digging with the info you gave me and it looks like .storage is not in /config but in /configuration based on what is said in the Broadlink integration documentation. Further investigation shows that there is no /configuration and also shows that the .storage folder does in fact exist in the /config folder. For those as puzzled about this development like me - turns out that just because a hidden FILE is shown (.HA_VERSION) does not mean that a hidden folder (.storage) would be shown. I am not sure how to make that folder visible with the standard file editor plugin.
Since I can only get at the file via terminal and since I haven’t found a way to copy/paste from a terminal window to a regular HA file window, these codes are basically un-copyable (for now) … but hey, it’s progress !!!

Do you have any thoughts on how I can avoid getting multiple code reads on a single ‘learn’ service call ? Do I need to give different arguments or options in the call?

Since I am learning all kinds of new stuff here, is there a way to auto-populate service call parameters where you get a drop down list of available commands when you are trying to send a command to for example the device ‘television’ ? Let’s say I have taught the command ‘previous channel’ but I am not sure if I called it ‘prev channel’,‘previous channel’ or ‘last channel’ - do I need to go to the HA console, look into the file with the codes, find the name I used, somehow copy the command string and then paste that into wherever? Seems like an overly complex situation especially if I have multiple devices. Anyway, is there a better way that I have just not discovered yet or is it too early in the development process to expect to see such niceties ?

Again, thanks for your help. I have learned a bunch today!

It is a hidden folder under config. You can either SSH to your HA device or install the Samba add-on to browse it with your computer instead, but the file editor won’t get you there, at least not any way I can see - no config to show hidden files/folders in File Editor - which is actually a good thing because most of the stuff in there shouldn’t be played around with unless you understand the syntax of each file (i.e., several are JSON, if you mess up just a single comma then HA will break).

Thanks CO_4X4,
Thanks for the suggestion of the Samba add-on and the (dire) warning re messing up a single comma to mess up the entire HA installation. Maybe I don’t really want to access that directory :slight_smile:

That being said, viewing the Broadlink configurations won’t break anything, but if you change them they will snap back (at least they did when I mucked with them), but at least you can see what your commands and devices are called.

Yes, I am just playing with that and getting EVERYTHING just right (also case sensitive) is essential.
I think I will make a spreadsheet with all the commands to reference otherwise this is going to turn into a giant pile of doodoo :slight_smile:

I am good on learning and sending the IR calls but am unable to delete previously learned codes:

entity_id: remote.universal_remote_remote
device: television
command: Turn off

I get a websocket API error and the tracebacks show a ‘NotImplemetedError’

I am afraid of manually editing the file …

If you edit that file you won’t break anything (more than likely) but it won’t do you much good since it may just regenerate.

What you could possibly do is copy all the codes in that file and then, instead of learning the code, you could pass the IR base64 code directly, then you never have to worry about storing them at all. Or even write a script to stash your saved codes back into Broadlink.

For me I have about 500 codes so this is a tough thing to do, but if you only have a handful then it’s no big deal.

500 ??? OMG

I tried deleting the file and yes, it just comes back.
Is the delete command not implemented as suggested by the error message or did I possibly do something wrong ?
When you say ‘copy all codes’, I am assuming we are talking about using the Samba add-on to copy the entire file over into an area that can be edited ?
I am afraid my Linux foo is not up to ‘writing a script to stash saved codes back into Broadlink’
I was actually thinking of creating a file with all the IR codes and including that file in configuration.yaml but it seems like a substantial effort if I end up with hundreds of codes (which actually doesn’t sound as odd as it looks on first hearing that number)

No, what I meant was that you can copy the b64 codes and just apply them by hand install of recalling a saved code:

script:
  turn_on_tv:
    sequence:
      - service: remote.send_command
        data:
          entity_id: remote.bedroom
          command: b64:JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=

Sending a saved command is just a shortcut to send the b64 string anyway, so you don’t really lose anything by doing this except maybe a modicum of convenience. For me I have a script for each remote that has every code anyway, so I don’t even lose that if I were to switch to pure b64 instead of providing a device and key.

Bonus is that if you save all your b64 codes in a spreadsheet then if you ever switch remote devices or home automation platforms you have them handy, I learned this the hard way after my third software switch, now I have the b64, hex and binary codes for all my remotes :slight_smile:

For the record, it seems that the codes are held in memory and are re-written to the file when the system accesses the file. If you delete (or modify) the file with the codes and then reboot the system, the file deletion or modification appears to be permanent.

I am good on learning and sending the IR calls but am unable to delete previously learned codes:

I was on the same boat as you when HA started rolling out the Broadlink integration. I didn’t know where things were, etc. Before the integration, I was saving all the codes in a yaml file ( I still think this is the best way).

So by now, I am sure you are quite familiar with the integration. I don’t think you can delete previous ir codes after you learn it. I just ended up starting from scratch after I figure how things work. Before learning the codes, write down all the names you want and make sure it is correct before you start learning the codes. This way you will not have regrets if the name isn’t correct or what not.

That is what I have done (made a list of the calls). I must admit though, I haven’t progressed as my attention went into other areas.
Just to repeat from my previous post in this thread, you can indeed delete part of or the entirety of the learned codes by editing the file with the codes and rebooting the host. Rebooting has to be done prior to doing anything else or the file will be reconstructed, presumably from memory.

I haven’t progressed as my attention went into other areas.

Hehe. I do the same. While searching for answers and trying to finish one task, I get side track finding new tasks and do the new find instead. What I ended up having is a bunch of unfinish started tasks. Now I tell myself, finish one thing at a time.

I have an excuse - most of the other tasks are related to HA. I am about 3/4 finished replacing 7 light switches with Sonoff Basics. The other task that unfortunately has stalled is trying to figure out a way to prevent my Sonoff zigbee PIR from reporting ‘unavailable’ when there hasn’t been a change in status in about 6 hours. I think this one will require somebody with more brain power than me though :frowning:

Decided to get going and scanned in a bunch of frequently used codes, maybe 30 or so and that was rather painless. Trying to write a script took a while using the HA GUI system but I finally figured that one out as well.
Building a half way decent Lovelace display - well now there is a project that (at this point) seems rather daunting :frowning: Time to go back to one of the other unfinished and easier tasks …