ESPHome configuration for ESP32_Relay_AC X1_v1.1

Hi!

It took me a while to figure out how to configure this board for esphome as the documentation on the product page was terrible, so I’m sharing it for other for future reference.

The board is this:

Esphome configuration is:

esphome:
  name: esp32
  friendly_name: Esp32

esp32:
  variant: esp32
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  - platform: esphome
    password: ""

wifi:
  ssid:
  password:

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ESP32 Fallback Hotspot"
    password: ""

captive_portal:

light:
  - platform: status_led
    id: led
    name: "ESP32 Led"
    restore_mode: ALWAYS_OFF
    internal: True #Remove or change to false to show on home assistant
    pin:
      number: GPIO023
      inverted: False

switch:
  - platform: gpio
    pin: GPIO16
    name: "ESP32 Relay"
    id: ESP32_relay

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
    name: Button
    filters:
      - invert
      - delayed_on_off: 50ms
    on_press:
      then:
        - switch.toggle: ESP32_relay    
        - light.toggle: led

Is configured to use IO0 button to toggle the LED and Relay module at the same time.