ESP32-C3 with integrated GC9A01 - cheap touch controller

Here is the code for the video uploaded earlier:
smart_switch/smart_switch_deepsleep.yaml at main · GadgetFactory-Jeannie/smart_switch (github.com)

This is an automation to make a HA light group follow this smart switch.
smart_switch/smart_switch_automation.yaml at main · GadgetFactory-Jeannie/smart_switch (github.com)

This works but I’m not super happy with it. These are the things that I don’t like:

  • You have to do a gesture twice to wake up from deep sleep. I just want to swipe down to turn off/on a light, not twice.
  • It is very difficult to touch the color wheel precisely enough to get the color you want.
  • I never got a chance to get espnow working with this so there is a delay after waking from deepsleep before it connects to HA and can control a light.

I’m leaning away from moving forward with this device and am going to focus more on an esp32-c6 device as a sleepy end device.

2 Likes

Thank you for your work on this. I am intending to power it permanently, so the wake up probably won’t be a concern.

Cheers.

Yes, I think I’m going to do the same, my kids really like it so I will probably keep this plugged in so they can change the color of lights. It works pretty well in that scenario.

1 Like

Hi, I’m getting this now:
ValueError: Component ID watchface was not declared to inherit from Component, or was registered twice.

and after some googling, found this:
There was a change in the display structure that breaks all external display components; the fix needs to be done in the external component. See landonr/lilygo-tdisplays3-esphome#46 for an example of the needed changes to have this compile again

Any idea how to workaround this?
EDIT:
after doing this:

external_components:
  - source: github://zagnuts/esphome-components
#    components: [ gc9a01 ]
  - source: github://GadgetFactory/[email protected] 

it finally starts to compile, but errors with:

