Easy way to add manual switch to Sonoff Basic (with status toggle) without flashing?

As title says, I am looking for an easy way to add manual switch to sonoff.
Requirements:
No flashing
Manual switch should update status on app as well

(I read somewhere that you can attach wires to the push button or something)

Thanks in anticipation

Keep reading, that’s exactly what you do. You can’t do it with a normal wall switch, you’ll need a momentary push button.

If you want to use a normal switch you’ll need to ditch the app and flash, if you’re using HA I don’t see why you wouldn’t.

Learn to flash. You only have to do it once for each device.
You can’t add a manual switch without doing some soldering anyway, so go ahead and solder a header and flash the device with Tasmota.

You can solder a switch to the legs of the existing momentary push button that are closed when it is pushed. That would work but would allow people to reset your sonoff through button presses. It would work but you can only use a momentary switch not a toggle such as a normal light switch one. Personally I take sonoff’s flash them with Tasmota and hook them up to my existing light switches. They look and act just like before but are now smart!

Cool. Thanks.
Could you point me to a complete tutorial that helps me flash then add manual switch and then set them up with HA?

Really new to home automation

Thanks a lot.

To flash the Sonoff’s you need the following:
FTDI adaptor: Amazon US
Header wires: Amazon US
Male header pins: Amazon US
Small gauge wire: assuming you have or can find
Momentary switch or toggle switch: your choice

Here’s the software I used: Tasmota

If you read Prerequisite, Hardware preparation and Upload.

For a Sonoff’s Basic module the connections are Here

When you are on the Upload page make sure to USE PlatformIO and nothing else. Follow the guide for it.

Once you have your Sonoff’s flashed let me know. If you need more help them look around the Tasmota Wiki.

Hope this helps!

Give the guy a break. He wanted a starting tutorial, not to get thrown into the deep end. There’s no need to compile the code, just flash the precompiled bin file. I struggled with the source code using the Arduino IDE and less success with PlatformIO, (and I am not a newbie to Arduino). While it works, it’s completely unnecessary.

Regardless of the process you use, I strongly recommend soldering a 4-pin male header to the Sonoff to connect the FTDI adapter. Otherwise you may need three hands to get into the flash mode.

You can connect a toggle switch to the Sonoff GPIO14 so that the switch is independent of the MQTT state.
In the console page of the device website:
Go into Configuration -> Configure module , and on this page select the value “09 switch1” for GPIO14.

Or, using Termite on the serial port, enter the following command: GPIO14 9

Now the relay is toggled when GPIO14 changes. With a switch connect to GPIO14 and ground, you get the desired result. This works even if the mqtt broker or Home Assistant is offline.

6 Likes

I came across this last night Shelly 1
I did my share of sonoff basic w/ manual switch (single/3-way/etc), may try this Shelly 1 next time (when available).

I was just sharing the way I have always done it. I find it easier to compile the code as you can enter in your info before compiling which is useful for group deployments. I understand that the .bin file is easier and simpler but I want people to understand the workings of the software and what it looks like. I thought I made it fairly easy to understand in my post.

He may get there eventually. But he needed a simple starting point. I compile my own Tasmota when I am experimenting with new hardware, but being basically lazy, I try first to use the precompiled bin file and make settings changes in the console or a terminal window.

A year ago that could have been me asking that question. Except that I’ve been soldering since solder was invented.

1 Like

@stevemann @LavaGlass Thanks a lot for this!
It seems like I am making progress.
I have all the stuff required to flash. I am facing troubles using my mac to flash my sonoff.
Still working on figuring that out.

However, while doing some more research I found that I need to add a resistor/capacitor or both somewhere for the manual switch to work properly or something?
What do you think, is that necessary?

Sources: YouTube video: https://youtu.be/MIEv3D-S0cI?t=6099
Drzzs: http://drzzs.com/busting-ghost-switching/ (Not really sure if this is relevant to this)

Really new to this stuff. :slight_smile:

Thanks a lot for all the help so far.

Final plan would be to add a PIR sensor + manual switch to sonoff basic and use it bathroom such that the physical switch acts as an override or something and toggles via PIR.

You are mixing issues here. Stick to one step at a time. I can’t help you with the Mac since my hands have never been soiled with a Mac. I’ve never touched one. Kidding aside, I have no clue what tools are available to you to flash your Sonoff.

I have made a few different flash devices, but they are all basically a UART to go between the PC USB port and the ESP Serial port. I came across this a few weeks ago and am using it exclusively:
https://www.ebay.com/i/122878750886?chn=ps

It’s available from several suppliers for $3, but if you want it tomorrow, Amazon has it for $10. While you don’t need it for flashing Sonoff devices, the UART/PROG switch that grounds GPIO0 in the PROG position is needed for flashing the ESP-01 device.

esp8266-240x160

For the Sonoff devices, I made an adapter cable from male- to female breadboard wires:

UART2ESP-Cable

Next, you need to solder the header pins to the Sonoff device. Some people try to simply hold the wires in the holes during flashing with mixed success. (All it takes is a nanosecond break in the connection to make the flash bad- worse yet, you may not even know it didn’t flash correctly and you will spend hours complaining about the device, not your process.)

The most difficult part for me is to hold the button down on the Sonoff device while plugging in the USB cable.

Sonoff-Flasher

You can’t possibly be experiencing the Ghosting problem in Dr. Zzzs video since you don’t yet have the Tasmota software flashed to your device.

I have not had to install pull down/up resistors on any of my Sonoff. I’m not sure for certain if GPIO 14 has a pull down/up but I have just connected two wires between ground and GPIO14 and when I touch them together the Sonoff turns on or off.