|Proconductor: Home Assistant Community|
Availability: included in thepersonale HUB Home Assistant
Type: component Home Assistant
Implementation difficulties: low
|Card revision: 2.1|
The 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:
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 host: 192.168.1.100 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.
- Infrared / radio frequency code capture
- Sequences via script
- Broadlink A1 e-Air
Activate the component "Broadlink”Provides for the addition in configuration of a switch - one for each actuator Broadlink to be integrated - so defined:
switch: - 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|
|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|
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=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto
provvedendo to adapt the name of the package based on the last release name.
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:
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:
switch: - platform: broadlink host: 192.168.1.2 mac: '00:00:00:00:00:00' friendly_name: "Attuatore Broadlink" type: rm switches: learner: 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:
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:
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.
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:
switch: - platform: broadlink host: 192.168.1.2 mac: 'B4:43:0D:CC:0F:58' timeout: 15 switches: # Funzionano con molte TV Philips e LG: tv_philips: friendly_name: "Philips Tv Power" command_on: 'JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=' command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=' tv_lg: friendly_name: "LG Tv Power" command_on: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU=' command_off: 'JgBYAAABIJISExETETcSEhISEhQQFBETETcROBESEjcRNhM1EjcTNRMTERISNxEUERMSExE2EjYSNhM2EhIROBE3ETcREhITEgAFGwABH0oSAAwzAAEfShEADQU=' tv_lg_hdmi1_hdmi2: friendly_name: "LG Tv HDMI12" command_on: 'JgBIAAABIZMRExITEjYSExMRERURExEUEDkRNxEUEjYSNhM3ETcSNxITETgSNhI2ExMQExE4ETYSNxIUERMSExE4ETcRFBETEQANBQ==' command_off: 'JgBQAAABJJMSEhISETgSEhITEBMSEhMSETcSNxMREjcSNxI3EjcSOBETERITNhM2EhITERM2EzcRNxI3ExISEhI3EjcRExETEgAFLQABJEoRAA0FAAAAAAAAAAA=' tv_lg_hdmi3: friendly_name: "LG Tv HDMI3" command_on: 'JgBIAAABIZMSFBISETgRExEUERQQFBETEjcTNhMSETgRNxE3EjcROBM2ERMSFBE4ERMSNxM2EjUSFBE2ETgRExM2ExITEhATEwANBQ==' tv_lg_av1_av2: friendly_name: "LG Tv AV12" command_on: 'JgBIAAABIpQPFBITETgSEw8UEhQSEhEVDzgSOBAUETgQOQ84EjgRNxITETgSExA5EDgREhI3EhMROBMSEDkQFBETEjYTEhE4EQANBQ==' command_off: 'JgBIAAABH5YPFBETETgUERAUEBURFBATETgROBEUETcSNxE4ETcSOBISEBUQFREUEjUSFBA5ETcRNxE4ETkQOBAUEjcRFRAUEQANBQ=='
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"
As anticipated, it is also possible define sequences for sending codes using the service "broadlink.send”Shown above.
The example is the following (nb the name of the script must be ALWAYS lowercase):
script: la_mia_sequenza: sequence: - service: broadlink.send data: host: "ip_del_broadlink" packet: - "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.
script: la_mia_sequenza_con_attesa: sequence: - service: broadlink.send data: host: "ip_del_broadlink" packet: - "codice-da-inviare-numero-1" - delay: # supporta seconds, milliseconds, minutes, hours seconds: 2 - service: broadlink.send data: 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:
switch: platform: template switches: switch_numero_uno: value_template: true turn_on: service: script.la_mia_sequenza turn_off: service: script.la_mia_sequenza_con_attesa
As anticipated above, this component is also useful for multi-sensor integration Broadlink A1 e-Air.
We have dedicated this aspect a specific guide.
|ATTENZIONE: 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.|