O'Reilly logo

ESP8266 Home Automation Projects by Catalin Batrinu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Software and libraries for this project

First let's install the library IRremoteESP8266. For that go to Sketch | Include Library | Manage Libraries... and search for IRremoteESP8266 library like in the following screenshot:

After the library is installed and the connections to the ESP are done, let's use the following code to send over an MQTT topic a command to open or close a Panasonic TV. Since the same Infrared command is used to power on or power off, you just need to receive something on the MQTT topic to send an infrared command to the TV:

#include <ArduinoJson.h> #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> #include <WiFiUdp.h> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required