ESP32-S3 7inch Capacitive Touch Display Adjust brightness

My Waveshare display came yesterday, and I got the backlight dimming working. I forgot to take a picture before I put in the case I printed, but I think I can explain without it. I took one of the 2 pin cables that came with the display, bent the black pin just a bit so it would touch the pad noted in the OP’s picture and then soldered the pin to the pad. I then plugged the other end of the cable into the RS485 jack on the back of the display. You aren’t actually doing RS485, but this is how you get access to a GPIO pin. Plugged in this way, the GPIO you’ve just attached to is GPIO16. I ended up using that one because I didn’t see any world where I’d ever use the RS485 interface, and I still have the IC2 and sensor interfaces to use later if I want to. I then use this YAML to control things:

# Backlight
output:
  - platform: ledc
    pin: GPIO16
    id: backlight

light:
  - platform: monochromatic
    output: backlight
    name: backlight
    restore_mode: ALWAYS_ON

switch:
  - platform: template
    name: antiburn
    icon: mdi:television-shimmer
    optimistic: true
    entity_category: "config"
    turn_on_action:
      - logger.log: "Starting Antiburn"
      - if:
          condition: lvgl.is_paused
          then:
            - lvgl.resume:
            - lvgl.widget.redraw:
      - lvgl.pause:
          show_snow: true
    turn_off_action:
      - logger.log: "Stopping Antiburn"
      - if:
          condition: lvgl.is_paused
          then:
            - lvgl.resume:
            - lvgl.widget.redraw:

  - platform: gpio
    name: backlight switch
    pin: 
      ch422g: io_ex
      number: 2
    restore_mode: ALWAYS_ON
    internal: true

The output defines the control for the backlight. The light defines the dimmer that will get exposed in Home Assistant. There are two switch elements. One is anti burn (I got that from the ESPHome LVGL tips and tricks) that can be activated to have the display run a random pattern to prevent burn in (no, I don’t know if it’s actually an issue for this display). The other is an internal switch for the display backlight that MUST be present for the backlight to work at all. Since I can fully control the backlight from the light, I didn’t expose the switch to Home Assistant.

With this I can now write all the automations I want in Home Assistant. One will dim the screen as it gets darker in a room, one will turn the backlight off if there’s nobody in the room, and one will run the anti burn every hour but only if the backlight is off (i.e. nobody is in the room). Hourly is overkill, but I figure that’ll ensure it gets done at least a couple times a day.

As an aside, I tried to use this as a bluetooth proxy too. It would work for a while, but eventually the display would hang. I think trying to do Bluetooth and WiFi at the same time plus controlling the display was just too much. I might try tweaking the bluetooth proxy settings later, but for now I may just dedicate some existing ESP32’s I have to bluetooth proxy.

1 Like