WT32-SC01 with esphome

Nice work!
The question is… is it worth the effort for soooooooooooo much customisation work to be done in order to get touch points and layouts exactly right… or is it a more effective use of time to get an Android tablet and load Fully Kiosk Browser on it?

For me, I went with the latter as I’ve spend waaaaaay too many hours with both ESPHome and openHASP to try to get the tiny little $40 unit to work with even basic functionality.

1 Like

Actually, that is super helpful, thank you!
I’ve been able to replicate that, because following on from my previous comment - when I removed the Amazon Echo Dot with clock from our bedroom the other day we were left without a clock.
Given the WT32-SC01 was no longer being used, I quickly repurposed it as a basic clock display - but with A LOT more control over format, lighting levels at night, and also to show the currently playing track on the speaker it’s sitting on top of.

Thanks to you figuring out the touch screen, I’ll now be able to put a skip button on there.
Will share the code once I’ve got it going.

Ok, got it working, thank you @nouknouk for your researching and learnings on the touchscreen parts.
Here’s the YAML for ESPHome:

substitutions:
  name: "bedroom-clock"
  friendly_name: "Bedroom clock"
  id_prefix: "bedroom_clock"

esphome:
  name: ${name}
  comment: "WT32-SC01"
  on_boot:
    then:
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Night"
          then:
            - display.page.show: Night
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 25%
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Morning"
          then:
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 50%
      - if:
          condition:
            text_sensor.state:
              id: clock_mode
              state: "Day"
          then:
            - display.page.show: Day
            - light.turn_on:
                id: ${id_prefix}_backlight
                brightness: 75%


esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

packages:
  device_base: !include includes/common_settings.yaml

external_components:
  - source: github://gpambrozio/esphome@FT6336U-touch
    components: [ ft63x6 ]


time:
  - platform: homeassistant
    id: homeassistant_time

output:
  - platform: ledc
    pin: GPIO23
    id: gpio_23_backlight_pwm
light:
  - platform: monochromatic
    output: gpio_23_backlight_pwm
    name: "${friendly_name} Backlight"
    id: ${id_prefix}_backlight
    restore_mode: RESTORE_DEFAULT_ON

i2c:
  id: i2c_bus_intern
  sda: 18
  scl: 19
  scan: false

spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  miso_pin: GPIO12

button:
  - platform: restart
    name: "${friendly_name} restart"

display:
  - platform: ili9xxx
    id: ${id_prefix}_display
    model: ST7796
    cs_pin: GPIO15
    dc_pin: GPIO21
    reset_pin: GPIO22
    rotation: 90
    pages:
      - id: Day
        lambda: |-
         it.printf(245, 210, id(xxxxxlarge_font), TextAlign::BASELINE_CENTER, "%s", id(readable_ha_time).state.c_str());
      - id: Music
        lambda: |-
         it.printf(150, 10, id(xxlarge_font), TextAlign::TOP_LEFT, "%s", id(readable_ha_time).state.c_str());
         it.printf(50, 150, id(medium_font), TextAlign::TOP_LEFT, "%s", id(media_artist).state.c_str());
         it.printf(50, 200, id(medium_font), TextAlign::TOP_LEFT, "%s", id(media_title).state.c_str());
         it.printf(425, 280, id(small_font), TextAlign::TOP_LEFT, "SKIP");
      - id: Night
        lambda: |-
         it.printf(245, 210, id(xxxxxlarge_font), my_red, TextAlign::BASELINE_CENTER, "%s", id(readable_ha_time).state.c_str());

touchscreen:
  - platform: ft63x6
    id: ${id_prefix}_touch
    i2c_id: i2c_bus_intern
    on_touch:
      - logger.log:
          format: Touch at (%d, %d)
          args: [touch.x, touch.y]

font:
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxxxlarge_font
    size: 160
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxxlarge_font
    size: 140
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxxlarge_font
    size: 120
  - file:
      type: gfonts
      family: "Open Sans"
    id: xxlarge_font
    size: 100
  - file:
      type: gfonts
      family: "Open Sans"
    id: xlarge_font
    size: 80
  - file:
      type: gfonts
      family: "Open Sans"
    id: large_font
    size: 60
  - file:
      type: gfonts
      family: "Open Sans"
    id: medium_font
    size: 40
  - file:
      type: gfonts
      family: "Open Sans"
    id: small_font
    size: 20


color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%
  - id: my_white
    red: 100%
    green: 100%
    blue: 100%


