Send Multiple command with Broadlink Rm Pro

Hassio v0.66 with Rpi 2 B

Hello Everyone,

I’m curently using a Broadlink Rm pro IR+RF to commute my TV, Light Switches…
Everything works well, but there is a switch that too often needs me to send 2 times the command to be executed. To bypass this issue I would like to send the command 2 times, each time I trigger it ON and OFF.

Here is my configuration for the switch:

- platform: broadlink
  host: 192.168.0.34
  mac: 'xx:xx:xx:xx:xx'
  switches:
    lumiere_chambre:
      friendly_name: "Interrupteur Chambre"
      command_on: '6QpCAN8JCRYJFhYJCRYJFgkWFgkWCRYJFgkJFhYJFgkWCQkWFgkJFgkWFgkWCQkWCRYWCRYJFgkWCQkWFgkJFgkWFgkJFg=='
      command_off: '6QpCAN8JCRYJFhYJFgkJFhYJCRYJFhYJFgkWCRYJCRYJFhYJFgkJFgkWFgkJFgkWCRYJFhYJFgkWCRYJFgkWCRYJFgkJFg=='

Is there a way to keep the On and Off functions and send for both states 2 times the command?

Thank you for your help :+1:

1 Like

I need this for a vacuum that won’t start if I use the “on” command, it needs the “off” command to wake up before if it’s been off for a while. :crazy_face:
As I use it in an automation, I just had to call several times the switch action :

   trigger:
    - platform: state
      entity_id: binary_sensor.somebody_home
      to: 'off'
      for:
        minutes: 40
  action:
    - service: switch.turn_off
      entity_id: switch.aspirateur_rdc
    - delay: 00:00:05
    - service: switch.turn_on
      entity_id: switch.aspirateur_rdc

If you want it in the frontend, I would suggest to do the same with a script and place the script in the frontend. Might use CustomUI Tiles to have a nicer look.

The command packet actually includes a byte to tell the Broadlink RM how many times to repeat the command:

Byte 0x05 is the repeat count. By default this is set to 0, but you can change this quite easily.

But first of all you’ll need to convert your command into Hex using:

Bytes 0x00 to 0x03 seem to be added to the start of the packets by the broadlink component so the first byte you should see in the hexadecimal side actually corresponds to offset 0x04, so you’ll want to edit the second byte.

But I do notice that your commands don’t seem to follow the protocol like mine do, so maybe it didn’t learn those ones correctly?

Hope this helps!

5 Likes

Thanks for your help! I’m still a noob in Hassio as I was only running homebridge on my Pi for few monthes and discovered home assistant recently.
Do you have a link for a tutorial to set up this?

In theory this is exactly what i’m looking but frankly I’m completely lost in this!
My commands are for a Broadlink TC2 wallswitch with 2gangs (RF 433). I’ve managed to get the hex code using an android emulator and rm-plugin-lite so I think those are the good ones.
Can you help me to recognize those bytes that have to be changed?

Thank you for your help!

Edit:
Maybe this can help

First of all, I can explain the script, but I don’t use the tiles interface.

For the script, add something like this :

script_name:
  alias: 'Several RM codes'
  sequence:
  - service: switch.turn_on
    entity_id: switch.you_switch_name
  - delay: 00:00:05 # maybe not that much in your case, even not needed ?
  - service: switch.turn_on
    entity_id: switch.your_switch_name

Tiles are here, someday I’ll take time to try this as it’s nice to have this look on the frontend.

Problem solved! Thanks for helping me with the scripts, this will be the next thing to master.

@alextwo You were right, looking at what I posted 0a = repeat 10 and using the link you provided, changing it from 0a to 1a. Now the command is effective no matter what I’ve done before

Hope this will help someone else!

1 Like

Great! Glad you were able to get it working

Awesome tip! Used it to change my projector’s off code and now don’t need goofy scripts to send the same signal twice (that didn’t work consistently either).

Hi All! I have a similar problem I was hoping you guys could help with.

I am testing a battery powered RAEX motorised blind that uses 433mhz RF. I also have a Broadlink RM Pro.

