Did anyone already trying to get ESPHome to work on LilyGo T-Embed

The code above looks complete without any additional libraries.

Thanks for the code @lukasz-tuz, it’s working like a charm (the display).
I got almost everything working now, except for the LEDs because of the GPIO PINs used on the ESP32-S3 are not accepted by FastLED 3.3.2 code. Looks like version 3.5.0 has corrected the PINs mapping but I’m having a hard time using/changing to the newest version on ESPHome :frowning:

Ah, yes, the FastLED issue. When trying to enable the st7789 I learned about the external_components feature of ESPHome. That did not really help with the display, but creates an easy way to fix the LEDs.

  1. In your project directory, create esphome/components/fastled_base and esphome/components/fastled_spi directories.
  2. Copy ESPHome core component code (all files), e.g. from here (fastled_base), and here (fastled_spi)
  3. In your local version of fastled_base open __init__.py and simply bump the FastLED code:
    await light.register_light(var, config)
    cg.add_library("fastled/FastLED", "3.5.0")
    return var
  1. In your YAML file configure directory with external components:
external_components:
  - source:
      type: local
      path: esphome/components
  1. Configure LEDs as usual:
light:
  - platform: fastled_spi
    chipset: APA102
    data_pin: GPIO42
    clock_pin: GPIO45
    rgb_order: BGR
    num_leds: 7
    name: "T-Embed LED Ring"
    effects:
      - addressable_rainbow:
      - addressable_scan:

When building, ESPHome will use local fastled_spi definition, and will download 3.5.0 version of FastLED. For T-Embed, with ESP32S3, this is completely fine; seems that ESPHome keeps the version downgraded due to some issues coming up on ESP8266.

BTW, T-Embed makes for a great smart home remote :smiley: Some time ago I tried building my own version of such device, with OLED display and NeoPixel LED ring. It actually worked for a while, but there were stability issues on account of my poor soldering skills.

However, I was able to move ESPHome YAML from that device to T-Embed with very little changes (mostly related to different display controller), and now it works like a charm :smiley: Now I’m trying to get esphome-lvgl working, hoping to make a component that implements ESPHome’s Display Menu integration using fancy lvgl widgets.

EDIT: I just clicked the esphome-remote link. Oh well, looks like the home remote thing has already been done, and much better than my attempts at that :joy: Thanks for the link @lmatter!

3 Likes

Thanks @lukasz-tuz, this was a big help.
I’m used to external_components, and I have serveral customizations from original ESPHome components, but somehow, I’ve missed that version configuration on fastled_base.

I’m glad your project is working, and now I’m trying to decide what type of I2C sensor I want to use with this device (maybe SCD41) and a way to increase the size of the original 3D Printed case to fit the sensor.
Thanks again.

You’re welcome! I hope that by standing on the shoulders of you giants I can get a cool remote working. Sadly the T-Embed only has one button. I might have to add another to it somewhere.

Sorry if this is boneheaded, but how do you get this installed on the T-embed? I took the config from @lukasz-tuz, manually built it (modern format) and installed via web.esphome.io but the logs say:

ESP-ROM:esp32s3-20210327
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x40043ac8
Invalid chip id. Expected 9 read 3460. Bootloader for wrong chip?
ets_main.c 329 
Terminal disconnected: NetworkError: The device has been lost.

What type of ESP should I select when I create a new entry in my local esphome manager? I tried Generic ESP32-WROVER [EDIT: I realized WROVER was wrong and switched to Espressif ESP32 Dev Module - still didn’t work]
Thanks!

In esphome click install|plug into (there is choice of whether the device is pugged into the computer you are running the browser on, or the machine running esphome)

They are the same machine (I don’t run esphome on HA, I run it on my laptop in docker). I’m asking about this step:

Sorry, its shown here Did anyone already trying to get ESPHome to work on LilyGo T-Embed - #19 by lukasz-tuz

platformio_options:
  board_build.mcu: esp32s3
  board_build.name: "LilyGO T-Embed ESP32-S3"
  board_build.upload.flash_size: "16MB"
  board_build.upload.maximum_size: 16777216
  board_build.vendor: "LilyGO"

Choose any one and edit it if need be.

Thanks. I must be doing something wrong then because I don’t have esp32s3 as an option. I pulled the latest version of the container - maybe I need a dev version?
[EDIT: I think the issue I’m having is that I’m running esphome:latest. I just found a container called esphome:dev. I’ll try that one]

ok, running esphome-dev gives me the ESP32-S3 choice. But now I’m getting a new issue, which is the editor (and compiler) not recognizing the platformio-options component: I must be still missing something.

According to the docs, the platformio_options should be indented right

(Although this is contrary to @lukasz-tuz 's post)

1 Like

That was it! Thanks! I owe the Internet 1 rtfm.

esphome:
  name: test2

  platformio_options:
    board_build.mcu: esp32s3
    board_build.name: "LilyGO T-Embed ESP32-S3"
    board_build.upload.flash_size: "16MB"
    board_build.upload.maximum_size: 16777216
    board_build.vendor: "LilyGO"
 
  on_boot:
  # Send the `SLPOUT` command as early as possible
    priority: 800
    then:
      - lambda: |-
          id(disp).enable();
          id(disp).transfer_byte(0x11);
          id(disp).disable();
# Also, turn the lights on
      - switch.turn_on: power_on

Lol, we are all in that debt.

1 Like

So I’ve had some small success here. I was able to install the firmware using web.esphome.io and it was discovered by my HA instance. I’ve seen before where an esphome device won’t “work” until I add it into home assistant (i.e., hanging on the “api” step?) so I did that. I can get logs via wireless:

[21:52:33][C][st7789v:129]:   B/L Pin: GPIO15
[21:52:33][C][ota:093]: Over-The-Air Updates:
[21:52:33][C][ota:094]:   Address: test2.local:3232
[21:52:33][C][ota:097]:   Using Password.
[21:52:33][W][ota:103]: Last Boot was an unhandled reset, will proceed to safe mode in 7 restarts
[21:52:33][C][api:138]: API Server:
[21:52:33][C][api:139]:   Address: test2.local:6053
[21:52:33][C][api:143]:   Using noise encryption: NO
[21:52:42][D][sensor:127]: 'Rotary Encoder': Sending state 2.00000 steps with 0 decimals of accuracy
[21:52:43][D][sensor:127]: 'Rotary Encoder': Sending state 1.00000 steps with 0 decimals of accuracy
[21:52:43][D][esp32.preferences:113]: Saving 1 preferences to flash...
[21:52:43][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

But the display was off and the rotary does nothing [other than log]. I went into the device configuration in HA and when I turned the power on and the display backlight on, it started to display the time (wrong timezone though) but that’s it. It’s a cool looking clock at this point.

I have not performed the steps in the “Fast LED issue” comment, perhaps I will try that next.
Is this the expected outcome?

[EDIT - I read the code - that’s exactly what it’s supposed to do. ] Next I will try to get esphome_remote working on it. Thanks for the huge boost here!

Woot! I have it working with esphome-remote. Still some kinks to work out but I was able to control my HomeAssistant with it. Support for Lilygo T-Embed device. WIP by lmatter · Pull Request #39 · landonr/esphome-remote · GitHub

According to the docs, the platformio_options should be indented right
(Although this is contrary to @lukasz-tuz 's post)

Aw, crap, I did not notice that indentation got messed up :frowning_face: Sorry about that and thanks for pointing that out. Original post edited, so - hopefully - no more mess-ups there :slight_smile:

1 Like