ESP32-S2 DevkitM-1 V1.0

Hello,

I have ESP32-S2 from Espressif. When adding the device to ESPHome all works fine. It connects to WiFi after flash is complete. When I tried to add some functionality to it, for example sensors, switches or deep sleep I am getting the following error:

INFO Reading configuration /config/esphome/esp32-s2.yaml…
INFO Generating C++ source…
INFO Compiling app…
Processing esp32-s2 (board: esp32-s2-saola-1; framework: espidf; platform: platformio/espressif32 @ 3.5.0)

HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash

  • framework-espidf 3.40302.0 (4.3.2)
  • tool-cmake 3.16.4
  • tool-ninja 1.7.1
  • toolchain-riscv32-esp 8.4.0+2021r2-patch2
  • toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
    Reading CMake configuration…
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    No dependencies
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_frame_helper.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_pb2.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_pb2_service.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_server.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/list_entities.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/proto.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/subscribe_state.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/user_services.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/gpio_arduino.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/gpio_idf.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/preferences.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/logger/logger.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/md5/md5.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_component.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp32_arduino.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp8266.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp_idf.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/network/util.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_arduino_esp32.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_arduino_esp8266.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_esp_idf.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_component.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/bsd_sockets_impl.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/lwip_raw_tcp_impl.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/socket.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp32_arduino.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp8266.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp_idf.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/application.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/component.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/component_iterator.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/controller.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/helpers.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/log.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/scheduler.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/util.o
    Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/main.o
    Linking /data/esp32-s2/.pioenvs/esp32-s2/firmware.elf
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/…/lib/gcc/xtensa-esp32s2-elf/8.4.0/…/…/…/…/xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection11device_infoERKNS0_17DeviceInfoRequestE+0x10): undefined reference to esphome::deep_sleep::global_has_deep_sleep' /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x6c): undefined reference to vtable for esphome::deep_sleep::DeepSleepComponent’
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/…/lib/gcc/xtensa-esp32s2-elf/8.4.0/…/…/…/…/xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x7c): undefined reference to esphome::deep_sleep::DeepSleepComponent::set_sleep_duration(unsigned int)' /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x80): undefined reference to esphome::deep_sleep::DeepSleepComponent::set_run_duration(unsigned int)’
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/…/lib/gcc/xtensa-esp32s2-elf/8.4.0/…/…/…/…/xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o: in function setup()': /config/esphome/.esphome/build/esp32-s2/src/main.cpp:101: undefined reference to esphome::deep_sleep::DeepSleepComponent::set_sleep_duration(unsigned int)’
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/…/lib/gcc/xtensa-esp32s2-elf/8.4.0/…/…/…/…/xtensa-esp32s2-elf/bin/ld: /config/esphome/.esphome/build/esp32-s2/src/main.cpp:102: undefined reference to `esphome::deep_sleep::DeepSleepComponent::set_run_duration(unsigned int)’
    collect2: error: ld returned 1 exit status
    *** [/data/esp32-s2/.pioenvs/esp32-s2/firmware.elf] Error 1
    ========================= [FAILED] Took 44.61 seconds =========================

If anyone encountered this please if you are willing to share your experiences.

Thank you.

You’ll need to share your yaml.

1 Like

Hello,
thank you for looking into it.

Here is the working log. As you can see it connects to WiFi and communicate with HA.

INFO Reading configuration /config/esphome/eso42s2.yaml…
INFO Starting log output from eso42s2.local using esphome API
INFO Successfully connected to eso42s2.local
[10:33:40][I][app:102]: ESPHome version 2022.6.2 compiled on Jul 20 2022, 21:20:52
[10:33:40][C][wifi:491]: WiFi:
[10:33:40][C][wifi:353]: Local MAC: 84:F7:03:D9:E4:40
[10:33:40][C][wifi:354]: SSID: ‘HA’[redacted]
[10:33:40][C][wifi:355]: IP Address: 192.168.1.247
[10:33:40][C][wifi:357]: BSSID: E0:DB:D1:F8:10:8B[redacted]
[10:33:40][C][wifi:358]: Hostname: ‘eso42s2’
[10:33:40][C][wifi:360]: Signal strength: -54 dB ▂▄▆█
[10:33:40][C][wifi:364]: Channel: 3
[10:33:40][C][wifi:365]: Subnet: 255.255.255.0
[10:33:40][C][wifi:366]: Gateway: 192.168.1.1
[10:33:40][C][wifi:367]: DNS1: 64.59.xxx.xx
[10:33:40][C][wifi:368]: DNS2: 64.59.xxx.xxx
[10:33:40][C][logger:275]: Logger:
[10:33:40][C][logger:276]: Level: DEBUG
[10:33:40][C][logger:277]: Log Baud Rate: 115200
[10:33:40][C][logger:278]: Hardware UART: UART0
[10:33:40][C][mdns:084]: mDNS:
[10:33:40][C][mdns:085]: Hostname: eso42s2
[10:33:40][C][ota:085]: Over-The-Air Updates:
[10:33:40][C][ota:086]: Address: eso42s2.local:3232
[10:33:40][C][ota:089]: Using Password.
[10:33:40][C][api:138]: API Server:
[10:33:40][C][api:139]: Address: eso42s2.local:6053
[10:33:40][C][api:141]: Using noise encryption: YES

Here is working yaml file:

esphome:
name: eso42s2

esp32:
board: esp32-s2-saola-1
framework:
type: esp-idf

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: “8iCD92cEKHUCvQHSslfJA3yk4SZ7jW8EgJ5mnYTJYlE=”

ota:
password: “f14e71ff2182d8a504cd4accaa96b53d”

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Enable fallback hotspot in case wifi connection fails

ap:
ssid: “Eso42S2 Fallback Hotspot”
password: “B3WITqOlb0ZG”

Here is same not working yaml. It is the same except switch sensor added. I have multiple ESP32 sensors where all this is working fine. The only difference for this yaml it uses esp-idf framework, others are using arduino.

esphome:
name: eso42s2

esp32:
board: esp32-s2-saola-1
framework:
type: esp-idf

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: “8iCD92cEKHUCvQHSslfJA3yk4SZ7jW8EgJ5mnYTJYlE=”

ota:
password: “f14e71ff2182d8a504cd4accaa96b53d”

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Enable fallback hotspot in case wifi connection fails

ap:
ssid: “Eso42S2 Fallback Hotspot”
password: “B3WITqOlb0ZG”

switch:

  • platform: gpio
    pin: GPIO18
    name: “test switch”

I hope this will help solving the issue.

Thank you.

Hello I will try to follow your advice. Here is again.
Good working YAML file

esphome:
  name: esp32-s2

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "E8hk0SvdQfUhvVy7FR8rqEVlrv6qG+fIg25QnfrJBy8="

ota:
  password: "28355f38be380cb88fa1fb03d3a17beb"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Esp32-S2 Fallback Hotspot"
    password: "K3vBRRoY4NeP"

And corresponding log:

INFO Reading configuration /config/esphome/esp32-s2.yaml...
INFO Starting log output from esp32-s2.local using esphome API
INFO Successfully connected to esp32-s2.local
[08:30:26][I][app:102]: ESPHome version 2022.6.2 compiled on Jul 21 2022, 14:35:18
[08:30:26][C][wifi:491]: WiFi:
[08:30:26][C][wifi:353]:   Local MAC: 84:F7:03:D9:E4:40
[08:30:26][C][wifi:354]:   SSID: 'HA'[redacted]
[08:30:26][C][wifi:355]:   IP Address: 192.168.1.247
[08:30:26][C][wifi:357]:   BSSID: E0:DB:D1:F8:10:8B[redacted]
[08:30:26][C][wifi:358]:   Hostname: 'esp32-s2'
[08:30:26][C][wifi:360]:   Signal strength: -52 dB ▂▄▆█
[08:30:26][C][wifi:364]:   Channel: 3
[08:30:26][C][wifi:365]:   Subnet: 255.255.255.0
[08:30:26][C][wifi:366]:   Gateway: 192.168.1.1
[08:30:26][C][wifi:367]:   DNS1: 64.59.184.15
[08:30:26][C][wifi:368]:   DNS2: 64.59.190.245
[08:30:26][C][logger:275]: Logger:
[08:30:26][C][logger:276]:   Level: DEBUG
[08:30:26][C][logger:277]:   Log Baud Rate: 115200
[08:30:26][C][logger:278]:   Hardware UART: UART0
[08:30:26][C][mdns:084]: mDNS:
[08:30:26][C][mdns:085]:   Hostname: esp32-s2
[08:30:26][C][ota:085]: Over-The-Air Updates:
[08:30:26][C][ota:086]:   Address: esp32-s2.local:3232
[08:30:26][C][ota:089]:   Using Password.
[08:30:26][C][api:138]: API Server:
[08:30:26][C][api:139]:   Address: esp32-s2.local:6053
[08:30:26][C][api:141]:   Using noise encryption: YES

Here is non working YAML. As you can see I just tried to add switch component.

esphome:
  name: esp32-s2

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "E8hk0SvdQfUhvVy7FR8rqEVlrv6qG+fIg25QnfrJBy8="

ota:
  password: "28355f38be380cb88fa1fb03d3a17beb"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Esp32-S2 Fallback Hotspot"
    password: "K3vBRRoY4NeP"

switch:
  - platform: gpio
    pin: GPIO18
    name: "test switch"

And log when trying to compile the code

INFO Reading configuration /config/esphome/esp32-s2.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp32-s2 (board: esp32-s2-saola-1; framework: espidf; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf 3.40302.0 (4.3.2) 
 - tool-cmake 3.16.4 
 - tool-ninja 1.7.1 
 - toolchain-riscv32-esp 8.4.0+2021r2-patch2 
 - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <noise-c> 0.1.4
|   |-- <libsodium> 1.10018.1
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_frame_helper.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_pb2.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_pb2_service.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_server.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/list_entities.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/proto.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/subscribe_state.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/user_services.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/gpio_arduino.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/gpio_idf.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/esp32/preferences.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/logger/logger.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/md5/md5.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_component.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp32_arduino.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp8266.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/mdns/mdns_esp_idf.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/network/util.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_arduino_esp32.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_arduino_esp8266.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_backend_esp_idf.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/ota/ota_component.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/bsd_sockets_impl.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/lwip_raw_tcp_impl.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/socket/socket.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp32_arduino.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp8266.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/wifi/wifi_component_esp_idf.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/application.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/component.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/component_iterator.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/controller.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/helpers.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/log.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/scheduler.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/util.o
Compiling /data/esp32-s2/.pioenvs/esp32-s2/src/main.o
Linking /data/esp32-s2/.pioenvs/esp32-s2/firmware.elf
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection14switch_commandERKNS0_20SwitchCommandRequestE+0x8): undefined reference to `esphome::switch_::Switch::turn_on()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection14switch_commandERKNS0_20SwitchCommandRequestE+0xc): undefined reference to `esphome::switch_::Switch::turn_off()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_switch_infoEPNS_7switch_6SwitchE+0x18): undefined reference to `esphome::switch_::Switch::get_device_class[abi:cxx11]()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/xtensa-esp32s2-elf/include/c++/8.4.0/bits/basic_string.h:6011: undefined reference to `esphome::switch_::Switch::turn_on()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::switch_command(esphome::api::SwitchCommandRequest const&)':
/config/esphome/.esphome/build/esp32-s2/src/esphome/components/api/api_connection.cpp:465: undefined reference to `esphome::switch_::Switch::turn_off()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::send_switch_info(esphome::switch_::Switch*)':
/config/esphome/.esphome/build/esp32-s2/src/esphome/components/api/api_connection.cpp:452: undefined reference to `esphome::switch_::Switch::get_device_class[abi:cxx11]()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x70): undefined reference to `vtable for esphome::gpio::GPIOSwitch'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x74): undefined reference to `vtable for esphome::gpio::GPIOSwitch'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x90): undefined reference to `esphome::switch_::Switch::Switch()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o:(.literal._Z5setupv+0x94): undefined reference to `esphome::gpio::GPIOSwitch::set_restore_mode(esphome::gpio::GPIOSwitchRestoreMode)'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-s2/src/main.cpp:107: undefined reference to `esphome::switch_::Switch::Switch()'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /config/esphome/.esphome/build/esp32-s2/src/main.cpp:146: undefined reference to `esphome::gpio::GPIOSwitch::set_restore_mode(esphome::gpio::GPIOSwitchRestoreMode)'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/controller.o:(.literal._ZN7esphome10Controller16setup_controllerEb+0x8): undefined reference to `esphome::switch_::Switch::add_on_state_callback(std::function<void (bool)>&&)'
/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /data/esp32-s2/.pioenvs/esp32-s2/src/esphome/core/controller.o: in function `esphome::Controller::setup_controller(bool)':
/config/esphome/.esphome/build/esp32-s2/src/esphome/core/controller.cpp:35: undefined reference to `esphome::switch_::Switch::add_on_state_callback(std::function<void (bool)>&&)'
collect2: error: ld returned 1 exit status
*** [/data/esp32-s2/.pioenvs/esp32-s2/firmware.elf] Error 1
========================= [FAILED] Took 29.05 seconds =========================