I have managed to add it to the Broadlink e-control app and it works just fine. However when I add it to HA, I found that it only works while the blind is already in motion. If it is stationary at the top or bottom of its limits it doesn’t work. It is like the blind goes to sleep very quickly after the last button push. Being battery operated that would make sense.

I spoke with the very helpful Australian reseller who’s son had managed to reverse engineer the RF signal from the blinds and developed an Arduino solution that controls the blinds. https://nickwhyte.com/categories/electronics/ Speaking directly with the son, Nick told me that he experienced the same issue while he was developing his solution and to fix it you need to send several short bursts of the command to ‘wake it up’ and then it should work. Following the great advice from this forum above, I have managed to repeat the commands easily enough however I notice that when I repeat the commands, it takes longer and the LED stays on longer. When I just send one command it takes about 1 second, when I send 4-10 commands it takes noticeably longer. Unfortunately the speed at which its doing the bursts of data is simply not fast enough. Nick advised to send the payload 4 times close together(say less than a second), and repeat the transmission 7 times. However the close together is the problem at this point.

I know the RM Pro is capable of this fast burst of RF code as it works just fine on the app, so the hardware must be capable. Just in HA does each send of the command seems to take too long. I have tried setting the ‘timeout:’ to 0 to see if it made any difference, which it does, but it still takes about 1 second for I am guessing 1 command.

Does anyone have any idea on how to alter the delay between each command being sent? Perhaps set it to a low number? For reference, Nick’s code is here:
https://github.com/nickw444/homekit/blob/1296191b36866830fbfa8ec9cc930c16b1e6092c/esp-fw/esp-blindkit/src/send_queue.cpp#L3

For completeness, my HA code is the following:

switch 2:
 - platform: broadlink
   host: 192.168.55.XXX
   mac: 'XX:XX:XX:XX:XX:XX'
   timeout: 0
   switches:
     loungeblind1:
       friendly_name: "Lounge Blind 1"
       command_on: 'sgCEAxcVGBQXFRgUGBQYFRcUGBQ.....
       command_off: 'sgCEAxgUGBUYFBgVGBQYFRcVFxUY......

If anyone can please help, it would be really appreciated.

Thanks.

Thanks!:grinning:

Fantastic, didn’t know about it. Perfect to turn off my projector

Hi is there an easy fix changing the code in HASS?

That’s my command on (same as off, off needs to be repeated 2 times)

optoma:
command_on: ‘JgCEAxM2FDUUNRQRFDUUERMSExEUERMSExEUNRQRFDUUNhM2EwAFsAABJ5IUERQRExEUNRQRFBETERQRFDUUNRQRFBETNhMSExEUERM2FDUUNRQRFDUUERQRExEUERMSExEUNRQRFDUUNRQ2EwAFsAABJ5IUERQRExEUNRQRFBETEhMRFDUUNRQRExITNhQRExEUERQ1FDUUNRQRFDUUERQRExEUERQRExEUNRQRFDUUNRQ2EwAFsQABJpIUERMSExETNxMRFBETEhISEzYUNhMRExITNhQRExEUERM2FDUUNhMRFDUUERMSExEUERQRExETNxMRFDUUNhM2EwAFsAABJ5MTERMSExITNhMRExIUERMREzYTNxMRFBEUNRQRExISEhQ0FTYTNhISFDUUERQRExISEhMSExEUNhMREzYTNxM2EwAFsQABJpMTERQRExITNhMRFBEUERMRFDYTNhMRFBEUNRQRExITERQ1FDUUNhMRFDYTERQRFBETERQRExITNhMRFDYTNhM2FAAFsAABJpMTERQRExITNhMSExETEhMREzcTNhMSExEUNRQRFBETERQ1FDYTNhMSEzYTERMSExITERQRExISNxMSEzYTNhM2FAAFrwABJ5MTERQRFBETNhMSExEUERMSEzYTNhMSEhITNhQRFBETERQ1FDYTNhQREzYTERMSFBETERQRExITNhMSEzYSNxM2FAAFrwABJ5MTEhMRFBETNhMSExEUERQREzYTNhMSExEUNRQRFBETERQ1FDYTNhQREjcTEhMRFBETEhMRFBETNhQREzYTNhQ1FAAFrwABJ5MUERMRFBETNhQRExEUERQREzYTNhQRExEUNRQRFBETEhM2EzYUNRQREzYUERMRFBETEhMRFBETNhMSEzYTNhQ1FAAFrwABJ5MUERMRExIUNRQRExEUERQREzYUNRQRExEUNhMRFBEUERM2EzYTNhQREzYUERISFBEUERISExITNhMSEzYUNRQ1FAAFrwABJ5MUERISExITNhMSExITERMSEzYUNRQRExISNxMRExITEhM2EzYTNhQREzYUERMRFBETEhISExITNhQREzYTNhM2FAAFsAABJpMUERMSEhITNhMSExISEhMSEzYTNhMSExISNxMRExITEhI2FDYTNhMSEzYTEhMSEhITEhISExITNhMSEzYTNhM2EwANBQAAAAA=’

