Controlling Infa-Red IR devices with Home-Assistant & AlexaPi on a Raspberry Pi (Non smart, Dumb devices)

In this post I’m continuing my Home Automation and Home-Assistant journey.

I already have an Xbox-One with a kinect so routinely say “Xbox on” which turns on the TV, SoundBar and Foxtel (cable) box. This also accepts volume up/down, change of channel, record, Netflix and games. So I’m moving to a completely voice driven household with using Alexa or Siri to operate the lights. But how do I go further? What else is there in the house that I can’t talk to, what remote controls do I still use?

There are several things in my apartment that cannot be controlled via wifi, I live in a typical late 90s midcity Australian apartment and have the ubiquitous through house aircon/heating unit with buttons on a wall and a remote control in the living room and vents to each room in the apartment. So since my apartment reaches dizzying temps in the summer, it would be nice to be able to set the ac unit to function remotely or autonomously so I can come home to a cool apartment. On the flipside the apartment is also cold in the winter, mainly due to Australia’s ridiculous lack of double glazing and insulation, but using the the AC unit to heat the house is stupidly expensive. For this reason I bought a little Dyson hot/cold fan, it’s so efficient, warms a room really quickly and uses less than a twentieth of the electricity the ac unit does.

So for this example I’m going to automate my little Dyson fan, but this system works for any infa-red remote control based controller.

Firstly I need an IR controller, there are options out there for ready built like this one, have a google for Raspberry-Pi IR shield etc. I can’t comment on the usage of these devices as built my own but imagine it’s fairly similar perhaps just require changing gpio port numbers. My Pi is hidden in a case meaning I cant use a shield on it so wanted a remote IR blaster. We need two parts on our IR controller, we need a receiver so that it can understand what buttons I’m pressing at it, and a transmitter so that it can send the commands to the devices.

There are a few blogs detailing how to do this, but this is by far the best! Alex did a top job!

His blog is a little all over the place, with different posts and not flowing well, I think he’s in the process of building a site dedicated to the IR build which is still in process.

Here is Alex’s schematic:

Parts I used:

I have an electronics background from school/college/uni so never worry about doing stuff like this, but for a newbie it can be quite daunting so i’ll try and break it down.

Generally it’s best to bread board any circuit to test it out, I did and didn’t take any pictures, but I finished this with veroboard(stripboard) using this template.

So I drew it out:

Note the broken track highlighted by the blue X! Do this with a drill piece.

If you’re making this then pay attention to the fact that with veroboard you flip the board and solder the brass track side, this means components end up in the wrong polarity easily. We’ve all done it! So bear that in mind and double check my working against Alex’s schematic. Check your IR receiver datasheet and npn transistor datasheet to make sure the legs are correct. My sketch above may not be 100% as I did a few whilst making this and can’t find them all.

It looks something like this:

I’m using a Raspberry-Pi 3, so the gpio pins which i’ve labelled 22/23 don’t correspond directly to the pins on the Pi.

Here’s a pinout for a Pi3 GPIO:

Connect your IR blaster GPIO22 to pin 15, GPIO23 to pin16. The 3.3v to pin 01, 5v to pin 02 and ground to 06 as per the above picture.

So this is up and running, plugged into the Pi. Time to configure LIRC.

Jump back to Alex’s page again here and follow his steps, the reason I’m not rewriting them is there are many comments of other peoples steps of troubleshooting lirc, it’s worth following, that’s all I did.

So assuming you’ve set it up, you’ve learnt a remote, next job is to interface Home-Assistant to control the device. Once again, I’m using the Dyson fan, I’m struggling to find an IR remote that works my AC system.

Next job is to setup lirc_web, once again thanks to Alex here. You can see my config.json on my config files page.

Here is what it looks like when i goto the local address:

 So now this is setup, I can remotely control the fan via going to the webpage, (in my instance).  Alex has cleverly included in lirc_web RESTAPI.  So we can send commands to it remotely.  This is how Home-Assistant accesses it.







Check below for my HASS config:

And my group to give it an area in my HA dashboard:


So we end up with this on my HA dashboard.  So I can add this to homebridge if i want with adding the switch option in the homebridge config.json and then siri can control it, with “Hey siri, turn the dyson power on” etc.  I didn’t add it to homebridge, I wanted Alexa to control it, so simply used the IFTTT method that i used in my previous blog entry for controlling HA from Alexa.


I’ll give an example of the IFTTT code though:


Make a new applet, select Alexa and webmaker.  Choose a command, in my case dyson power.

Web request is your restapi to control the homeassistant, in my case:


Method: POST

Content Type: application/json

Body: { "entity_id": "switch.dyson_power" }


Happy days!