Features Wishlist

display off switch for waveshare board 4b und 7

patrickkramer1982-hashSuggested this wish Β·

hi max

I finally found the root cause of the 0% standby flickering on the Waveshare ESP32-S3-Touch-LCD-4B (and a working fix you can already use right now)!

Root Cause

In the resolved ESPHome config generated by Tessera, gpio_backlight_pwm does indeed have zero_means_zero: true and min_power: 0.52, but the set_backlight script always calls turn_on() even when level == 0:

id(back_light).turn_on().set_transition_length(ms).set_brightness(level / 100.0f).perform();

In ESPHome's monochromatic light, calling turn_on().set_brightness(0.0f) does not turn the light off β€” it keeps the light state ON at its minimum power floor (min_power: 0.52), which sits right on the edge of the LED driver's threshold and causes the dark flickering/pulsing everyone here is seeing.

When light.turn_off is called instead, zero_means_zero: true actually takes effect and the backlight shuts off completely with zero flicker.

Suggested Native Fix for Tessera (set_backlight)

In set_backlight, calling turn_off() when level <= 0 should fix this natively for all 4B users:

if (level <= 0) {
  id(back_light).turn_off().set_transition_length(ms).perform();
} else {
  id(back_light).turn_on().set_transition_length(ms).set_brightness(level / 100.0f).perform();
}

Working Workaround Right Now (<device>.local.yaml)

Until this is fixed natively, you can add a template switch in your screen's <device>.local.yaml (override YAML) and re-flash via OTA. I tested this on my waveshare4b and the backlight turns 100% off with no flicker:

switch:
  - platform: template
    name: "Display"
    id: display_power_switch
    icon: "mdi:monitor"
    optimistic: true
    restore_mode: ALWAYS_ON
    turn_on_action:
      - light.turn_on:
          id: back_light
          brightness: !lambda "return id(setting_brightness).state / 100.0f;"
      - script.execute: wake_display
    turn_off_action:
      - light.turn_off:
          id: back_light
          transition_length: 200ms

This exposes a switch.<device>_display entity in Home Assistant, which makes it super easy to turn the screen off via a timeout or a presence sensor, and wake it back up via presence or touch/motion.

(Bonus note for Waveshare 7" (waveshare7) users: the same <device>.local.yaml switch pattern works there too by using output.turn_on: backlight_line and output.turn_off: backlight_line to toggle CH422G EXIO2 cleanly.)

Discussion 0

Add a comment

Start the conversation

Share an example, ask a question or explain how you would use this.

Add your thoughts, a screenshot or a useful link.

Markdown & basic HTML
Paste or drop images Β· URLs on their own line become previews0 / 10,000
Create your account to join in

We need a verified email address to reach you about your contribution. Your address stays private.

Continue with GitHub

Your draft stays in this tab. Return here after verification.