Putting a Sonoff in your wall switch box

i just received new sonoff basic but i am having following issues when i am trying to flash TASMOTA. When i click verify on Arduino software i am keep getting following error. I tried so many different thing but same outcome. Can someone look at the error and let me where am i going wrong.

error:

Arduino: 1.8.5 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DOUT, 115200, 1M (64K SPIFFS), ck, Disabled, None"

C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\arduino-builder -dump-prefs -logger=machine -hardware C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\hardware -hardware C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\tools-builder -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\hardware\tools\avr -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages -built-in-libraries C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\libraries -libraries C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries -fqbn=esp8266:esp8266:generic:CpuFrequency=80,FlashFreq=40,FlashMode=dout,UploadSpeed=115200,FlashSize=1M64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10805 -build-path C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622 -warnings=none -build-cache C:\Users\RAHULP~1\AppData\Local\Temp\arduino_cache_584722 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.mkspiffs.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\mkspiffs\0.1.2 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -verbose C:\Users\Rahul Patel\Documents\Home Assistant\light switch\Sonoff-Tasmota-development\sonoff\sonoff.ino
C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\arduino-builder -compile -logger=machine -hardware C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\hardware -hardware C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\tools-builder -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\hardware\tools\avr -tools C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages -built-in-libraries C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\libraries -libraries C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries -fqbn=esp8266:esp8266:generic:CpuFrequency=80,FlashFreq=40,FlashMode=dout,UploadSpeed=115200,FlashSize=1M64,ResetMethod=ck,Debug=Disabled,DebugLevel=None____ -ide-version=10805 -build-path C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622 -warnings=none -build-cache C:\Users\RAHULP~1\AppData\Local\Temp\arduino_cache_584722 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.mkspiffs.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\mkspiffs\0.1.2 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -verbose C:\Users\Rahul Patel\Documents\Home Assistant\light switch\Sonoff-Tasmota-development\sonoff\sonoff.ino
Using board 'generic' from platform in folder: C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0
Using core 'esp8266' from platform in folder: C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0
Detecting libraries used...
"C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01"  -DESP8266 "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622\sketch\sonoff.ino.cpp" -o "nul"
"C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01"  -DESP8266 "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries\PubSubClient\src" "C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622\sketch\sonoff.ino.cpp" -o "nul"
"C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_ESP01"  -DESP8266 "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\packages\esp8266\hardware\esp8266\2.3.0\variants\generic" "-IC:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries\PubSubClient\src" "C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622\sketch\sonoff.ino.cpp" -o "C:\Users\RAHULP~1\AppData\Local\Temp\arduino_build_671622\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries\PubSubClient\src/PubSubClient.h:77:0,

                 from C:\Users\Rahul Patel\Documents\Home Assistant\light switch\Sonoff-Tasmota-development\sonoff\sonoff.ino:40:

c:\users\rahul patel\documents\home assistant\light switch\arduino-1.8.5\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\functional:48:28: fatal error: bits/c++config.h: No such file or directory

 #include <bits/c++config.h>

                            ^

compilation terminated.

Using library PubSubClient at version 2.6 in folder: C:\Users\Rahul Patel\Documents\Home Assistant\light switch\arduino-1.8.5\portable\sketchbook\libraries\PubSubClient 
exit status 1
Error compiling for board Generic ESP8266 Module.

someone please help me

I used platform.Io as it’s much simpler with no extra set up steps needed, so no direct experience of Arduino IDE.

From what you posted though, it suggests you haven’t done the extra prep required as you have it set to 64k SPIFFS and it should be NO SPIFFS according to the TASMOTA wiki.

Did you try to wirelessly flash TASMOTO. This video was very helpful to me: https://www.youtube.com/watch?v=ONFhXM5R-t4&t=6s

I tried wireless way and it work. now i am coming on to issue of Dual R2 only has following 2 buttons and no 09 switch1 and 10 switch2 options

@Johnydemarco I believe I have the same thing you have in another spot in my house where I have 2 switches (3 way in the USA) with one having the feed and the other having the load. If this is how your diagrams showing to wire with a single sonoff can you explain it a bit more? Is the left diagram one way of wireing it and the right another way or is that switch 1 on the left and 2 on the right? I see S1 - 4. What is each one and where is the sonoff?

Looks like some reading should’ve been done before you decided to go for the Dual…

After reading the document I can confirm I have duel R2 version and I still don’t get GPIO0 or GPIO9 option to assign them as switch.

It looks like when I did the over the air flashing using Mac, the sonoff tasmota was older firmware or something so it didn’t have “39 Sonoff Dual R2” option on web interface but then I web flashed it with new sonoff.bin and it gave me option for dual R2 but didn’t have GPIO0 or GPIO9 to be programmed as buttons but then I tried jumping the wire between ground and button 0 on the board and it’s works like a switch. Also button 1 and ground acts as switch for second relay. So I am assuming it’s default as rocker switch or something. I will install it in the wall see if everything works fine.

Just an FYI I was able to fit Sonoff basic into switch box by trimming it down and placing against one of the switch box side. See image below

Just finished installing duel R2 into wall switch box and it was very difficult to fit it in the 2 gang switch box. I had to trim all of the bottom base plate of the of Sonoff duel enclosure except for where Sonoff circuit board sits. I took completely top off the case and taped it all around. It was very tight fitting length wise but was able to fit it. Tested it and everything works fine. Thank you guys for the help. Now my eltimate task is to work on 3-way switch and see if it works.

Finally done.
Here’s the 3-way switch vid:

3 Likes

I’m wondering if I stick with stock firmware and a toggle switch do I need to solder anything to the Sonoff? Can’t I just connect it between the lights and the toggle switch and leave toggle switch on letting sonoff control the current? Is the soldering only if you want the sonoff and toggle in sync?

If you leave the stock firmware, I don’t think you can connect the sonoffs to Home Assistant (at least not with MQTT). That’s the reason for using Tasmota. Then if you’re using Tasmota that on-board button has a bunch of other functions and multiple presses could mess up the function of your sonoff. Avoiding that situation is the reason for soldering to GPIO14 and using a separate button to control the lights.

Hope that helps.

List of Tasmota on-board button functions:

Is anyone experiencing random flickering?

That happened to one of my Sonoff basic connected light for couple of times yesterday than it stopped so I thought it was wire connection but than it didn’t happened since than so I ignored it

Please read this:
https://groups.google.com/forum/#!topic/sonoffusers/5vmtT6mRxHE

I also have the same problem so i ordered the Ceramic Chip Capacitor but unfortunate they still not arrived,
so i can’t give you feedback yet.

Thank.


Scroll to the bottom of the page to the section titled “Electrical Considerations”.
Here’s an explanation about why it works:
http://www.learningaboutelectronics.com/Articles/Low-pass-filter.php

I just did it on a sonoff in my garage. Now we wait to see if it happens any more.

My wires from GPIO14 and GND snapped off while wiring up the switch in the wall box. What wire size/type(stranded/solid) did you use for this purpose ? Also, the input and output wires on the Sonoff Basic don’t seem to accept 12 gauge stranded. Just wondering what others experience has been and what the best combinations are.

I installed the filter last Wednesday but the issue continues. The lights doesn’t turn on by itself it’s just flicking a few times at night. Im running on generator for the past 117 days (hurricane Maria) so I’ll wait until the power is restored in my area and see if there’s any difference.