Use an ESP8266 or ESP32 to create a WiFi Infrared Blaster and send code using a browser enabled device on your local network like a mobile phone, a tablet or even a Laptop. IMPORTANT Please read the update notes for current library requirements
This is the Project that gave me the required functionality and AJAX script.
Note: I stripped out all "HTTP_GET" functionality in my project as I only wanted to send "HTTP_POST" commands. If you need to pull data into your HTML like sensor readings then you'll need to look at the core code source project for that detail.
In my sketch there is just a single task being the "void onBody()" callback and this function is triggered by a HTML button press. There is a javaScript that creates the JASON string when a button is pressed.
In the JSON string is the button's HTML id# and the button's description as text. This description isn't needed for functionality but was very handy for debugging as I could see if the IR code emitted matched the function printed in the Serial monitor.
The button id# is the key as all the IR codes for the buttons live in a single array and the HTML id# is the array index position of the IR code for the button that was pressed. As there are three (3) protocols “NEC, PANASONIC and RCMM” the array is sorted in groups which facilitates assigning protocol type by ID/index number.
To summerize, Button Press > Stringify ID and Name > Pass to “onBody” callback > parse JSON > check ID and set protocol > pass the switch case to emit IR code
Minor stuff: There are near 100 buttons and I used 9 x Buttons that load model pop-ups with buttons grouped by device and function. I call “FontAwesome” externally for button icons so I need internet access.
At the bottom of this page is a link to a short video showing the ESP-IR-Blaster in operation.
First you need to make sure the Arduino IDE has support for your ESP8266 or ESP32 library installed.
IMPORTANT Please read the update notes for current library requirements as a patch may be required if you are using an ESP32
IRremoteESP8266 This library has an impressive list of supported protocols.
ESPAsyncWebServer Important if you are using sensor data as you can update values without full page reloads
ArduinoJson to facilitate the AJAX exchanges
ElegantOTA Enables Over The Air updates to your controller
This older IDE still works and has two JAVA plug-ins that allow easy datafolder upload to your HTML content to the controller. Here are links to instructions for the ESP32 and the ESP8266 for adding this tool.
I have included Over-the-Air update functionality to the project so after initial upload both updates and data folder contents can be updated via WiFi. I prefer to do initial deployment of entire project via Serial from the IDE. To do that you now need to add this plug-in for LittleFS and for reference there is also one available for SPIFFS here. To install these plug-ins follow the instructions here
You will most likely need to capture your own IR codes and if you get random captures (as I did) I strongly recommend you read this blog for the answer. In a nutshell it comes down to IR reciever center frequency and what carrier frequency the remote you are capturing uses. In my case both the Sky and Panasonic used 37Khz and the standard Arduino IR receiver has a center frequency of 38Khz.
I swapped to a TSOP4136 (36Khz center frequency) IR receiver hardwired to the ESP controller and everything burst into life.
To capture IR codes I recommend you use the example sketch in the library called "IRrecvDumpV2". It's what worked for me. The switch and the LED shown in the image below were only for developement and debugging.

The HTML and CSS are the most time consuming and to help avoid incorrectly assigning ID's and IR codes to the wrong buttons I added them as comments to the IR library (irCodes.h) The DOM ID is the array index position. As the remotes are numerically grouped this also let me do a simple "IF" statement for switch case encoder assignment. The core code-source project used IR header hex values that may work for you but were not optimal in my case.
In my project I'm not hosting the javascript or Font Awesome libraries so internet access is required.


