After installing my Garage Door Controller, I wanted my next project to be something cooler. Of course, there’s nothing cooler than a smart gas fireplace.

Here is a list of things you will need to get started:

Software that you will need:

I created a gallery of all the images for this project in case anyone needs a closer look at any of the wiring.

I want to start off by saying that this project is based on the way my fireplace (Heatilator) works and the way I have seen many other fireplaces work. I am by no means an expert on fireplaces. I strongly urge you to exercise caution and make sure you fully understand how your fireplace works and how this project works before you proceed. Feel free to ask any questions if you have any uncertainty. I don’t want anyone to get hurt doing this.

The first step is to make sure you will be able to provide power for the Wemos. Open up the vent under your fireplace. There may or may not be an outlet there. And if there is one, it may not actually have power to it. If you don’t have power there, you will need to install power to it so that the Wemos can run. Many fireplaces have an outlet above the fireplace, and you may be able to run a wire behind the wall to drop down into the fireplace. If you aren’t comfortable with any of this, get an electrician to do this.

Below is a picture of my fireplace. I had an outlet behind the vent underneath the fireplace, but it wasn’t actually wired up. Lucky for me, the area behind the wall around the fireplace is a large open area, so I was able to easily run an electric cable from the outlet above the fireplace to the outlet below the fireplace. 

Also, this assumes you control the fireplace using a wall switch. When you flip the switch, the fireplace comes on. If you have that type of fireplace, this project will work for you. Just to make sure, find the wire coming from the switch going underneath the gas fireplace. If you short the terminals that the wires are connected to, then the fireplace should turn on. For this project, the 5V relay will short those 2 terminals to turn the fireplace on.

This image shows where the existing wire goes from the wall switch to the terminals on the fireplace.

The next step is to wire it up according to the schematic below. It’s pretty straight-forward as we are just working with a single relay connected to the Wemos D1 Mini. Feel free to use another GPIO pin if you wish. But keep in mind that some pins will go high for a split second when the Wemos boots up. The output pins of the relay will connect to the 2 terminals from the fireplace. If you used a case, then put the Wemos and the relay into the case. A case isn’t absolutely required since it will be concealed behind the vent, but you need to be careful since the fireplace is likely metal and you might short something.

Schematic for the Fireplace Relay
Here’s what it looks like all wired up.

If you don’t have Home Assistant and MQTT, then use the following code in Arduino IDE. If you already have Home Assistant and MQTT set, then use the code after this next block.The first set of code has a web interface that can be used to control the fireplace. The second one can only be controlled by Home Assistant/MQTT.

Which ever code you decide to use, be sure to change the Custom Params section to match your environment. By default, I have the fireplace set to turn off after 30 minutes. You can set that higher if you prefer by changing the FireAutoOff parameter. Just like the garage door controller, this one has OTA functionality to be able to load future changes via the web interface

Use this code for standalone:

Use this code with Home Assistant/MQTT. This code assumes that you are using a username and password to connect to your MQTT broker. If you are not, then you will need to edit the appropriate lines. 

Once you have the code loaded, the Wemos will advertise itself as a Wifi Access Point which you can connect to in order to setup Wifi on the Wemos.

If you use the standalone code, you should be able to access it via http://fireplaceesp.local/
Otherwise, you may have to find the IP address of it through your wireless router. Here’s what it should look like:


If you are using Home Assistant, you need to setup theMQTT Switch Component. Just copy and paste the following config into your Home Assistant YAML file.

Here’s what it should look like in Home Assistant:

The Wall Switch. You may be wondering what happens when you use the wall switch. Well, assuming you left it connected to the terminals, the wall switch will also be able to turn the fireplace on and off. Keep in mind that if the Wemos or the wall switch turn the fireplace on, then the other won’t be able to turn it off. Another option is to disconnect the wall switch so the Wemos is the only thing that can control it. One more option is to wire the wall switch to the Wemos, and add some code to be able to handle that. This way, if you were to turn the wall switch on, you can still control it using Home Assistant. If there are enough people that want to see this, I might create an update for this post to add that in there.

Optionally, if you have have an Apple IOS device, you could use HomeBridge with the Home Assistant Plugin and control the fireplace using Siri.

I hope this post was helpful. If you have any questions or need any help feel free to comment below.

5 thoughts on “Wifi Fireplace Using a Wemos D1 Mini/ESP8266

  1. Keep these coming! I ordered five wemos and should be arriving soon. Any thoughts on using the wemos with the IR module from AliExpress?

    1. I’m glad you liked them. Thanks for the feedback.

      I haven’t personally used the IR modules. But I’ve seen a few forum posts on the Internet with people using them. I plan on getting some of those eventually.

    1. It may be a while before I get around to that. But what I plan on doing is just checking if the switch changes from On to Off, or Off to On. If it goes from Off to On, then I turn the fireplace on, and start the XX minute timer to automatically turn the fireplace off. If I go from On to Off, then turn the fireplace off if it’s not already off(due to the timer). Let me know if you need any help with it.

Leave a Reply

Your email address will not be published. Required fields are marked *