WiFi Switch Module EW-WiFi-S01

Whilst superficially similair in appearance and functionality to other units these aren’t Tuya and instead use the sonoff EWELink app. Truth be told I already have some similar to previous ones and wanted more…but mis-ordered on AliExpress and got these. However having opened them up - they are ESP8285 with a small additional MCU that appears to handle the high voltage external switch detection.


PCB has RX and TX with pads labelled. A bit of checking and Grnd and VCC are also there but unlabelled. Fortunately GPIO 0 is used for the MCU to indicate the button push - so can be tracked on the PCB. Whilst there is no pad - you can ground one end of the surface mount resistors enough to get into Serial mode and flash. So soldering is required…but I had 4 all flashed without drama

The relevant pins are:-
Switch : GPIO0
Status LED : GPIO13
Relay: GPIO12
There is also a buzzer that I haven’t got working yet.(but i wont use it, so not hugely fussed)

my ESPHome YAML…

...
substitutions:
  switch_id: "sw_04"

status_led:
  pin:
    number: GPIO13
    inverted: True

binary_sensor:
  - platform: gpio
    id: ${switch_id}_in_switch1
    pin: GPIO0
    name: "${switch_id} Switch 1"
    filters:
      - invert:
    internal: true
#
# on_click for momentary switch
#
    on_click:
      min_length: 50ms
      max_length: 350ms
      then:
       - light.toggle: ${switch_id}_light_1
#
# on_state for std rocker switch
#
#    on_state:
#      then:
#        - light.toggle: ${switch_id}_light_1

sensor:
  - platform: wifi_signal
    name: "${switch_id} WiFi Signal Sensor"
    update_interval: 60s


switch:
  - platform: restart
    name: "${switch_id} Restart"
    
light:
  - platform: binary
    name: "${switch_id} Light 1"
    id: "${switch_id}_light_1"
    output: "${switch_id}_output_1"
    
output:
  - platform: gpio
    pin: GPIO12
    id: ${switch_id}_output_1

I have these as a light - because I prefer them to appear in HA that way - can just as easily have them as a switch of course.

2 Likes

Could you please add it to esphome-configs.io ?

1 Like

Have played a bit more…and looks like the mcu pulses gpio0 on any state change regardless off the actual switch state. So rocker or momentary, hold or brief etc.

Not an issue for general on/off control but means the switch input cant do clever hold to set a scene or anything similair.

Like you, @DeanoX, I bought a pile of these and haven’t been able to OTA flash with the MITM hack of tuya-convert.

Your instructions above are great - but I wasn’t able to get this to work and (alas) - I went to medical school instead of studying engineering, so I’m not certain I’ve got it right. Please bear with me … I’ve been able to flash sonoffs (and even sonoff a sonoff mini that I bricked trying OTA). My USB - serial adapter has 3.3V, Rx, Tx, Gnd (and 5v … but I know to stay away from that). I connected 3.3v to vcc and jumped GND to the same resistor you used above. Things look good and I connect it all … the device beeps and flashes when power is delivered (so it “knows” the "button is being pushed?) … but tasmotizer.py farts and aborts every time. Have I got this right? If I can get it to work … I’ll document it well for others - as this is not (yet) well documented on the web (that I can find).

(for reference) …

Hi,

I suspect the issue is you are not pulling GPIO0 low with where you have the yellow wire.

Touch it on the end of R7 as shown in the O/Ps 3rd picture he has labelled it GPIO0

I done a few of these previously with no issues and just done 2 more tonight without problems (after referring to this thread for a refresher)

If its entered flash mode you get a couple of beeps when first powered up and no more also the led does not flash at all, if it is you are not in flash mode.