Capture infrared / radio frequency codes via Broadlink e Home Assistant

4 minutes of reading
Guide purposes
  • Acquire infrared / radiofrequency codes in Base64 coding
  • Difficulty level: bass
Concepts dealt with:
  • Software use
Software components used:
Prerequisites
  • Home Assistant configured and working
  • a device Broadlink able to receive / send infrared / radiofrequency codes already configured on the network Wi-Fi
Physical devices used:
  • The device on which it resides Home Assistant
  • The source of infrared / radiofrequency codes (typically a tele or a radio control)
  • a device Broadlink for infrared sending / receiving (eg RM Mini 3) or sending infrared / radio frequency reception (eg Broadlink RM Pro/Pro+)
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.1

Abstract

Remote controlThe use in home automation of infrared and / or radio frequency codes (433mhz / 315mhz) rappoften resents a good technique to be able to domotize something that, natively, it wouldn't be.

In fact they have existed for some time simple and cheap devices useful toappefficiency and above all the transmission of codes of this type (eg Broadlink RM Mini 3); such devices, once inserted in home automation, rappthey provide a "lever" to virtualize the indirect control of "objective" devices.

In essence, the technique is that of appmake the codes from the remote controls of the devices we want to domotize, insert them in the configuration of ours personale HUB (in this case, Home Assistant) in the form of accessories (switches, fans, air conditioners, etc.) which, when activated, arise in sending infrared / radiofrequency codes appropiati.

This technique has been used in several projets featured on inDomus, including:

What we will see in this guide is how, starting from a device Broadlink (capable of receiving / sending infrared / radiofrequency codes) and from a remote control or a radio controlor (capable respectively in transmitting infrared or radio frequency codes), we will succeed to capture these codes for the purpose of reuse in home automation configuration.

Nb. this guide refers to 433mhz / 315mhz radiofrequency codes (not rolling code) and infrared signals (with wavelengths between 700 nm and 1 mm, or that of traditional remote controls).
To domotize remote controls rolling code, is available this guide.

On the topic of the use of infrared and radio frequencies in home automation we have dedicated an episode of ours Podcast.

Device configuration Broadlink

Before starting the code capture through the combined use of Home Assistant and its component "Broadlink", It is necessary that the actuator is already present on ours Wi-Fi. In case this step has already been done previously, it will be possible profollow over.

To make the infrared emitter enter (and remain) inside yours Wi-Fi just download theappe-Control reporting for Android o for iOS and follow the instructions. In case of difficulty, it is available the manual in Italian.

Switch configuration "learner"

To capture the codes it is necessary that the component "Broadlink” is configured at Home Assistant. As explained also in the page dedicated to the platform, the before what to do is therefore to define a mock switch you create, within Home Assistant, the awareness of the presence of a device Broadlink (among those listed above) on the network.

This awareness it's necessary to equip ourselves with two 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 at the configuration di Home Assistant this first switch:

# Esempio di configurazione learner
switch:
  - platform: broadlink
    host: 192.168.1.2
    mac: 'B4:43:0D:CC:0F:58'
    timeout: 30
    friendly_name: "Dispositivo Broadlink"
    type: rm_mini
    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) and address MAC of our actuator Broadlink, as well as the field "type". The fields "on" and "off"Are intentionally left empty.

For configuration details appromerge on the component board Home Assistant "Broadlink"

Code capture

First to ask yourself proproblem of capturing 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!

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:

JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=

Finally save this string and keep it aside.

DONE! Not that difficult, isn't it? 😉

At this point the codes thus collected can be used for the most diverse uses, for example defining new configuration files for climate unit domotization (using the platform “SmartIR Climate") Rather than control switch through the component"Broadlink"

Alternative

It will say: "you could have said it before", but to capture the codes it exists a shortcut. It has not been said before - in this guide - why the definition of the switch entity "learner" it is a necessary passage, most often, when checking a device Broadlink by Home Assistant.

That said, if the prothe code capture procedure described in this guide is a bit awkward (which it is), the alternative - if you have a computer with an operating system Windows - is described here.


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