I’ve been working on a project to make my “dumb” fan “smart”, initially I was going to use a RPi but the board is kind of large and not really portable. Then I discovered this ESP8266 board, it’s tiny, cheap, has Wifi built-in and requires no SD cards.
Now my fan is “smart”, it can be controlled from ST, Alexa, ST smartTile dashboard. It’s powered by 2 AA batteries (completely wireless).
- Arduino framework: To program ESP8266 using Arduino IDE
IRremote ESP8266 Library: To receive/transmit IR, use this code to get the IR code and this code as the main sketch for ESP8266.
- First I loaded the IRrecvDumpV2 sketch to ESP8266 and save all the IR codes from the fan’s remote. It looks like this from output, then I follow the repeated pattern to determine the correct rawData. If you happen to own the same fan, you can reuse my exact code
- Then I “hard-coded” those values into the IR send sketch: My version of the main sketch to transmit IR, this will also create a web server with buttons. Note that this sketch is heavily customized for my fan.
After all those steps, I could already control the fan from a local web endpoint, then I wanted to integrate it with SmartThings. Since this is merely a web endpoint and all I need to figure out is how to send a GET request from ST to this local endpoint. Although I was aware of MQTT (still don’t know how to use it yet), I decided to grab the HTTP Device handler, big thanks to @JZst, and simplified the code because all I need is to send a GET request without any return value.
Now I can control the fan from ST iOS app, Alexa, and SmartTiles dashboard. I also control a TV using the same method… with this universal IR remote, imagine all the possibilities
Let me know if you like it, sorry for long post.
EDIT: I take back the wireless feature, completely forgot about web server running on wifi, so 2 AA batteries won’t last more than 2 days. Now I have to hook it up to a power outlet
EDIT 2: I saw some people trying to make 1 of these, I’m sorry for the horrible write-up, but please do PM me if you have any issue during setup. There were a lot of issues/bugs in the process for me, but you don’t have to spend your valuable time again. So let me know if you’re stuck somewhere and I’ll be glad to assist.
Added some pics, including a TV remote (currently I only implement ON/OFF to use with Alexa)