Skip to content

Home Assistant controlled fireplaces sconces with Sonoff Basic and ESPHome

Following up on my previous post about the Home Assistant controlled garage door, I want to show my simple solution to controlling a light with HA.  My house is a few years away from its centennial birthday.  With that age come some interesting “features”, like knob and tube wiring, and always on lights with physical switches per fixture, and lots of other tidbits.   The individual switches were a bit annoying and the old fixtures were quite ugly.  Besides, controlling the lights with Home Assistant is a great as it gives you infinite flexibility with automations and voice assistant integrations.   The Sonoff Basic is a great little wifi switch that’s easily flashed with your custom firmware of choice to keep all of the control local and out of the nasty cloud.  As I mentioned before, ESPHome has become my goto for anything that is ESP8266 or ESP32 controlled.  It’s ease of use, flexibility, and rapid development (massive thanks to OttoWinter) make it the best firmware option for me.

Parts List

  1. Sconce light fixture – Simple unswitched wall sconce [HomeDepot | Amazon]
  2. LED bulb – Make sure it’s 110v to match your house voltage and fits your fixture’s bulb socket [ Amazon ]
  3. Sonoff Basic – The wifi controlled switch that will simulate the previous physical switch [ Amazon ]
  4. FTDI Programmer – I like the micro USB one with the 3.3v/5v selection jumper  [ Amazon ]
  5. Ferrules and Crimper – These are great for preventing wire strands from going crazy when pushing them into the terminals and make your job look very professional [ Amazon ]
  6. Hot glue gun – You probably have one of these, I just upgraded my 20 year old one to this one [ Amazon ]

DIY

Again, I’m not going to go through the details of setting up ESPHome.  You can watch either Rob’s or digiblur’s videos to get a good explanation on it.  Once you have it up and running, you will need to create a new device by populating the name and WiFi details.   Here is my config:

 

The components above include

  • A binary sensor component for the button on the Sonoff Basic
  • An output component for controlling the relay state
  • A light component since you want this to show up as a light in HA
  • A switch restart component to reboot the Sonoff
  • A status LED component for indicating networking/error status on the Sonoff

Now can compile the firmware and flash it to your Sonoff Basic. The FTDI adapter only needs four wires connected to the Basic: VCC, GND, RX, TX.  Again, if you’re not familiar with how to do this, reference the videos linked above.  Once it’s flashed, power cycle the device.   Now you should be able to open the web GUI for the device by either going to it’s IP or going to esphome_light_sconce_right.local in your browser.  If the page loads, you’ve done everything correctly up to this point.  Since the Basic’s relay needs line power to operate, you will need to disconnect your FTDI programmer and connect it your mains power.  Remember, this is mains voltage, so be careful and if you’re not comfortable with this, put the unit back in its case before proceeding.  After the Basic powers up, you should be able to test out the light switch by hitting the button on the web UI.

ESPHome webserver UI

Now I needed to mount the Basic inside of my sconce.  Part of the reason that I picked this sconce fixture was that I thought it had plenty of room in the base.  Unfortunately, I was almost right except for the LED and push button that were just a hair too long.  So I used my Dremel rotary tool’s cutoff disc to cut the button down to about half length and resoldered the LED a 1/4″ lower into the PCB.  In order to insulate the bottom of the PCB from the metal sconce, I used a plastic raft that I had sitting around form a previous 3D print.  Alternatively, you can use the bottom of the Basic’s case or anything else that’s non conducting.  For me, the case was a bit wider than I liked and I had the raft sitting there.  I used hot glue to attach the raft to the sconce, and the Basic to the raft.  The last step was to put ferrules on the sconces wires and plug them in.  Then I did a final bench test: first with the Basic connected to mains to make sure it was working by hearing the relay click, and finally plugging in the bulb into the fixture’s socket to make sure it lit up.  Now, just install it based on the directions from your fixture, and turn on the breaker (fuse in my case).

Sonoff Basic (v2) mounted on a piece of plastic inside the light fixture

To integrate it into Home Assistant, you will need to go to configuration > integrations.  Assuming you have discovery enabled, you will have a new ESPHome device, click configure and add it to your system.  If you don’t have any existing conflicting entities, your entity names should match the ones I have.  I’m using lovelace with the following config:

This provides you with a simple button row who’s icon shows you the state of the lights.

I’ve exposed these lights to my Google Assistant integration.  So I just walk into the living room and say “Hey Google, turn on the sconces” and they fire right up.

Published inDIY HardwareHome AssistantHome Automation

Be First to Comment

Leave a Reply

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