INFO ESPHome 2023.12.5
INFO Reading configuration /config/esphome/smart-button.yaml...
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing smart-button (board: esp32-c3-devkitm-1; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.0.1
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
|-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- CST816S @ 1.1.1+sha.dd4f520
Compiling .pioenvs/smart-button/src/esphome/components/animation/animation.cpp.o
Compiling .pioenvs/smart-button/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/smart-button/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/smart-button/src/esphome/components/api/subscribe_state.cpp.o
In file included from src/esphome/components/animation/animation.h:2,
                 from src/esphome/components/animation/animation.cpp:1:
src/esphome/components/image/image.h:34:41: error: expected class-name before '{' token
 class Image : public display::BaseImage {
                                         ^
src/esphome/components/image/image.h:42:36: error: 'esphome::display::Display' has not been declared
   void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override;
                                    ^~~~~~~
src/esphome/components/image/image.h:38:7: error: 'int esphome::image::Image::get_width() const' marked 'override', but does not override
   int get_width() const override;
       ^~~~~~~~~
src/esphome/components/image/image.h:39:7: error: 'int esphome::image::Image::get_height() const' marked 'override', but does not override
   int get_height() const override;
       ^~~~~~~~~~
src/esphome/components/image/image.h:42:8: error: 'void esphome::image::Image::draw(int, int, int*, esphome::Color, esphome::Color)' marked 'override', but does not override
   void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override;
        ^~~~
*** [.pioenvs/smart-button/src/esphome/components/animation/animation.cpp.o] Error 1
========================= [FAILED] Took 10.77 seconds =========================

Fix:

external_components:
#  - source: github://zagnuts/esphome-components
  - source: github://bearpawmaxim/esphome@pr3625fix
    components: [ gc9a01 ]
  - source: github://GadgetFactory/[email protected] 
display:
#  - platform: ili9xxx
#    model: gc9a01
# Above is for when or if this is merged into the ili9xxx platform
# Until then though, need to use an external component
  - platform: gc9a01
    id: watchface
    reset_pin: $repin
    cs_pin: $cspin
    dc_pin: $dcpin
3 Likes

For those people, who are using my fork of the display driver (github://bearpawmaxim/esphome@pr3625fix). I advise you to try to set 16bit color with the line eight_bit_color: false. You will get x2 increase of drawing speed and more essential colors. On the opposite side, it will consume x2 ram (115200 vs 57600) but that is not a problem because we have lots of it.

For anyone else, it is also a good idea to use the touchscreen driver from this pull request https://github.com/esphome/esphome/pull/5941

Config example for using the display and new touchscreen drivers:

external_components:
  - source: github://bearpawmaxim/esphome@pr3625fix
    components: [gc9a01]
  - source: github://pr#5941
    components: [cst816]

spi:
  mosi_pin: GPIO7
  clk_pin: GPIO6

i2c:
  sda: GPIO4
  scl: GPIO5

output:
  - platform: ledc
    pin: GPIO3
    id: gpio_3_backlight_pwm

light:
  - platform: monochromatic
    output: gpio_3_backlight_pwm
    name: "Display Backlight"
    id: backlight
    restore_mode: ALWAYS_ON

display:
#  - platform: ili9xxx
#    model: gc9a01
# Above is for when or if this is merged into the ili9xxx platform
  - platform: gc9a01
    id: watchface
    cs_pin: GPIO10
    dc_pin: GPIO2
    width: 240
    height: 240
    eight_bit_color: false
    rotation: 270
    update_interval: 1s
    lambda: |-
      ...

touchscreen:
  id: cst816d
  platform: cst816
  interrupt_pin: GPIO0
  reset_pin: GPIO1
  transform:
    swap_xy: true
    mirror_y: true
  on_touch:
    - ...

Full config can be found here

4 Likes

Nice, I’ve been using the display component on the M5Dial (which has the same display), and 2x draw speed would be a big improvement. Seems to work well, although might impact a little bit on the touch response for the ft3267 touchscreen.

1 Like

Could you add the color_wheel.jpg from your config to your github repo? Or at least specify the resolution and bit depth I should use to create my own?

Actually, I guess I’m missing even more, as the yaml fails to compile with this error:

display.gc9a01: [source <unicode string>:167]
  
  Pin 1 is used in multiple places.

Set backlight to lower brightness if needed, using 50% or less greatly lowers power usage. I used the below in Lambda to set it to 50%:
id(back_light).turn_on().set_brightness(0.5).perform()

Try:

#reset_pin: GPIO1

under

display:

Any idea how to detect swipe up, down, left and right with this library?
I can’t use single touch as it it often accidentally touched when picked up.

I suggest you read the changelog for esphome 2023.12. there are several relevant threads for that change.

I think you have to (very simplified):

  1. In on_touch, save the start coordinates to a variable.
  2. In on_update check how coordinates changed and, if changed for some amount of pixels in any direction, theat this as swipe. Update the variable also.
  3. In on_release validate whether it was a correct swipe and, if yes, do your logic.
1 Like

Hey Guys, thanks for your awesome work! I ordered this device a few month ago y couldn’t get it to work. A few days agoi stumbled by accident over this post and it worked like a charm!
Yesterday i tried expanding my code a bit by adding another sensor for home assistant, nothing related to GPIO, and now my ESP won’t boot properly, giving my this thru the usb-c log on web.esphome.io. :

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4038bece
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   281][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[   280][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000

Then i tried GPIO8 as MISO pin. Since any output pin is used, that was my best guess. then i tried GPIO0 and both gave me this error log:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4206f848
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382602
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000

I tried different libraries from this thread and strange enough, everytime i got the same error message.

[ 281][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!

Did anyone else enocounter this problem or maybe knows how to fix it?

No yaml, no issue.

I went back to the other library, because it is working fine for me and I only need to detect swipes and simple touch anywhere on the screen. Haven’t looked into this any more, as my use case was to use swipe instead of touch to prevent accidental touches when handling or picking up the device.
Overall this little device works great.
I tried BLE as a scanner or Proxy, but seems like it’s a bit too much for it to handle. It did detect a device, so it’s technically working.
One thing I never got to work was GIF animations, they were extremely slow, but maybe my display refresh was not defined and defaulted to 1s, I might come back to this, as I would like to show a little animated flame when heating is on.

Looks like you’re in a boot loop. I’d disconnect any external wires other than power and see if it continues. If it does, then try installing a clean binary image to the device. If you post your code, we may be able to identify an issue there. Good luck. :slight_smile:

Just ignore it because: 1) our display do not need this and 2) it isn’t wired anywhere.

Thank you all for your efforts in providing so many infos. :pray:

I think I miss something obvious but… When trying to install the yaml codes you have shared here over esphome in home assistant I get following error. I get this error with different yaml files.

What could be wrong? I am sure it something obvious but searching around for infos didn’t help me find sth…

Thx for the help

The error I get

INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/esphome-web-1433f8.yaml...
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 33, in <module>
    sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 1041, in main
    return run_esphome(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 1028, in run_esphome
    rc = POST_CONFIG_ACTIONS[args.command](args, config)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 407, in command_compile
    exit_code = write_cpp(config)
                ^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 192, in write_cpp
    generate_cpp_contents(config)
  File "/esphome/esphome/__main__.py", line 204, in generate_cpp_contents
    CORE.flush_tasks()
  File "/esphome/esphome/core/__init__.py", line 679, in flush_tasks
    self.event_loop.flush_tasks()
  File "/esphome/esphome/coroutine.py", line 246, in flush_tasks
    next(task.iterator)
  File "/esphome/esphome/__main__.py", line 184, in wrapped
    await coro(conf)
  File "/data/external_components/1ffebe30/esphome/components/gc9a01/display.py", line 77, in to_code
    await setup_gc9a01(var, config)
  File "/data/external_components/1ffebe30/esphome/components/gc9a01/display.py", line 56, in setup_gc9a01
    await display.register_display(var, config)
  File "/esphome/esphome/components/display/__init__.py", line 119, in register_display
    await cg.register_component(var, config)
  File "/esphome/esphome/cpp_helpers.py", line 56, in register_component
    raise ValueError(
ValueError: Component ID watchface was not declared to inherit from Component, or was registered twice. Please create a bug report with your configuration.

Example file from @zagnuts

substitutions:

devicename: wallwatch01

friendname: WallWatch01

location: master

board: esp32-c3-devkitm-1

repin: GPIO1

dcpin: GPIO2

bkpin: GPIO3

clpin: GPIO6

mopin: GPIO7

cspin: GPIO10

esphome:

name: $devicename

friendly_name: $friendname

esp32:

board: $board

framework:

type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

encryption:

key: "bmNSHIjcdzxFCivO4nUM55dDA4V4iajEM9+tO3o1S5k="

ota:

wifi:

ssid: !secret wifi_ssid

password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails

ap:

ssid: "Esphome-Web-1433F8"

password: "Mc5mSHkTZf8p"

captive_portal:

time:

- platform: homeassistant

timezone: "Australia/Melbourne"

id: esptime

# Test - see if the thing picks up BLE info

#esp32_ble_tracker:

#nope - locks up

#SpokeTooSoon - actually does work, kinda. Slows down the startup significantly then claims to scan but nothing is found

#Either is not supported or antenna is really weak

sensor:

- platform: uptime

name: "$devicename Uptime"

- platform: wifi_signal

name: "$devicename WiFi Signal"

update_interval: 60s

- platform: homeassistant

id: outdoor_temperature

entity_id: sensor.gw1000_v1_7_6_outdoor_temperature

external_components:

# - source: github://pr#3625

# components: [ gc9a01 ]

- source: github://4cello/esphome@gc9a01

components: ["gc9a01"]

# Arduino code shows screen is a GC9A01 with CST816D touch screen

spi:

mosi_pin: $mopin

clk_pin: $clpin

#mosi = Master Out Slave In

#miso = Master In Slave Out or fermented bean paste. In this case, most likely the former rather than the latter. Doesn't matter as not used.

# Need to turn on backlight as by default is not on

output:

- platform: ledc

pin: $bkpin

id: gpio_3_backlight_pwm

light:

- platform: monochromatic

output: gpio_3_backlight_pwm

name: "Display Backlight"

id: back_light

restore_mode: ALWAYS_ON

font:

- file: 'gfonts://Roboto'

id: font_16

size: 16

- file: 'gfonts://Roboto'

id: font_32

size: 32

color:

- id: my_red

red: 100%

green: 3%

blue: 5%

- id: my_green

red: 3%

green: 100%

blue: 5%

- id: my_blue

red: 3%

green: 5%

blue: 100%

display:

# - platform: ili9xxx

# model: gc9a01

# Above is for when or if this is merged into the ili9xxx platform

- platform: gc9a01

id: watchface

reset_pin: $repin

cs_pin: $cspin

dc_pin: $dcpin

# Rotate the screen so usb socket is pointing down

rotation: 90

# Print the date on one line in blue

# Print the current time on the next line, but in a bigger font but default white

# Print the outside temperature in green

# Surround the lot by a red circle with centre at 120, 120 and a radius of 115 because why not

lambda: |-

it.strftime(120,80, id(font_16), id(my_blue), TextAlign::CENTER, "%A %b %d", id(esptime).now());

it.strftime(120,120, id(font_32), TextAlign::CENTER, "%I:%M %p", id(esptime).now());

it.printf(120, 170, id(font_32), id(my_green), TextAlign::CENTER, "Now: %.1f°", id(outdoor_temperature).state);

it.circle(120, 120, 115, id(my_red));

There have been a few changes to HA & esphome since I last posted my code, and these can break things - in particular if you are living on the edge (so to speak) with a device that isn’t officially supported yet so is relying upon external libraries that aren’t necessarily updated as regularly.

I haven’t recompiled my code recently, but noticed above some suggestions on changes to address issues that I’d try first. eg:

external_components:
  - source: github://bearpawmaxim/esphome@pr3625fix
    components: [ gc9a01 ]
  - source: github://GadgetFactory/[email protected] 

FWIW Compiled and tested on esphome 2023.12.9 and HA 2024.1.6 just then.

Also I’d recommend not using any code word for word as mine, for example, refers to sensors that you almost certainly don’t have in your home! Basically yes use it as a template but cut out the stuff you don’t need and then slowly add things in - potentially using my code (and others who have uploaded their versions) to help you adapt yours to suite your requirements. Have fun!