text_sensor:
  - platform: homeassistant
    id: media_artist
    entity_id: media_player.master_bedroom
    attribute: media_artist
    internal: true

  - platform: homeassistant
    id: media_title
    entity_id: media_player.master_bedroom
    attribute: media_title
    internal: true

  - platform: homeassistant
    id: media_image
    entity_id: media_player.master_bedroom
    attribute: entity_picture
    internal: true

  - platform: homeassistant
    id: media_state
    entity_id: media_player.master_bedroom
    internal: true
    on_value:
      - if:
          condition:
            text_sensor.state:
              id: media_state
              state: 'playing'
          then:
            - display.page.show: Music
          else:
            - display.page.show: Day


  - platform: homeassistant
    name: Readable_time
    entity_id: sensor.12h_time
    id: readable_ha_time

  - platform: homeassistant
    id: clock_mode
    entity_id: input_select.bedroom_clock_mode
    on_value:
      then:
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Night"
            then:
              - display.page.show: Night
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 25%
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Morning"
            then:
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 50%
        - if:
            condition:
              text_sensor.state:
                id: clock_mode
                state: "Day"
            then:
              - light.turn_on:
                  id: ${id_prefix}_backlight
                  transition_length: 0.1s
                  brightness: 75%

binary_sensor:
  - platform: touchscreen
    name: Skip
    id: skip_track
    internal: True
    x_min: 420
    x_max: 470
    y_min: 280
    y_max: 320
    filters:
      - delayed_on: 30ms
    on_press:
      - homeassistant.service:
          service: media_player.media_next_track
          data:
            entity_id: media_player.master_bedroom

I have a dropdown helper called “Bedroom clock mode”, which has options of: Day, Night, Morning.
These will make the screen to switch to another page where the clock is in red font and set the backlight brightness values depending on time of day. This is used by the automations in HA.

I could probably make this cleaner using a scene, but this works for now.
Automation actions for switching the screen out of night mode, but not turning up the backlight too much:

service: input_select.select_option
data:
  option: Morning
target:
  entity_id: input_select.bedroom_clock_mode

Automation actions for setting the brightness to 100% when the blinds are opened:

service: input_select.select_option
data:
  option: Day
target:
  entity_id: input_select.bedroom_clock_mode

Automation actions for dimming the clock and getting it to change to the page with the red font (aka “night mode” - when my wife turns her lamp off):

service: input_select.select_option
data:
  option: Night
target:
  entity_id: input_select.bedroom_clock_mode

Here’s the clock in normal daytime:

Here’s the clock when a song is playing on the speaker that it’s sitting on top of:

This is how it looks at night (unfortunately the phone tried to compensate for the dark, so it looks a lot brighter than it actually is):

And here it is when we wake up in the morning, but aren’t fully awake yet (again, looks brighter than it actually is):

Next steps from here would be to figure out if I can word wrap the song title, maybe show duration and current position (I’m already pulling those values but not using them yet), and getting a right-angled USB cable.

1 Like

Great work and wanted to jump in as well. I screwed up a bit by ordering the WT32-SC01 plus version which has a nicer display and frame. https://www.antratek.com/media/wysiwyg/pdf/WT32-SC01-Plus-V1.3-EN.pdf

What I didn’t notice is that it also uses the newer ESP32S3 chip, nice in itself but I cannot get it to compile and upload in ESPHOME. Tried downloading and uploading via low lever ESPFLASH tools but I end up in a boot loop… :woozy_face:

Well one step, got it working with this:

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

Touch and backlight work but apparently the ST7796 display is hard wired for 8 bit parallel interface (The IM0…IM2 pins)… anybody a clue how to proceed with this?

Thanks.

2 Likes

Has anyone tried the modbus capabilities of the panel yet? It has an rs485 connection. There is an esphome modbus component. Modbus works for me on another esp home device. it would be good to write out things, read values.

Hey, have you had any luck with this panel? I bought the same one and get the same results backlight works touch works and i have reset working but thats all. nothing displaying :expressionless:

No not yet, will require a updated driver since it is using a different communication protocol.

Dam! I’m going to get the WT-SCO1 and see how that one goes and use the Plus for something else.

checking in on this, any progress? Ideally I’d love to be able to use this with open wake word to make a local version of an echo show or google home

Using examples/code from this thread I was able to create a working configuration. You can check it on:

Thanks!

2 Likes

The documentation is fleshed out a lot better now. Touch Panel ESP32 | OXRS Docs

I have been usign a couple with node-red and home assistant for a couple of years now.

What about the plus version with parallel data? is that supported?

I am running my code on the older (non plus) version. I ordered a plus version. More info after I received/tested it. For the plus version there is an interesting development by strange-v: GitHub - strange-v/ha_deck: Config-driven Home Assistant dashboard (built on top of ESPHome)

1 Like

Thx for pointing me to this development. I will check if I can use it with the plus board

1 Like

hi many thanks for your job !
reading all this posts help me done something cool , for the moment only one page … but it’s work in progress

2 Likes