Athom Tasmota Curtain Module KM01

Original product link

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

Why don’t you talk to Athom? It is as you advise here

I already did! I sent them this link…

Please refer to the configuration of tasmota. There is no problem with the GPIO of tasmota and it has been verified.

https://templates.blakadder.com/athom_KM01-TAS.html

It seems the N and L switching was fixed in later versions of the hardware.

Also, it’s quite difficult to flash this to esphome, as it comes with a newer version of Tasmota that has a different partition layout. Note: flashing this with esphome via the web will render the device unflashable!

Instead, the esp32 board needs to be flashed via serial, which is quite challenging due to the board positioning:
rn_image_picker_lib_temp_8eaf7260-817b-4d27-b657-025518f14b42-1

with the pins being really hard to access:
PXL_20241117_075828784

The board needs to be desoldered, and then the pins can be accessed:
rn_image_picker_lib_temp_ae5b4c27-5101-4143-80a7-0f3e23d16df0-1

rn_image_picker_lib_temp_b2e1108c-f51e-4117-a8c3-64c2011c9dc8
rn_image_picker_lib_temp_1c050fb6-a875-48a9-aafc-c143a7c44b83

Note that being an esp32-c3, gpio9, not gpio0, must be shorted to put the device in boot mode.