Broadlink RF code emulation

Hello.
I’ve got a question. I find myself in trouble with working on broadlink. I have lots switches to control, so I dont wont to learn the code by remote and then use that code in HA. Is there a way to emulate this code, so I can write it by myself

switch:
  - platform: broadlink
    host: 192.168.1.65
    mac: '34:ea:34:42:ef:7e'
    friendly_name: Broadlink RM Pro
    timeout: 15
    switches:
      projector_screen:
        friendly_name: Projector Screen
        command_on: 'qgCCA4sVFQsJFhULCRcJFgkXFQsVCgkXCRcJFgkXCRcIFwkXCRYKFgkXCRYKFwoXCRcKFwoWChYVCxUKCRcVCxUKFQsVCxQLFQsJFhYKCRcVChULCRcJFgkXCRcJFgkXCRYKFgkXCRcUCwkXCRYKFwoXFgoWCxYKChYJFwkWFQsJFwkWChaKFBULCRcVCgkXCRYJFxULFQsJFwkWChYJFwkWCRcJFwkWChcKFgoXDBYKFgoXChYLFgoWFgsWCwoXFQsYCxUKFgsWCxULChcWCgkXFQsUCwkXCRYKFgkYCRYJGAkXChcJGAkXFQsJFgoWCRcJFhULFQoVCwkXCRYJFxULCRYJFwkWihQVCwkXFQoJFwkWChYVCxUKCRcJFwkWCRcJFgkXCRcJFgkXCRcJFgkXCRYJFwkXCRYJFxUKFgsKFxUKFgsWCxULGAsVCgoXFgsKFhYLFgoJFwkXCRYJFwkWCRcJGAkXCRgJGBQLCRgJFwoZCRgUCxULFQsIFwkXCRYVCwkWCRcJFooVFQoJFxUKChgKFwkWFQsVCwkXChcKFgoXChYJFwkXCRYJFwkXCRYJGAkXCRgJFwoXCRoVChULCRgVChULFQoVCxULFQoJFxULCBcVDBULCRcJFwkWCRcJFgkXCRcJFgoWCRcWCgoXChYKFwoXFgoYCxU7ChYJFwkWFQwJFwkWCReKFBULCRYWCwoWChcMFxUKFgsJFgsWChcKFgoXChYKFgkXCRcJFgkXCRYJGAkYCRYJGAkYFAsVCwkWFQsVCxUKFQsVCxUKCRcVDgkXFQsVCwkXCRcJFgkXCRYJFwkXCRYJFwkXFgoKFwoWCxYKFxYKFgsYCgoXChcKF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ChcWCxULChcMFwgXChcKFgoXChcJFwoXChYKFwwXCRYKFwoXCRcKFxYKFQsJFxQLFQsVCxQLFQsUCwkXFQsJFhULFQsIFwkXCRYJFwkXCRYJFwkXCRYJFwkXCBcJFxUKChcYCxQLChcWCwgXFgsMFgoXCRYKF4oVFQsJFxULCRcIGAkYFAsVCwkWCRcJFwgXCRcJFgkXCRcJFgkXCRYJFwkXCRYJFwkWCRcWCxULChcVDBULFgsVCxgLFQsJFxYLChcVDBUMCgAF3AoXCRcKFxYKFQsJFw=='

Today I wrote this and got a switch in HA, but written code is randomly taken from some example. Then I tried to learn my switches that command, but it did not response. Should I use another command? How can i generate that code so i would not have to learn from rf, then use phone to get the code…

As far as I know you can’t unless you just happen to find the code for your specific device from someone else who has themselves learned the code for their own device.

Just learn the codes. Its not that difficult (usually…).

So, can someone share command_on and off just for try?

it won’t work.

you HAVE TO learn the code for your device.

people can give you the codes for their devices but they are bound to work just as well as the random code you tried above that didn’t work either.

Why don’t you want to learn the codes for your devices? With the time you are wasting waiting for people to give you the incorrect codes you could have learned all of the correct codes for all of your devices by now.

I want to learn myself and find better ways working with broadlink. I am waiting for remotes to come (have ordered them)
I thought it’s nice idea to write correct codes by myself, so I will not need to waste time in future
But if I have to learn the code, that is fine, I will do that.

So, one more time for doublecheck.
I want to get random code in HA. Then, I will learn wy switch to that random code and then - use it. And you are saing that it’s not gonna work.

That’s not the way it works.

Each remote transmitter and receiver pair has it’s own set of codes programmed in by the manufacturer (or in some cases by the user) to do the required functions.

When you push the button on the remote it sends the pre-programmed code to the receiver and the receiver sees the code that is sent, decodes it, and tells the device to perform the action (i.e. a light turns on). Each button on the remote has a different code that gets sent to perform a different function.

The way the broadlink device works is that it can be told to capture (or “learn”) the code that the remote is sending to the receiver. This is normally done via the Ewe-link app. Then you can tell the broadlink device to resend that “learned” code later via the Ewe-link app.

This can also be done in Home assistant using the broadlink component. You either have to export the codes from the Ewe-link app or learn them directly via Home Assistant using the broadlink component. then after you have the codes that you captured you can have Home Assistant tell the broadlink device to send the code to the receiver.

Edit to add:

Even the codes that the user can program isn’t really programmed like you want to do. Basically the codes are are preprogrammed and are selected randomly or via dip switches in the unit.

1 Like