DIY Voice controlled Tasmota IR transmitter

Hi Homey friends,

I like to share my IR project what I started to control my ceiling fan in the bedroom with google mini. It’s a ceiling fan controlled by an IR remote with 3 different speed settings. I hope it will inspire some people with their projects.

It took me some time to understand how to get it working, but the information on this forum and some other places got me in the right direction. Tried to explained all the collected information for this project in this post.

The 5 voice command I can use are:

  • Oke google, Fan on
  • Oke google, Fan off
  • Oke google, Fan speed 1 on
  • Oke google, Fan speed 2 on
  • Oke google, Fan speed 3 on

1. First I had to make an Arduino flashed with Tasmota IR-Firmware and an electrical circuit for the IR transmitter.

I used an ESP8266, IR receiver on jack, 5V adapter, a case and some electrical parts. The IR transmitter led was taken from an old remote.

I used this electrical circuit described on the Tasmota site

2. Setup Tasmota data pins for IR TX and RX and the MQTT settings to talk with Homey.

I used pin D1 for IR RX and pin D5 for IR TX. D4 is the internal led on the ESP8266 to check if the device has power.
In MQTT settings you need to put the IP adres of the broker, I installed a broker on my synology NAS, so the IP adres is from my NAS. Username and password you have setup in the broker and a MQTT topic of your choice.
Full Topic needs to be left on default setting.

To know what IR command I need to send from homey I went to the console in the Tasmota web interface and push a button on the IR remote. When I tested it with my TV remote you see in the response something like this:

{“Protocol”:“SAMSUNG”,“Bits”:32,“Data”: 0xE0E040BF}

To test if it works you can type irsend before it in the console line:

irsend {“Protocol”:“SAMSUNG”,“Bits”:32,“Data”: 0xE0E040BF}

Unfortunately all the buttons on my fan remote gave the same code, so I needed to switch to RAW IR commands by typing “SetOption58 1” in console line. If you press a button on the remote you see something like this:


You need to put “0,” before the code to set the frequency to 38kHz what is the frequency used for Infrared codes.

irsend 0,+1285-395A-400+445-1235DeDeD-1240DeDeDeDeDe+450-7960AbAbDeDeDeAbAb+1290bAbAbAbA-7120AbAbDeDeDeDeDfAbDeDeDeD-7970+1280bAbDeDeDeDeDeIbDeDeDeD-7965AbAbDeDfDeDfDeAbDeDeDf+440mAbAbDeDfDeDeDeAbDeDeDeDmAbIbDeDeDeDfDeAbDfDfDfDmAbAbDeDeDeDeDfA-390DeDfNeDmAbAbDeGeDfDeDfLbDeDeDeDmAbAbDfDeDfDeDfAbDeDeDeD

3. Setup Virtual Switches and an advanced flow in Homey.

I created 4 Virtual switches with the app Virtual Devices that has the option to set a switch mode without trigger. To set the right one on and off I made a nice spiderweb :stuck_out_tongue:

When google sets the chosen switch on it sends the corresponding RAW IR command to the MQTT Topic “ir” and updates the fan speed logic to the chosen speed number. Because of the logic the fan wil be going to the last speed value that was used the last time when you say “Oke google, Fan on”

The divergence between the Tasmota console and sending commands thru MQTT Client App is that you need to put “cmnd/TOPIC/COMMAND” in the topic section and the message in the send section. In my case: cmnd/ir/irsend