4 min read

πŸ’₯ DIY IR Bridge for Home Assistant

DIY IR Bridge for Home Assistant
DIY IR Bridge for Home Assistant

Tired using plenty of remote controllers at home for TV, AC, Leds, Internet Box...? With a simple DIY Infrared Bridge, control your IR devices through Home Assistant.

🚨 Assumptions

Before we start, I'm assuming in this tutorial that:

  • Home Assistant is installed, configured, and running,
  • MQTT Broker is installed, configured, and running,
  • You know the Protocol, Code, and Length to transmit via IR. We will use NEC, 16712445, 32 in here.

Check my other articles to see how to capture codes, protocol, and code's length.


πŸ›οΈ Required Materials

Links to Amazon are used for illustration, and not promotion. Of course, you can find the required materials elsewhere such as Aliexpress.

Required Materials Overview
Required Materials Overview

⚑ Flashing ESP8266 with Tasmota

Flashing the ESP8266 with Tasmota firmware is not the purpose of this tutorial. In case you don't know how to proceed, please have a look to my other tutorial.

πŸ”Œ Plugging Components Together

Now, we installed Tasmota firmware on our ESP8266, we can plug components together. Here are the required connections, from ESP8266 to IR Transmitter:

  • GND -> GND
  • 3V3 -> VCC
  • D3 -> SIG
ESP8266 connection pins
ESP8266 connection pins
IR Transmitter connection pins

πŸͺ› Tasmota Configuration

  • Go to the allocated IP address of our wonderful Tasmota
  • In this case, we have 192.168.1.62
  • Go to : Configuration > Configure Module, and select Generic module type, and allocate IRSend to the D3 GPIO0
Tasmota Configuration Panel to Allocate D3 GPIO0 to IRSend
Tasmota Configuration Panel to Allocate D3 GPIO0 to IRSend

In terms of our hardwares configuration, we are now good. Let's move on with Home Assistant.


🏠 Home Assistant Integration

If you didn't already add Β Tasmota entities to Home Assistant yet, go to Configuration > Integrations > Add Integration > Tasmota.

You should now be able to see Tasmota entities available on your network.

Illustration of how it looks on my Hass. It could be different on yours.

πŸ§ͺ Testing first!

Before final integration, let's test the communication between MQTT, and our Tasmota device.

On a new tab of your favorite browser, open the Tasmota panel (192.168.1.62), and go to Console.

Open a new tab with Home Assistant, and go to Configuration > Integrations, and click on the MQTT Configure button.

In the "Publish a Packet" part, we will add the topic (i.e. the name of our Tasmota), and the Payload (the code we want to execute).

πŸ” Where to find the MQTT Topic?

On the Tasmota tab, go to the Information menu, and find the "MQTT Full Topic". In our case, we have:

cmnd/tasmota_E30D62/

Add this topic name to our Home Assistant MQTT Configure panel, with IRsend at the end.

cmnd/tasmota_E30D62/irsend

πŸ”Ž Where to find the Payload?

As previously explained, in this case, we assume having already the code, and protocol.

Payload

{"Protocol":"NEC","Bits":32,"Data":16753245}

And now click publish.

You should see the Tasmota's console displaying the below message:

MQT: stat/tasmota_E30D62/RESULT = {"IRSend":"Done"}

Integration

Open your configuration.yaml file and add the following lines:

switch:
  - platform: mqtt
    name: "TEST ESP8266 LED LIGHT" #the entity name
    command_topic: "cmnd/tasmota_E30D62/IRsend"
    payload_on: '{"Protocol":"NEC","Bits":32,"Data":16712445}'
    payload_off: '{"Protocol":"NEC","Bits":32,"Data":16712445}'

Save and close the configuration.yaml file. For the tutorial, I'm limiting the codes to toggle ON/OFF. Of course, you can add all the required codes.

Check the configuration within Home Assistant. Go to Configurations > Server Controls > Configuration Validation > Check Configuration.

You must have the "Configuration Valid!" message.

Home Assistant Configuration Valid! Message


Once the configuration valid message appears, you can restart Home Assistant server.

πŸ’‘ New Entity Usage

Now, to see our brand new DIY IR Bridge in action, we can create a new view, and click the add card button.
Select the Button card type.
Find the Entity we just created, and save.

Home Assistant Adding our New IR Bridge Entity

Now, you have an IR Bridge working.

I hope you enjoyed this tutorial.

Do not hesitate to ask questions, or give improvements. I'm always open to improve and share πŸ€™.