Tasmota IR Bridge, integrated to Home Assistant (transmitter part)
Tags: tasmota, ir, bridge, homeassistant
Published: 2021-07-26 16:14:40

As a beginner in this IoT world, I read quite a lot of tutorials, and articles, but I could not find articles dedicated to beginners.

Thus, here is a short tutorial on how I did it.

#Assumptions
- We already know what Protocol, Code, and Length to transmit
- In this case: NEC, 16712445, 32 

#🛍️ Required Materials
- ESP8266: [Amazon](https://www.amazon.fr/SeeKool-d%C3%A9veloppement-Fonctionne-Parfaitement-Compatible/dp/B07DRF9YTV/ref=sr_1_5)
- IR transmitter: [Amazon](https://www.amazon.fr/gp/product/B07912FFXV/)
- 3 jumpers female-female + 1 USB Cable
![Materials Overview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp72ir75d2509u50s8k8.jpg)

#ESP8266 Flashing with Tasmota
Not covered in this tutorial, and assuming it's done.
Check my dedicated [article](https://dev.to/henri_rion/esp8266-flashed-with-tasmota-in-less-than-5min-1ehl)


#Wiring
Here are the required connections (from ESP8266 to IR Transmitter)
- GND -> GND
- 3V3 -> VCC
- D3 -> SIG

![ESP8266 Connections](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cww4d5xth6kn5srtlw67.jpg)

![IR Transmitter Connections](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbpesrbcpuasiutb2tro.jpg)

#Tasmota Config
- Go to the allocated IP address of our 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 Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa17wiflgm4ej8nix8m7.png)

#Home Assistant Integration
(If it's not already the case, go to Configuration > Integrations > Add Integration > Tasmota)

##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 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.

###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.
Check the configuration within Home Assistant. Go to Configurations > Server Controls > Configuration Validation > Check Configuration. You must have the Configuration Valid! message.

![Configuration valid message](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0gqyc92g8qz39znh9daw.png)


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

##New Entity Usage

Now, 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 - Button Card configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/il2ii27nppycy00zdtzx.png)

Now, you have an IR Bridge working.

I hope you enjoyed this small tutorial. Do not hesitate to ask questions, or give improvements. I'm always open to improve and share :-).