Components Home Assistant "Broadlink”

6 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: component Home Assistant
Implementation difficulties: low
Card revision: 2.1

Broadlink RM Mini 3 inclinedThe component "Broadlink” di Home Assistant provides device support Broadlink to allow the sending of infrared and / or radio frequency codes (depending on the model of Broadlink in use) from profirst personal domotics, in fact allowing us to domotize non-natively domotic components (for example traditional air conditioners).

Furthermore, the component allows integration to the configuration Home Assistant the multi-sensor Broadlink A1 e-Air.

Support for sending infrared and / or radio frequency codes is activated at Home Assistant by adding in configuration di at least a "virtual" switch defined by the component which, once created, implicitly generates two fundamental services:

  • broadlink.send
  • broadlink.learn

which serve respectively tosending and reception of the codes (the latter for the acquisition of the same).

Once created almeno a switch Broadlink - and consequently the services mentioned above - it will be possible to send infrared and / or radiofrequency codes in various ways:

  • via the switch itself (s);
  • by service broadlink.send;
  • through third-party components (such as the excellent one SmartIR).

In first case, in addition to configuring the switch in order to create the services, it is also possible to use it to send a different code (or sequence) for each of the two states "on" and "off" Among the many uses that can be used as an example, one is to define a switch that turns on / off the television by sending appositi codes.

In second In this case it is possible to directly use the service in order to send a specific code: it will be sufficient to evoke the service (from frontend, from automation, from script etc.) and, like "Service Data", to pass to it a payload that contains code and IP address of the Broadlink to be used for sending:

#esempio di un payload tipo per il servizio broadlink.send
packet: codice_da_inviare

