This page leads to a confusion, as GPIO for the Switch2 and LedLinki are swapped:
GPIOs:
GPIO# Component
GPIO0 None
GPIO1 None
GPIO2 None
GPIO3 LedLinki GPIO13 LedLinki
GPIO4 Switch1
GPIO5 Button1
GPIO9 None
GPIO10 None
GPIO12 Relay1
GPIO13 Switch2 GPIO3 Switch2
GPIO14 Relay2
GPIO15 None
GPIO16 None
GPIO17 None
FLAG None
In addition, wiring graphs suggest that switches must be connected to S1/S2 plus L, that didn’t work for me untill I used N.
Next follows my esphome yaml file for a shutter:
substitutions:
devicename: b28-shutter-5
u_devicename: Shutter 5
friendly_name: $u_devicename
esphome:
name: $devicename
# name_add_mac_suffix: true
project:
name: b28.shutter_5
version: "0.1"
esp8266:
board: esp8285
wifi:
# use_address: 192.168.88.74
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "$u_devicename Hotspot"
password: !secret wifi_password
captive_portal:
api:
ota:
web_server:
port: 80
logger:
baud_rate: 0
sensor:
- platform: uptime
name: "${friendly_name} Uptime"
disabled_by_default: true
- platform: wifi_signal
name: "WiFi Signal $u_devicename"
update_interval: 60s
status_led:
pin:
number: GPIO13
inverted: yes
binary_sensor:
- platform: status
name: "${friendly_name} Status"
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
inverted: True
name: "$u_devicename button"
on_press:
then:
# - cover.toggle: shutter_5
- if:
condition:
lambda: "return id(shutter_5).position == COVER_OPEN;"
then:
- cover.close: shutter_5
else:
- cover.open: shutter_5
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "$u_devicename open"
on_press:
- logger.log: "$u_devicename switch open"
- cover.open: shutter_5
- platform: gpio
pin:
number: GPIO3
mode: INPUT_PULLUP
inverted: True
name: "$u_devicename close"
on_press:
- logger.log: "$u_devicename switch close"
- cover.close: shutter_5
button:
- platform: factory_reset
name: Restart with Factory Default Settings
id: Reset
text_sensor:
- platform: wifi_info
ip_address:
name: $u_devicename IP Address
disabled_by_default: true
ssid:
name: $u_devicename SSID
disabled_by_default: true
switch:
- platform: gpio
pin: GPIO12
interlock: &interlock [relay_open, relay_close]
id: relay_open
- platform: gpio
pin: GPIO14
interlock: *interlock
id: relay_close
cover:
# - platform: time_based
- platform: template
device_class: shutter
name: shutter 5
id: shutter_5
open_action:
- switch.turn_on: relay_open
- switch.turn_off: relay_close
# open_duration: 60s
close_action:
- switch.turn_on: relay_close
- switch.turn_off: relay_open
# close_duration: 60s
stop_action:
- switch.turn_off: relay_open
- switch.turn_off: relay_close
optimistic: true