WARNING

⚠️ This smart switch has quality defects, AVOID PURCHASING!

Both of my switches stopped working after a year and a half, I suspect that the problem lies in the low quality DC-DC power module KP3210SG and the capacitor C5 (10 V, 470 μF) next to it. The symptoms include the capacitor C5 bulging, incorrect output voltage on the KP3210SG, which results in insufficient voltage supplied to the ESP module (only about 1.8 V), rendering it unable to boot.

Hardware

GPIO Functions

GPIO Pin Function
3 LED indicator (low level trigger)
4 Switch S1 signal (low level trigger)
5 Switch S2 signal (low level trigger)
12 Relay L1
13 Pairing button
14 Relay L2

Source: https://devices.esphome.io/devices/loratap-sc500w/

The case has three snap-fits, it's very easy to disassemble it, PCB front side:

pcb-1

back side:

pcb-2

Luckily, the module is an ESP8285-based TYWE2S, not a newer one based on the BK72XX family SoC.

Follow the datasheet, solder wires to the TX, RX, GND, 3V3 pins respectively:

flashing-wiring-1

then short the IO0 pad to GND on the back side:

flashing-wiring-2

Software

ESPHome configuration example:

substitutions:
  device_name: 'Shutter 1'

esphome:
  name: shutter-1
  comment: 'Roller shutter switch 1'

esp8266:
  board: esp8285  # 1 MB flash size
  restore_from_flash: false

preferences:
  flash_write_interval: 24h  # reduce write frequency to flash to avoid wearing it out, adjust it as needed

logger:
  level: WARN
#  baud_rate: 115200

wifi:
  fast_connect: true
  networks:
    - ssid: !secret wifi_ssid
      bssid: !secret wifi_bssid
      password: !secret wifi_password
  domain: !secret domain_name

api:
ota:
  password: !secret ota_password

button:
  # for hard restart
  - platform: restart
    id: restart_button
    name: 'Restart ${device_name}'
    entity_category: diagnostic

status_led:  # onboard LED
  pin:
    number: 3
    inverted: true

binary_sensor:
  # external switches
  - platform: gpio
    id: switch_open
    pin:
      number: 4
      inverted: true
    on_press:
      then:
        - cover.open: shutter
    on_release:
      then:
        - cover.stop: shutter
    internal: true
  - platform: gpio
    id: switch_close
    pin:
      number: 5
      inverted: true
    on_press:
      then:
        - cover.close: shutter
    on_release:
      then:
        - cover.stop: shutter
    internal: true
  # use the pairing button for hard restarting
  - platform: gpio
    id: pairing_button
    pin: 13
    on_release:
      then:
        - button.press: restart_button
    internal: true

# relays
output:
  - platform: gpio
    id: relay_open
    pin: 12
  - platform: gpio
    id: relay_close
    pin: 14

cover:
  - platform: time_based
    id: shutter
    name: '${device_name}'
    device_class: shutter
    open_action:
      - output.turn_off: relay_close
      - output.turn_on: relay_open
    open_duration: 40s  # adjust it to the actual duration to fully open
    close_action:
      - output.turn_off: relay_open
      - output.turn_on: relay_close
    close_duration: 40s  # adjust it to the actual duration to fully close
    stop_action:
      - output.turn_off: relay_open
      - output.turn_off: relay_close
    assumed_state: true

Added to Home Assistant:

hass

1 Comment

jojo · 2023-09-19 at 20:00

Thanks a lot for this tutorial!
It did help me quite a lot.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *