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)
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!
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
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.
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.
@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?
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.
For the Sonoff devices, I made an adapter cable from male- to female breadboard wires:
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.)
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.