In third case, instead, it is a matter of using external components (for example “SmartIR") In order to generate entity of different nature (eg air conditioners, fans, media player) which are then checked by sending infrared and / or radio frequency codes.

Nb this platform component allows to control also type devices sp1, sp2, honeywell_sp2, sp3, spmini2, spminiplus and mp1, which do not use infrared or radiofrequency codes, but direct commands via the network.


Activate the component "Broadlink”Provides for the addition in configuration of a switch - one for each actuator Broadlink to be integrated - so defined:

  - platform: broadlink
    host: IP_ADDRESS
    mac: 'MAC_ADDRESS'


host(string, request) The IP of the device
mac(string, request) The address MAC Device
timeout(integer, optional) The timeout, in seconds, to connect to the device
friendly_name(string, optional) The name to use to display the switch at the frontend
type(string, optional ) The model of Broadlink. Choose between: rm, rm2, rm_mini, rm_pro_phicomm, rm2_home_plus, rm2_home_plus_gdt, rm2_pro_plus, rm2_pro_plus2, rm2_pro_plus_bl, rm_mini_shate, sp1, sp2, honeywell_sp2, sp3, spmini2, spminiplus or mp1. THE device of type sc1 should be recorded as sp2
switches(array, optional) The array that contains all the switches

identifier(string, mandatory) The name of the switch. It can contain multiple items

command_on(string, application) The code in Base64 to be sent to turn on the switch
command_off(string, application) The code in Base64 to be sent to turn on the switch
friendly_name (string, optional) The name to use to display the switch at the frontend
slots(array, optional) The name to use for the 4 slots in use with an M1 power strip. If not configured, the names will be given by the sum of the string of the friendly_name of the switch plus the slot number

slot_1(string, optional) Name of the 1 slot
slot_2(string, optional) Name of the 2 slot
slot_3(string, optional) Name of the 3 slot
slot_4(string, optional) Name of the 4 slot

In case Home Assistant be running on Windows you need to install the latest available PyCripto-Wheels version.

To do this, go to his page at GitHub, write down the file name of the last release (eg. "pycrypto-2.6.1-cp35-none-win32.whl”- the one useful to probefore version of Windows, 32 or 64 bit) and run from procommand mpt the following command:

pip install --use-wheel --no-index --find-links= pycrypto

provvedendo to adapt the name of the package based on the last release name.

Infrared / radio frequency code capture

First to ask yourself proproblem of capturing the codes, the healthiest thing is to jump on ours COLLABORATIVE ARCHIVE of infrared / radiofrequency codes. With any luck, you may already find the job done. Differently, don't forget (always through that page) after collecting yours, to send them to the archive!

To define switches and / or scripts based on the sending of infrared / radiofrequency codes it is necessary - first, of course - adopt these codes.

The example given at the beginning, namely that of defining a switch to turn on / off the TV via infrared rays, will include the collectionnamento of two infrared codes, That appswitch on / off provided by the original remote control.

ATTENZIONE: in case you have a computer available Windows, as an alternative to the methods described in this paragraph, we recommend using one faster and more practical based on free TOOL "Broadlink Manager ”, described in detail in this guide.

La before what to do is therefore to define ao virtual switch you create, within Home Assistant, of two fundamental services:

  • broadlink.learn
  • broadlink.send

The first service will be necessary for 'appreturn of codes, the second to send (used by the entity which we will define in the configuration.

We therefore define this first switch:

  - platform: broadlink
    mac: '00:00:00:00:00:00'
    friendly_name: "Attuatore Broadlink"
    type: rm
        friendly_name: "Learner"
        command_on: ''
        command_off: ''

Nb The fields "host" and "mac”Indicated they are just examples and will therefore be valued with IP (fixed - read here how to set it up) and address MAC of our device Broadlink, as well as the field "type". The fields "on" and "off"Are intentionally left empty.

At this point restart Home Assistant and, in the left column of the frontend select, under the "Developer Tools" menu the first icon on the left, or "Services"

Then select the service from the drop-down menu broadlink.learn and, under "Service Data", indicate:

host: ip_del_broadlink

where obviously "ip_del_broadlink”Is the IP of the device to be used to acquire the codes.
Finally click on "Call Service".

At this point - for 20 seconds that will follow - the Broadlink (indicated through the IP) will be in "listening" for any infrared and / or radio frequency codes. Pressing within 20 seconds a button on the remote control (taking care to point it towards the Broadlink, if it is an infrared remote control), Home Assistant will receive from Broadlink the respective Base64 code and will list it at the list of notifications of the user interface (icon of bluebell top right), for example:

Broadlink Learner on Home Assistant

A code can apparire like a long string of characters, kind:


At this point, save this string and keep it aside.

Nb All devices Broadlink able to receive / send radiofrequency codes accept and send alone codes fixed. Remote controls that use rolling code no are supported. To domotize these remote controls we recommend reading this guide.

Configuration examples

After seeing how to collect the codes, let's see how to configure real switches.
The following example proputs the (working) configuration of several switches to control the switching on of Philips and LG TVs:

  - platform: broadlink
    mac: 'B4:43:0D:CC:0F:58'
    timeout: 15
      # Funzionano con molte TV Philips e LG:
        friendly_name: "Philips Tv Power"
        command_on: 'JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA='
        command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='
        friendly_name: "LG Tv Power"
        friendly_name: "LG Tv HDMI12"
        friendly_name: "LG Tv HDMI3"
        friendly_name: "LG Tv AV12"

Nb The fields "host" and "mac"Are only examples and will be evaluated with IP (fixed - read here how to set it up) and address MAC of our device, as well as the field "type"

Sequences via script

As anticipated, it is also possible define sequences for sending codes using the service "broadlink.send”Shown above.

To do this we will use one script di Home Assistant (the same technique - in the same way - can be used at the "action”Present in the automations).

The example is the following (nb the name of the script must be ALWAYS lowercase):

      - service: broadlink.send
          host: "ip_del_broadlink"
            - "codice-da-inviare-numero-1"
            - "codice-da-inviare-numero-2"
            - "codice-da-inviare-numero-3"

Obviously it may be necessary the introduction of waiting times between one sending and another.

To do this we will use a delay; in the example that follows the two codes will be separated by a wait of 2 seconds.

      - service: broadlink.send
          host: "ip_del_broadlink"
            - "codice-da-inviare-numero-1"
      - delay:
          # supporta seconds, milliseconds, minutes, hours
          seconds: 2
      - service: broadlink.send
          host: "ip_del_broadlink"
          packet: "codice-da-inviare-numero-2"

The scripts thus defined can then be triggered in the automations or even directly from type switch template:

  platform: template
      value_template: true
        service: script.la_mia_sequenza
        service: script.la_mia_sequenza_con_attesa

Broadlink A1 e-Air

As anticipated above, this component is also useful for multi-sensor integration Broadlink A1 e-Air.
We have dedicated this aspect a specific guide.

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

Please comment below