First ESPHome project (ESP32-S2 feather board) stuck on initial configuration install

@pioneersky I adapted your config and got it to validate. Thank you! Now I need to figure out how to install it to the ESP32

@nickrout I’m still running into the arch64 issues. Going back a ways, you mentioned installing ESPHome on my desktop/laptop. Were you referencing these instructions ( Installing ESPHome Manually — ESPHome) or is there a GUI-based version to install to a Windows machine?

Have never installed it on Windows. But if you do you should have the UI. I assume the command ”esphome dashboard”

This Getting Started with the ESPHome Command Line — ESPHome indicates the dashboard isn’t available on Windows.

To be sure though, if HA is installed on an RPi (arch64), but I’m accessing the ESPHome HA add-on via Edge on my Windows machine (x64), and the ESP32 is plugged in via USB, shouldn’t that work? Or, is the problem that the ESPHome HA add-on is on arch64 hardware? In other words, do both ESPHome and the machine the ESP32 is plugged into both have to NOT be arch64?

IIRC the problem was with compiling, which is on the aarch64 machine.

You don’t need the UI anyway.

Thank you. Yes, my HA is on an RPi 3B+ which, as I understand, is an arch64 machine.

Disclaimer: I’m honestly not trying to complain, just understand (because I must still be missing something obvious). So, here goes…

According to this (Home Assistant Analytics (home-assistant.io)), almost half of all HA installations are on Raspberry Pi’s running on 64-bit architecture (arch64). HA maintains ESPHome (as one of the services paid for by Nabu Casa subscriptions), but I cannot use an arch64 machine to compile ESPHome code. Do I have all that right?

The issue is the tools that ESPhome has to use with these esp32-s2’s. currently only esp-idf framework works, which from what I understand does not work on aarch64 systems. The vast majority of current esp32 and esp8266 boards are compatible with the arduino framework. So the limitation is more due to Espressif and Arduino developers at this point than ESPHome. You would not have this issue with the Adafruit HUZZAH32 – ESP32 Feather Board : ID 3405 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits for example or other generic esp32’s.

In my journey I also installed it on Windows and @nickrout is definitely right that you don’t need the web interface. I recommend creating the .yaml file in notepad++ and then compile in the command line. It is less scary than it seems!

2 Likes

Also with help from the ESPHome Discord got some help on the i2c power issue fixed, if you have a rev B board add this to your yaml:

switch:
  - platform: gpio
    id: power_on
    restore_mode: ALWAYS_OFF
    pin: 7

for a rev C board you would do:

switch:
  - platform: gpio
    id: power_on
    restore_mode: ALWAYS_ON
    pin: 7

Ah, that’s the piece that was not clear to me (despite my research). Thanks for explaining. I hope “they” sort it out soon since these S2 boards seem to be more ideal for many IoT low power applications.

In the meantime, I did install ESPHome (including the 100 MB Python installation) and through the CLI was successful with getting my board on my network and seen by HA, but now I’m trying to get the BME-280 configuration correct since the three sensors are reporting ‘Unknown.’

I think I have a Rev C board since I bought it in April, but I’ve tried both of your code snippets. In both cases, compiling errors out with about 10 ‘undefined reference’ notifications before exiting the compiler and reporting ‘FAILED.’

So this depends on how much you copied my config exactly, I am just using the Feather ESP32-S2 not the TFT. Having looked at the pinout diagrams on the Adafruit for the Feateher ESP32-S2 TFT the pins for mine would likely not line up for yours. So when setting up i2C you see how on the diagram the GPIO pins for SDA and SCL are 42 & 41 respectively, so when setting up i2c you need to do:

i2c:
  sda: 42
  scl: 41

additionally having looked at the TFT learning document it looks like the i2c power switch only applies to the TFT display if I’m reading that correctly which needs to be pulled high. So I’m thinking that for your board you would do:

switch:
  - platform: gpio
    id: power_on
    restore_mode: ALWAYS_ON
    pin: 21

I was checking and even though platformio seems to support the TFT board, when I try to create a configuration calling the board it says there is no board found with adafruit_feather_esp32s2_tft, so it may not be supported by ESPHome yet.

I pretty much copied it exactly, except I noticed that name was required for a GPIO switch. I did come across the pinout for your board, but didn’t realize it would be spec’d out different by just adding the TFT display.

Anyways, I made those I2C and GPIO switch changes, but received the same (or very similar) compilation errors. So, I commented out the GPIO switch block and pushed that. It compiled and flashed successfully, but now I’m getting something about ‘Can’t connect to ESPHome API,’ so I cannot tell if the board is happy with the I2C config, but HA still reports ‘Unavailable’ for the three entities, so I assume not.

