4gang wall switch에 esphome 플래싱하려면 이전에는 tuya cloudcutter나 bk7231flasher로 했는데 libretiny로 넘어와선 ltchiptool을 사용해 플래싱.
esphome 대시보드에서 해당칩에 맞게 컴파일한 후 다운로드하고 ltchiptool을 사용해 플래싱.
ECU 테스트 BDM 프레임을 사용해 과정이 순탄하진 않았지만 납땜없이 진행. 프로브 펜이 4개지만 각각에 듀폰케이블을 2개 연결할 수 있어 Gnd가 연결된 프로브 펜에 선 하나 더 연결한 후 그걸로 CEN터치해서 플래싱모드로 진입할 수 있음.
zemismart 4gang 기준으로 핀구성은 relay는 pin6,24,26,14고 버튼은 pin8,7,10,23이며 led조명은 pin 11번.
1번 relay에는 항상 전원이 연결되어야 하는 yeelight 천장등을 연결해둬서 restore_mode를 항상 켬으로 해두고 길게 누름으로 relay조작하고 클릭, 더블클릭으로 HA를 통해 천장등 조작하게 함.
esphome yaml 구성.
esphome:name: wallswitch
bk72xx:
board: cb3s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "wallswitch Hotspot"
password: !secret wifi_password
captive_portal:
logger:
api:
ota:
- platform: esphome
password: !secret ota_password
web_server:
port: 80
switch:
- platform: gpio
name: "Bedroom Button1"
restore_mode: ALWAYS_ON
pin: 6
id: load1
- platform: gpio
name: "Bedroom Button2"
pin: 24
id: load2
- platform: gpio
name: "Bedroom Button3"
pin: 26
id: load3
- platform: gpio
name: "Bedroom Button4"
pin: 14
id: load4
- platform: restart
name: "Bedroom Restart"
binary_sensor:
- platform: gpio
pin:
number: 8
mode: INPUT_PULLUP
inverted: True
name: "Bedroom Button1"
on_multi_click:
- timing:
- ON for at most 0.5s
- OFF for at least 0.4s
then:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.ceiling
kelvin: '4000'
brightness: '255'
- timing:
- ON for at most 0.5s
- OFF for at most 0.3s
- ON for at most 0.3s
- OFF for at least 0.1s
then:
- homeassistant.service:
service: input_select.select_next
data:
entity_id: input_select.ceiling
- timing:
- ON for 0.6s to 5s
- OFF for at least 0.1s
then:
- switch.toggle: load1
- platform: gpiopin:
number: 7
mode: INPUT_PULLUP
inverted: True
name: "Bedroom Button2"
on_press:
then:
- switch.toggle: load2
- platform: gpio
pin:
number: 10
mode: INPUT_PULLUP
inverted: True
name: "Bedroom Button3"
on_press:
then:
- switch.toggle: load3
- platform: gpio
pin:
number: 23
mode: INPUT_PULLUP
inverted: True
name: "Bedroom Button4"
on_press:
then:
- switch.toggle: load4
light:
- platform: status_led
name: "Bedroom LED"
restore_mode: ALWAYS_ON
entity_category: config
pin:
number: 11
sensor:
- platform: wifi_signal
name: "Bedroom WiFi"
update_interval: 60s
- platform: uptime
name: "Bedroom Uptime"
- platform: internal_temperature
name: "Bedroom Device Temperature"
text_sensor:
- platform: version
name: "Bedroom Version"