I’ve got a CYD display. When I set it up to report temperature overnight to homeassistant (so nothing that needs the display on), and configured the display background LED to turn off after a minute of inactivity, and then came back the next morning, I’ve noticed that the QR code of the LVGL hello world screen was still somewhat visible, i.e. seemed to be burnt in. This went away after a while but it made me realize that apparently the display needs to be turned off (See “8.2.18. Display OFF (28h)” in data sheet), BESIDES the background light to be turned off. So
What works for me is using a binary sensor to turn on the screen when touched, and automatically turn it off after a set amount of time (20s):
#Example configuration entry - Binary Sensor for Touch Detection
binary_sensor:
- platform: touchscreen
name: touch_pltscreen
publish_initial_state: True
entity_category: CONFIG
x_min: 10
x_max: 380 # Reduced for better reliability - experiment with values
y_min: 40
y_max: 290 # Reduced for better reliability - experiment with values
on_press:
then:
- logger.log: "Touchscreen has been pressed, turning it ON (binary sensor)"
- output.turn_on: backlight
- delay: 20s
- logger.log: "Timer of 20s has ended, turning the Touchscreen OFF (binary sensor)"
- output.turn_off: backlight
output:
- platform: gpio
pin: GPIO12
id: backlight
## Allow HA to see and controll the Backlight of the Touchscreen, it might come in handy for automations.
## Note that even when toggled from HA, it WILL NOT turn off again after the counter
light:
- platform: binary
output: backlight
name: "TFT Backlight"
restore_mode: ALWAYS_OFF