←[32mINFO Starting log output from 10.0.0.38 using esphome API←[0m
←[33mWARNING Can't connect to ESPHome API for 10.0.0.38: Error connecting to ('10.0.0.38', 6053): [WinError 121] The semaphore timeout period has expired←[0m
←[32mINFO Trying to reconnect to 10.0.0.38 in the background←[0m

EDIT: Also, I don’t know if it counts for much, but I added the “-tft” to this block in ESPHome and it did validate.

esp32:
  board: featheresp32-s2-tft
  variant: esp32s2
  framework:
    type: esp-idf
    version: recommended

Does it say it’s connecting to your wifi network correctly? I seem to remember seeing that when my wifi settings/network settings were off. I have manual_ip settings that may not line up with your network, like the dns server not sure how much of that you modified. You can remove the manual_ip setting entirely if you like, I have it there for OTA updates but at this point you’re just trying to get it to work nevermind ota updates.

I had already scrapped that manual IP block. It’s definitely connected to my network. I can see it on my network, ESPHome indicates ONLINE, and I am able to flash via OTA.

I deleted the device from integrations and restarted HA thinking it would auto-discover it and maybe reset something with the API, but HA didn’t discover anything even though ESPHome still indicates ONLINE.

I would need to see your configuration to provide anymore insight at this point, you’re getting close! I’m slugging through this because I bunch a bought of these feathers without really doing research. If I could do it all over again, at least for my purposes I probably would have gotten some of the cheaper more basic options.

Yeah. That’s my major takeaway too. I didn’t realize each of these boards require months of coding to get implemented or whatever.

Here’s my entire humidor.yaml minus a couple redacted passwords (which I think came from the initial config in ESPHome, but I don’t know if I even need):

esphome:
  name: humidor

esp32:
  board: featheresp32-s2
  variant: esp32s2
  framework:
    type: esp-idf
    version: recommended

# Enable logging
logger:

# Enable Home Assistant API
api:

i2c:
  sda: 42
  scl: 41
  scan: true
  id: stemma

sensor:
  - platform: bme280
    temperature:
      name: "Humidor Temperature"
      oversampling: 16x
    pressure:
      name: "Humidor Pressure"
    humidity:
      name: "Humidor Humidity"
    address: 0x77
    update_interval: 60s

# switch:
  # - platform: gpio
    # name: "Stemma Power"
    # id: power_on
    # restore_mode: ALWAYS_ON
    # pin: 7

ota:
  password: "redacted"

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

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

I’m not sure from looking at that why you’re getting the error with it not connecting to Homeassistant, have you tried MQTT to see if it receives that? I’d recommend hopping in the esphome discord server to see if they can help.

1 Like

For what it’s worth, I’ve been trying to get an ESP32S2 (T8-ESP32-S2) and have had similar troubles. I have HAOS on a Pi3B which has trouble compiling and produces similar errors about the Platformio toolchain.

I now use my PC with ESPHome installed. I use Notepad++ to edit the .yaml and esphome to compile and flash the image ‘esphome run cvan.yaml’. Although I had to use ESP-Web to load firmware.elf the first time to get it onboard, I can now use OTA.

Also since this has a 135x240 TFT I had to sort out the display parameters, but I’ll add that to a note/pull request on Github.

1 Like

Can someone who has gotten the Adafruit ESP32S2-TFT working help a befuddled ESPHome noob out? Specifically:

  1. What sequence of BOOT and RST buttons do you push to get it into an acceptable bootloader mode?
  2. Which serial port did you select when you got it there?

I feel like I’ve tried every combination, and never actually get connected and successfully “Prepare for First Use”. I either get a failure Failed to initialize. Try resetting your device or holding the BOOT button while selecting your serial port until it starts preparing the installation. and have to disconnect/reconnect, or it just stalls at the “Connecting” spinner.

My environment:

  • Old 2016 Intel-based Mac (my only non-ARM system)
  • Chrome browser
  • Using the ESPHome web API (vs the Home Assistant integration - which does not work if you don’t have SSL set up)
  • Known good USB C to C cable
    Here’s a screen shot of my connection choices if it helps:

Any and all tips welcome!

Asking the same question: has anyone gotten the Adafruit Feather ESP32-S2 TFT to work with Home Assistant? I’m trying to work my way through it and am hitting the same roadblocks described in this thread. I’m willing to keep plugging away but this thread would suggest it’s (still?) a dead-end?
Thanks!
jtf

1 Like

Unfortunately, I have not made any progress on this, either. My suspicion is that ESPHome can’t talk to the boot loader on Adafruit ESP32-S2 boards. Yo definitely can’t use the default U2F bootloader - you have to get into the ROM bootloader via a factory reset.

I was able to reliably load other boot firmware, and started down the path of using the ESPhome command line tool, with featheresp32-s2 as board type, but ran out of steam. If you make any breakthroughs, please post!

Here’s what worked for me for Adafruit Feather ESP32-S2 TFT:

#1 Erase (I used the tool here: Adafruit ESPTool)

#2 Create new Device in ESPHome module in HAOS, then upload ESPHome .bin using same tool to the Feather.

#3 Once tool shows up online, you can start configuring. Here’s a working config for a couple of the Adafruit I2C sensors for me. I haven’t tinkered with the TFT yet. Note the board section and I2C settings – there are several earlier posts that didn’t work for me.

esphome:
  name: adafruit-esp32-tft
  friendly_name: Adafruit ESP32 TFT

esp32:
  board: adafruit_feather_esp32s2_tft

i2c:
  sda: GPIO42
  scl: GPIO41
  id: bus_a

sensor:
  - platform: sht4x
    temperature:
      name: "Temperature"
      id: sht_temp
    humidity:
      name: "Relative Humidity"
      id: sht_hum
    update_interval: 60s
    i2c_id: bus_a
  
  - platform: ens160
    eco2:
      name: "ENS160 eCO2"
    tvoc:
      name: "ENS160 Total Volatile Organic Compounds"
    aqi:
      name: "ENS160 Air Quality Index"
    update_interval: 60s
    address: 0x53
    i2c_id: bus_a
    compensation:
      temperature: sht_temp
      humidity: sht_hum

web_server:
  port: 80
1 Like