警告

⚠️ 该智能开关存在品质缺陷,请避免购买!

我的两个开关在运行一年半后均无法工作,推测问题在于其使用的劣质 DC-DC 电源模块 KP3210SG 及其外围的电容 C5 (10 V,470 μF)。具体表现为电容 C5 鼓包、KP3210SG 输出电压不正确,导致 ESP 模块供电电压不足(仅约 1.8 V)无法工作。

硬件

GPIO 引脚功能

GPIO 引脚 功能
3 LED 指示灯(低电平触发)
4 开关 S1 信号(低电平触发)
5 开关 S2 信号(低电平触发)
12 继电器 L1
13 配对按钮
14 继电器 L2

来源:https://devices.esphome.io/devices/loratap-sc500w/

外壳有三处卡扣,很容易撬开,PCB 正面:

pcb-1

反面:

pcb-2

运气不错,使用的模块是基于 ESP8285 的 TYWE2S,而不是基于 BK72XX 系列 SoC 的新模块。

根据资料,分别给 TXRXGND3V3 引脚焊上线:

flashing-wiring-1

并短接模块背面的 IO0 触点与 GND

flashing-wiring-2

软件

ESPHome 配置示例:

substitutions:
  device_name: '百叶窗 1'

esphome:
  name: shutter-1
  comment: '卷帘百叶窗开关 1'

esp8266:
  board: esp8285  # 1 MB 闪存
  restore_from_flash: false

preferences:
  flash_write_interval: 24h  # 降低闪存写入频率以避免磨损,按需调整

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:
  # 硬重启
  - platform: restart
    id: restart_button
    name: '重启 ${device_name}'
    entity_category: diagnostic

status_led:  # 自带 LED
  pin:
    number: 3
    inverted: true

binary_sensor:
  # 外部开关
  - 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
  # 把配对按钮用作硬重启按钮
  - platform: gpio
    id: pairing_button
    pin: 13
    on_release:
      then:
        - button.press: restart_button
    internal: true

# 继电器们
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  # 调整为实际全开耗时
    close_action:
      - output.turn_off: relay_open
      - output.turn_on: relay_close
    close_duration: 40s  # 调整为实际全关耗时
    stop_action:
      - output.turn_off: relay_open
      - output.turn_off: relay_close
    assumed_state: true

接入 Home Assistant:

hass

0 Comments

发表评论

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注