[OBSOLETE] Sonoff, Sonoff TH, S20, Dual, 4CH, POW, & Touch Device Handler & SmartApp ($5 & $10 Smart Switches)

That resistor looks like Brown Red Black, rather than Brown Black Red… hence it could probably cause by having a 120 Ohm resistor on that pin… 1k or higher is what I would suggest.

Does the random switching of the Sonoff happen when the wires shown in the picture are shorter?

I broke the GPIO0 button off of my Sonoff TH before I could flash it. Is there a way to get it into download mode by soldering a wire from somewhere to ground?

@cjcharles

I checked the resistor with my multimeter before installing to make sure, comes right in at 9.98kohm.

Ill try shortening the wires and see how it performs.

Ah ok, five band resistor with a slightly funky coloured end band (or perhaps just the colours in the photo came out strange). Yes suggest testing with shorter wires, and a ~5k resistor instead, or wait for the capacitor

@Jeremy_Nisbett Suggest trying to solder to the pads which the switch was sitting on, that will be easier than any other point on the PCB. Ive soldered to the individual pins on the ESP chip before and its not a particularly fun task!!

@cjcharles I tried a 5k resistor and it made it flicker less. I went all the way to a 1k resistor and that solved the issue. Do you think 1k is too much to run full time? Still waiting on amazon to deliver the cap kit. Is a capacitor still the best solution?

I tried shortening the wire to about 2 inches and didn’t notice a difference. I realize I could shorten it more for testing purposes but would need at least 2 inches to reach the switch for a permanent solution.

1 Like

10mW is probably not going to cause any major long term issues and will only cost like 2 pence per year or something tiny. However it will cause some additional stress on the voltage dropper so might cause slightly earlier failure of the sonoff.

I would probably change it if you already have some capacitors ordered as it should hopefully work with just the capacitor instead of the resistor, and worst case you can try with the 10k and capacitor.

The solder pads are gone. The button broke right off. Couldn’t I just solder a thin wire to ground and just carefully touch the wire to GPIO0 on the ESP8266 chip? My only issue is, I have no idea on this chip which pin is GPIO0.lol. I’ve googled it extensively with little success.

Thank you for this great work.
I managed to flash my wifi switch and it is working great. Now i would like to add a password, but i cant figure out where in the handler do i enter the password?

HI there

Firstly thank you @erocm1231 for the wonderful work.
I successfully flashed my 4ch Sonoff and was able to bring it on my wifi network.
The next steps involved adding the device Handler which i also successfully did.
Now the issue is while adding the child devices as smart apps.
I get the following error

No signature of method: script1507922951739144193343.metadata() is applicable for argument types: (script1507922951739144193343$_run_closure1) values: [script1507922951739144193343$_run_closure1@3c6822d5] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

Any help will be appreciated

By the way i am using the code for the child device on the link below

https://raw.githubusercontent.com/erocm123/SmartThingsPublic/master/devicetypes/erocm123/switch-child-device.src/switch-child-device.groovy

Many Thanks

@cjcharles Capacitors arrived today and I gave them a try. I tried a 1uf 5uf and 10uf capcitor. All three were able to prevent the switching on that dimmer circuit in my video with no additional resistor (capacitor installed between gpio14 and ground). I ended up going with a 10 uf cap with the thought that the higher capacitance will help better in a worse case scenario with the induced current from the dimmer. The only negative side effect I have noticed is that there is a slightly perceptible delay when using the toggle switch to control the sonoff, only when the switch goes from closed to open. I assume this is because it takes a split second for the capacitor to discharge so that GPIO14 can see ground again. I would say its on the order of a .5-1 second delay after I flip the switch. No big deal but something for others to be aware of.

One other thing I have observed is that when I close the circuit breaker, and the sonoff boots up, it will close its relay when another switch is flipped on the same circuit. this only happens once though. In other words after it closes the relay that one time, flipping other switches on the same circuit no longer effects it after the initial hiccup. Slightly annoying but will only be an issue after a power outage going forward.

1 Like

Glad to hear it @BillyT I would actually sick with 1uF as that will not only give you the smallest delay but also put least stress on other components (the stress its because the other resistors aren’t installed to limit the capacitor charging - again not a problem but hence better to keep it smaller if possible). If it still causes a rare switch toggle then maybe go to 2.2 if you have it, or your next highest value.

The first switch on effect its very very weird! I would understand it if regular but not only on the first event! If you add a capacitor between 3v3 and ground (similar value maybe 5uF or something) then that should solve it if causing you annoyance.

@cjcharles Thanks for all the help!

Since Ive already soldered 10uf cap’s on 4 sonoffs. Would it make more sense to pull them out, desolder the 10uf caps and replace with 2.2’s or simply add resistors (100ohm between one leg of the cap and gpio14?).

Also, could you explain how the larger capacity cap can put more stress on the circuit? Is it because the power supply has to do more work to charge up the larger capacity capacitor when the external switch is opened from a closed position? I ask this because some of the sonoffs are in locations where the external switch is rarely used (like once a week) The rest of the time, they are activated via the smartthings app or Alexa voice commands.

If they are already installed then I wouldnt worry too much! I obviously responded too slowly!! Either change the caps or do nothing would be my suggestion…(probably the latter)

To answer your question then yes, it basically causes some stress to charge a capacitor (since they can draw large currents - in electronic theory virtually infinite, but obviously not true in reality). The smaller the capacitor the easier it is to draw from normal circuitry. If the switch is not used often then i would probably agree with you and not bother…

@erocm1231 I just got a chance to install the new firmware and it works perfectly! Thank you so much!

1 Like

great job man :slight_smile: , is it possible to have a device handler for the broadlink sp3 wifi outlet? https://www.aliexpress.com/store/product/Broadlink-SP3-sp-cc-EU-socket-Smart-wifi-Power-plug-outlet-16A-timer-Wireless-Control-Home/337490_32603960105.html

it’s much better than the sonoff device and also cheap…

Great! This procedure works for me too! Excellent! Thank you for share.

1 Like

I don’t think the Broadlink stuff uses an esp unfortunately.

Hi Eric
is the sonoff and h801 firmware are patch for the key reinstallation attacks(kcrack),if not are you planning to take a look into it ?

1 Like

Eric,

I have the Sonoff TH10 module and have successfully flashed it with your firmware, version 2.05 is reported in the info page of the device’s webpages. It works well with smartthings and web control, unless I enable switch - toggle control. When selected and GPIO14 is left disconnected the relay clicks periodically. I’ve added an additional pullup resistor and 1nF capacitor in parallel to the switch, to no effect.
Connecting to an oscilloscope the pin goes low for a short period of time exactly every 5 seconds. It looks like it’s left as a test pin.

If I configure it for a AM2302 sensor and connect one, it all works fine, so GPIO14 is working fine.

Have you done testing with an external switch and this setup? Is it my board, or something else?

Is it possible to get a copy of your source code? I’ve searched this thread and your github but can’t find it. With the code I could find what’s going on and probably fix it.

Thanks in advance
Simon

Hi
I am using the connect smartapp and device handler for my Sonoff 10A switch - everything is working perfectly - so far so good & thanks for putting this together!

I do have another Sonoff switch 10A where I have loaded the latest ESPeasy R120 firmware on. This is not discovered by the SmartApp nor does it work w. the device handler, even when added manually.

  • Has anyone done work on a device handler supporting the new ESPeasy Firmware like R120?

The new ESPeasy firmware addes a bunch of functionality like sensor support, automation rules and MQTT. Check out: https://www.letscontrolit.com/wiki/index.php/ESPEasy

  • Currently I am running this switch to control a bathroom fan using DHT11 sensor - all selfcontained using rules and logging humidity levels via MQTT.