2024/10/10

KS-811-3 Wall Switch (bk7231n)



bk7231n칩 스위치

tuya cloudcutter를 이용해 플래싱하고 relay는 pin14,16,15고 버튼은 pin17,26,24며 led조명은 pin 22번으로 해 esphome yaml작성.
물론 tuya cloudcutter없이 플래싱도 납땜없이 듀폰케이블만 이용해 가능. T(tx) R(rx) G(gnd) V(3.3v) I(gnd와 쇼트)

switch:
  - platform: gpio
    name: relay1
    pin: 14
    id: load1

  - platform: gpio
    name: relay2
    pin: 16
    id: load2

  - platform: gpio
    name: relay3
    pin: 15
    id: load3

binary_sensor:
  - platform: gpio
    pin:
      number: 17
      mode: INPUT_PULLUP
      inverted: True
    name: "TuyaWS Top"
    on_press:
      - switch.toggle: load1

  - platform: gpio
    pin:
      number: 26
      mode: INPUT_PULLUP
      inverted: True
    name: "TuyaWS Middle"
    on_press:
      - switch.toggle: load2

  - platform: gpio
    pin:
      number: 24
      mode: INPUT_PULLUP
      inverted: True
    name: "TuyaWS Buttom"
    on_press:
      - switch.toggle: load3

light:
  - platform: status_led
    name: "TuyaWS LED"
    restore_mode: ALWAYS_OFF
    entity_category: config
    pin:
      number: 22
      inverted: true