Simple Gas Fireplace using an ESP8266 and a relay

Tags: #<Tag:0x00007f7397780fc0>

I put together an ESP8266/Wemos D1 Mini based gas fireplace controller that uses MQTT/Home Assistant. It also automatically turns off after X minutes, which can be configured. It’s a very inexpensive project that is really cool.

Here’s the link to it.

If anyone has any questions about it, please feel free to ask.


Very interested in this. I have the same fireplace however a little different wiring setup than what is mentioned in the article. My switch wires go to a control box under the fireplace, I assume this is where I would connect the relay?

As you can see in the pics below, the wires on the back of the switch terminate at the control box underneath (pic 2 and 3). You can see the wire coming from the switch through the hole there in the background.

Thanks in advance!

I’m pretty sure you can just connect the relay on the red and white wires. I’m assuming the green is ground. Let me know if you still need help with it.

Thanks! relay and mcu chip are arriving tomorrow. I’m going to test by removing the switch wires and see if it works, then will add the switch wires back and hope for the best.

I’ll let you know how it goes,

Thanks again

So how did it go?

The NodeMCU didn’t work so I ordered the Demo D1 as the article describes. I finally got the relay to trigger but prior to that I had bent the pins from pushing to hard so there was a lot of crackling going on. I plugged it in to the fireplace and wasn’t able to get it to work. However, I think it was because of either the relay (bent pins) or the wires I had on hand to connect to the fireplace.

Haven’t gotten a chance to get another relay but I haven’t given up yet.

Just so you know, you don’t need a relay to test if the fireplace will work. You can just take a wire and short those 2 leads on the fireplace to see if it turns on. If it doesn’t turn on, then the relay might not be the problem.

How would one accomplish this? Connect red and white with same wire?

Yes. Just take a wire and short the 2 pins on your fireplace. That is essentially what the relay is doing.

ok, was able to do this and the fireplace did NOT turn on which is what I wanted. However when I shorted the pins my switch kinda freaked out by lighting up and flickering intermittently. Not sure if this is expected behavior but I don’t know if that is screwing anything up.

EDIT: Correction, the fireplace did NOT turn on which is what I did not want to happen. I’m thinking at this point it either has to be the switch or the Wemos. Added two more pics to show how my setup varies from linked article. I don’t have the screws to connect to.

Well, considering the fact that you don’t have a simple wall switch controlling it, it looks like it will work very differently than mine. I’m not really sure how yours would work. There’s probably a way to do it, but I don’t think I would be able to figure that out for you.

Understood, I’ll see if I cab get it to work one way or another


I’m a newbie to this whole scene, and my first post. I am trying to set up the Wemo D1 and relay solution as you described, I copy and pasted the code (hassio) and uploaded, and when I try to activate the relay, it does not click . However, I can see the light on the relay go dim and go bright again. I tried another relay but still no clicking and no shorting of the outputs of the relay. Any help would be much appreciated. Thanks!

Have a look at this video:

I plan on using this to base my Fireplace thermostat on. once I receive my parts from Banggood.

Hey!! I got it all working! Just an update… the pin puts are now different on the relay. When I hooked it up according the tutorial the relay would not work… after alot of unnecessary code work… I decided to take a look at the labeling on the relay and found it was different than the diagram simpat had… hope it keeps someone else from pulling thier head out like I did! Thank you so much for the tutorial! I have two fireplaces in the house and they work great with HA!!

Next step is to hook some DHT11 as to the son off basic switch I have across the room to monitor the temp! So many possibilities!:grinning:

Nice project. Thanks for sharing!

I’m new in the world of esp8266. Does the ESP-01 relay module like this one will work with that code?


You should be able to make my code work with that.

Also, @Chief, I just saw your comments. Don’t know how I missed them. I’m glad to hear you got that working. I’ve got a bunch of projects on my site that I did, and this fireplace is still my favorite. I mean, I can summon fire with my voice; that’s some cool stuff.

Awesome. Thanks