I hope this is easier to read now.

Thank you,

Hello,

I got my esp32-S2 somehow working. I think the platform is still under development and some functions are not working. I just added esp-idf version to latest instead of default, everything else is the same.
Here is the yaml file which has switch, dht sensor and deep sleep component. Maybe someone will be found this useful.

esphome:
  name: esp32s2

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf
    version: latest
    
# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "IjddXe9udhMw7ewXU2YXZ0a5GxU1uG7+8MPBqvDDKgY="

ota:
  password: "b05870da12b050ef3d09d2e70a632315"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Esp32S2 Fallback Hotspot"
    password: "3Mu3T0SIzrQ4"
switch:
  - platform: gpio
    pin: GPIO18
    name: "testsw"
sensor:
  - platform: dht
    pin: GPIO19
    temperature:
      name: "temp"
    humidity:
      name: "hum"
    update_interval: 15sec
    
deep_sleep:
  run_duration: 90sec
  sleep_duration: 30sec

Thanks,

I’m currently unable to link against Switch or Binary Sensor code, using esp-idf. Was this working briefly, and now broken?

esphome:
  name: book-button

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf
    version: latest

# WiFi, etc snipped out.

switch:
  - platform: gpio
    name: "Book Button Light"
    pin: GPIO34
    id: display_light
    restore_mode: ALWAYS_OFF