1 Like

Changing the 2nd byte worked for me, thanks!

Had some issues where my AV receiver didn’t always turn on or off, but now it’s more reliable.

@Klagio try this, I used the converter to decode it to hex, changed the 2nd byte (2nd set of 2 digits) from 00 to 02, and then encoded that as base64:

JgKEAxM2FDUUNRQRFDUUERMSExEUERMSExEUNRQRFDUUNhM2EwAFsAABJ5IUERQRExEUNRQRFBETERQRFDUUNRQRFBETNhMSExEUERM2FDUUNRQRFDUUERQRExEUERMSExEUNRQRFDUUNRQ2EwAFsAABJ5IUERQRExEUNRQRFBETEhMRFDUUNRQRExITNhQRExEUERQ1FDUUNRQRFDUUERQRExEUERQRExEUNRQRFDUUNRQ2EwAFsQABJpIUERMSExETNxMRFBETEhISEzYUNhMRExITNhQRExEUERM2FDUUNhMRFDUUERMSExEUERQRExETNxMRFDUUNhM2EwAFsAABJ5MTERMSExITNhMRExIUERMREzYTNxMRFBEUNRQRExISEhQ0FTYTNhISFDUUERQRExISEhMSExEUNhMREzYTNxM2EwAFsQABJpMTERQRExITNhMRFBEUERMRFDYTNhMRFBEUNRQRExITERQ1FDUUNhMRFDYTERQRFBETERQRExITNhMRFDYTNhM2FAAFsAABJpMTERQRExITNhMSExETEhMREzcTNhMSExEUNRQRFBETERQ1FDYTNhMSEzYTERMSExITERQRExISNxMSEzYTNhM2FAAFrwABJ5MTERQRFBETNhMSExEUERMSEzYTNhMSEhITNhQRFBETERQ1FDYTNhQREzYTERMSFBETERQRExITNhMSEzYSNxM2FAAFrwABJ5MTEhMRFBETNhMSExEUERQREzYTNhMSExEUNRQRFBETERQ1FDYTNhQREjcTEhMRFBETEhMRFBETNhQREzYTNhQ1FAAFrwABJ5MUERMRFBETNhQRExEUERQREzYTNhQRExEUNRQRFBETEhM2EzYUNRQREzYUERMRFBETEhMRFBETNhMSEzYTNhQ1FAAFrwABJ5MUERMRExIUNRQRExEUERQREzYUNRQRExEUNhMRFBEUERM2EzYTNhQREzYUERISFBEUERISExITNhMSEzYUNRQ1FAAFrwABJ5MUERISExITNhMSExITERMSEzYUNRQRExISNxMRExITEhM2EzYTNhQREzYUERMRFBETEhISExITNhQREzYTNhM2FAAFsAABJpMUERMSEhITNhMSExISEhMSEzYTNhMSExISNxMRExITEhI2FDYTNhMSEzYTEhMSEhITEhISExITNhMSEzYTNhM2EwANBQAAAAA=

Hello. I have tried this for Broadlink IR codes. Changing the 2nd byte may well be repeating the code, but the IR device I am trying to control needs a delay between the code being sent. Is there a way of changing the delay between commands? A bit I can change somewhere?

Thanks.