"Failsafe" ESPHome Fireplace Controller

When asked what smart switch to use to control their gas fireplace, you see a lot of replies "do you want to be one software bug away from your fireplace turning on?" Granted, modern gas fireplaces have safeties in place to prevent un-lit open valves, runaway heating, etc., but some people would still rather have a hardware switch standing between them and fire.

This project aims to be the best of both worlds: by running 5v power to the low-voltage switch box holding my fireplace wall switch (in my case, this involved pulling 5-conductor thermostat wire using the existing 2-conductor wire), you can power an ESP board running ESPHome.

By running the actual thermostat switch signal through both a DPST and a (ESPHome-controlled) 3v relay, we can be sure that the fireplace is only "active" if the manual switch is turned on.

  1. Step 1: Prep and switch box power

    The first step is to understand your current fireplace switch system and make sure you have appropriate power to the switch box. In my case, the fireplace control board (under the fireplace) has a dedicated pair of wires for a wall switch. There are other systems in which the millivolt wire passes through the switch box directly.

    In either case, you will need power to the switch box sufficient to run your ESP board, ideally completely isolated from the fireplace system. (3v3 is okay, but 5v is better, to also power the LED in the button.)

    In my case, a 2-conductor, 18-gauge thermostat wire was already running from under the fireplace (where the control board and a 120v outlet were already present) to carry signal from the wall switch. I used this wire to pull a 5-conductor thermostat wire in its place (one pair for the fireplace switch as before, one pair to carry 5v, and the final wire just because I couldn't find 4-conductor wire at Lowes).

    In the box under the fireplace, I added a simple 1-amp USB charger to source the 5v power. (In testing, the device never pulled more than 150mA.)


  2. Step 2: Switch frame fabrication

    I designed the switch frame in Rhino 3d to hold:



    The model is available at: https://grabcad.com/library/fireplace-switch-assembly-1

    Although everything else was modeled by hand, the ESP32 S2 mini board was grabbed from elsewhere, and the vertical profile wasn't quite right. So, the topmost hole needed a bit of hand filing before the ESP board would fit well. Also, the screw holes for the ESP board could be larger, depending on your printer (1/16" would work well).

  3. Step 3: Assembly and glue-up

    Though in another world I would have used CNC, for this project, I grabbed a medium-size thermoplastic blank outlet box cover, placed the 3d printed frame (which slots nicely between the screw holes) on it, and traced the holes to cut. I cut them out with the cut wheel and sander attachment of a Dremel tool, and used small hand files to fine-tune the holes. Not the prettiest thing I've made, but good enough once the switches are added.

    Next, I applied 5-minute 2-part epoxy and used the switches to hold the frame to the outlet cover while the epoxy cured. I epoxied the wire disconnect to the back of the frame at the same time. It will be hard to solder to the switches after they're embedded into the frame, so I recommend pre-soldering wires to the switches before the glue-up.




  4. Step 4: Add boards and wiring

    The relay and ESP boards can be added to their respective places and screwed in. ESP board fits first; I used 2mm screws to secure the boards.


    The wiring is left to your discretion, but should generally go:

    Ground bus to ground connectors on ESP board, relay board, one leg of the DPST switch, one leg of the (normally open) button connector, and the ground pin to the button NeoPixel.

    5v feed from the wall to the vbus connector on the ESP board and the power pin of the button NeoPixel.

    3v3 from the ESP 3v3 pin to the power pin of the 3v relay board.

    Four signal wires to GPIO pins on the ESP board: one to the DPST switch (matching the ground connection), one to the button normally open contact (opposite ground), one to the NeoPixel "data in" line, and one to the relay signal line.

    Finally, the fireplace signal (between the two fireplace switch signal wires from the wall) should run wall wire 1 -> relay common -> relay normally open -> DPST switch (free pole) -> matching DPST connection -> wall wire 2. That way, the fireplace sees the switch as "on" only if the relay is energized and the DPST switch is "on".

  5. Step 5: Programming with ESPHome

    There you have it! There are a variety of things you can do to program the board, but if you want to use ESPHome (which integrates well with Home Assistant), my YAML is here. Change passwords and GPIO pins as required for your connections. You could make the button and button light private, as they aren't needed in Home Assistant.




Comments