For HA 0.61.1 Broadlink send/learn packet

you can check your yaml file here http://www.yamllint.com/

I have two questions related to this topic…
Up to now, I have captured codes using the e-Control app and then processing the files from it. Some of the codes I captured work and some don’t so I am looking for an alternate (and hopefully more reliable and quick) method of capturing codes. So, how does one use the switch_learn_packet command to capture codes? I was able to send one from the developer tools and a value showed up in the overview page, but it was too long to actually show the entire code? Are these results stored in a file somewhere? Do they set a variable? If I want to use that command to capture codes to later embed in a yaml file, where do I find them.

2nd question is regarding switch.broadlink_send_packet. I set up scripts in my configuration.yaml file to try to use this command and they show up in the Overview, when I activate them from that page, the LED of my Broadlink RM doesn’t blink and even my known good codes (from using them in a switch) do nothing. Here is a bit of my .yaml file

script:
  pioneer_home: 
    sequence:
    - service: switch.broadlink_send_packet_192_168_1_121
      data:
         packet:  "JgDYAAABFowRNBESETUREhATEDUREhE0ERMQNRATEDURNRATEDUQExA1ERISEhA1EBMQExATEDUREhE1EDUREhE0ETUQNRESEQADeAABFYwRNRATEDUQExATETQREhI0EBMQNRESETUQNRATEDUREhE1EBMQExA1ERIREhESETUQExA1ETQRExA1EDURNBETEAADeAABFY0RNBATEDUREhESETUQExA1ERIRNRATEDUQNRESETUQExA1EBMREhE1ERIQExATEDUREhE0ETUQExA1ETQRNRATEAANBQ=========="

Note that I have tried both double quotes and single quote around the data. Neither one generates an erroer but neither works.

So how do I get the switch.broadlink_send_packet command to work?

I mainly use to transfer code from e-control app to my pi. The code from e-control doesn’t come base64, so I convert from http://tomeko.net/online_tools/hex_to_base64.php?lang=en1

If you have service switch.broadlink_send_packet_broadlinkip in your developer tools > service. You can then do the script to send the command you want.

Once you get code from switch.broadlink_learn_*** . From your Chrome browser > more tools> developer tools> view show you the full code then you can copy and paste in your HA.

The switch platform on and off. I use is single quote ‘command packet’ not double quote.

IR Code, the problem is the distance between the broadlink device to send packet and the device received packet as it is an infrared so the distance has to be quite closed and facing direction.

RF Code, As I add one by one switch inside to test. I found only some rf switch has to double or triple the code.

When you do the switch platform. normally you will get toggle button for on and off. My switch doesn’t look like your pic. So I assume you use script. However script normally will show up as activate not off like your pic.
From the picture attached. Both are from switch platform. The display of on/off is different but both are switch from broadlink
gratia

You need to upgrade to 0.61.1. Broadlink is broken in 0.61.0.

I flashed a fresh install of raspbian lite and started over. That fixed all of it. lol.

1 Like

Hi everybody,

I red this subject because I have trouble with my broadlink rm3 mini since the update (It worked fine before).
I updated to 0.61.1 but nothing…

I have a switch :

- platform: broadlink
  host: 192.168.1.106
  mac: '34:XX:XX:XX:XX:XX'
  timeout: 15
  friendly_name: Hifi
  type: rm_mini
  switches:
    chaine_hifi_tuner:
      friendly_name: "hifi_mode_tuner"
      command_on: 'JgA0AB4dOzo7HR4cHjoeHR0dHh0dHR4dHR0fAAtZHR08OTsdHh0eOR4dHR4dHR0eHR0eHR0ADQUAAAAA'

Then I have a script which use the new form:

  radio_morning:
    sequence:
      - service: switch.broadlink_send_packet_192_168_1_106
        data:
          packet: 
            - "JgA0AB4dOzo7HR4cHjoeHR0dHh0dHR4dHR0fAAtZHR08OTsdHh0eOR4dHR4dHR0eHR0eHR0ADQUAAAAA" # Turn on radio

And finally I have an automation which use the script:

- alias: Alarm_Clock_breackfast
  initial_state: 'on'
  hide_entity: False
  trigger:
    platform: template
    value_template: '{{ states.sensor.time.state == states.sensor.alarm_time.state }}'
  action:
    - service: script.turn_on
      entity_id: script.radio_morning

I don’t understand, what’s wrong… I think I use badly the new format, but I don’t know how !!
Could you please help me ?

Thnak you !!

can you use the switch directly to turn on the hifi mode turner?

Yes,
manually the switch, and the script are working !

If it works manually then the value template is not working, here’s what I use…
value_template: '{{ now().time().strftime("%R") == states.sensor.alarm_time.state }}'

1 Like

Hi K666,
I simplified my automation to explain my trouble here, but I have other actions in addition to this one (e.g. a coffee maker turns on, and my lights turn on). The other actions work fine, so I think my trigger should be correct !
(I use a sensor for time, because, it arrived the syntax changed for now().time(), and as I use it in lot of automations, I change the syntax once and all my triggers work !) :slight_smile:

I will try to call service “switch.turn_on” in my script !

news:

- service: switch.broadlink_send_packet_192_168_1_106
        data:
          packet: 
            - "JgA0AB4dOzo7HR4cHjoeHR0dHh0dHR4dHR0fAAtZHR08OTsdHh0eOR4dHR4dHR0eHR0eHR0ADQUAAAAA"

This format works for me directly in automation, but not in a script called in an automation.

So in your script can you try…

   - service: homeassistant.turn_on
     entity_id: switch.chaine_hifi_tuner
1 Like

Hi i have the Broadlink component working well. I can learn an ir command using the web interface by calling the service and then using copy paste on the persistent notification.

Has anyone got a premade script/automation that i can use that sends the learnt codes into a text file or something that will store a lot of codes. I want to learn at least 50 ir codes in a row (i am learning the ir codes for my aircon and adding them to the repository). Copy and pasting them one by one from the web interface is a bit slow.

1 Like

Hi,

can you please share the code of these switches