Added tap to wake and cycle feed

This commit is contained in:
2026-08-22 17:11:53 +02:00
parent 2b5004a569
commit 539df2182a
7 changed files with 610 additions and 52 deletions
+206
View File
@@ -0,0 +1,206 @@
# Waveshare ESP32-P4-WIFI6-Touch-LCD-4B — doorbell JPEG viewer (DRAFT)
# Square 720x720 IPS. Bring this up when the board arrives; the S3 yaml stays as-is.
#
# Touch cycles: stream A (default) -> stream B -> off -> stream A ...
#
# Notes:
# - ESPHome has a first-class 4C model (round 720x720), not 4B. Start with 4C;
# if the panel looks wrong, switch to CUSTOM + Waveshare ST7703 init.
# - Wi-Fi is via onboard ESP32-C6 (esp32_hosted). Use fast_connect.
# - fast_jpeg still works as software decode initially; HW JPEG is a follow-up.
substitutions:
name: doorbell-display-p4
friendly_name: Doorbell Display P4
stream_a_url: "http://10.0.1.195:8080/doorbell/?size=720"
stream_b_url: "http://10.0.1.195:8080/oprit/?size=720"
external_components:
- source:
type: local
path: components
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: "2026.2.0"
on_boot:
- priority: 600
then:
- lambda: |-
id(touch_state) = 0;
id(doorbell_jpg).set_url("${stream_a_url}");
id(doorbell_jpg).set_enabled(true);
- switch.turn_on: backlight_enable
- light.turn_on:
id: backlight
brightness: 100%
esp32:
board: esp32-p4-evboard
variant: esp32p4
flash_size: 32MB
framework:
type: esp-idf
advanced:
enable_idf_experimental_features: true
include_builtin_idf_components:
- esp_http_client
psram:
speed: 200MHz
logger:
hardware_uart: UART0
logs:
fast_jpeg: INFO
api:
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
fast_connect: true
esp32_hosted:
variant: ESP32C6
active_high: true
reset_pin: GPIO54
cmd_pin: GPIO19
clk_pin: GPIO18
d0_pin: GPIO14
d1_pin: GPIO15
d2_pin: GPIO16
d3_pin: GPIO17
esp_ldo:
- channel: 3
voltage: 2.5V
i2c:
sda: GPIO7
scl: GPIO8
frequency: 400kHz
scan: true
globals:
- id: touch_state
type: int
restore_value: false
initial_value: "0"
script:
- id: cycle_stream
mode: restart
then:
- lambda: |-
id(touch_state) = (id(touch_state) + 1) % 3;
- if:
condition:
lambda: "return id(touch_state) == 0;"
then:
- lambda: |-
id(doorbell_jpg).set_url("${stream_a_url}");
id(doorbell_jpg).set_enabled(true);
- switch.turn_on: backlight_enable
- light.turn_on:
id: backlight
brightness: 100%
- if:
condition:
lambda: "return id(touch_state) == 1;"
then:
- lambda: |-
id(doorbell_jpg).set_url("${stream_b_url}");
id(doorbell_jpg).set_enabled(true);
- switch.turn_on: backlight_enable
- light.turn_on:
id: backlight
brightness: 100%
- if:
condition:
lambda: "return id(touch_state) == 2;"
then:
- lambda: "id(doorbell_jpg).set_enabled(false);"
- light.turn_off: backlight
switch:
- platform: gpio
id: backlight_enable
name: "Backlight Enable"
pin: GPIO33
restore_mode: ALWAYS_ON
internal: true
- platform: template
name: "Screen"
id: screen_power
icon: mdi:monitor
lambda: |-
return id(backlight).current_values.is_on();
turn_on_action:
- lambda: |-
id(touch_state) = 0;
id(doorbell_jpg).set_url("${stream_a_url}");
id(doorbell_jpg).set_enabled(true);
- switch.turn_on: backlight_enable
- light.turn_on:
id: backlight
brightness: 100%
turn_off_action:
- lambda: |-
id(touch_state) = 2;
id(doorbell_jpg).set_enabled(false);
- light.turn_off: backlight
output:
- platform: ledc
id: backlight_pwm
pin: GPIO26
inverted: true
frequency: 1000Hz
light:
- platform: monochromatic
id: backlight
name: "Backlight"
output: backlight_pwm
restore_mode: ALWAYS_ON
default_transition_length: 0s
on_turn_on:
- switch.turn_on: backlight_enable
- lambda: |-
if (id(touch_state) != 2) {
id(doorbell_jpg).set_enabled(true);
}
on_turn_off:
- lambda: "id(doorbell_jpg).set_enabled(false);"
touchscreen:
- platform: gt911
id: touch
display: lcd
reset_pin: GPIO23
update_interval: 50ms
on_touch:
- script.execute: cycle_stream
display:
- platform: mipi_dsi
id: lcd
model: WAVESHARE-ESP32-P4-WIFI6-TOUCH-LCD-4C
dimensions: 720x720
reset_pin: GPIO27
color_order: RGB
auto_clear_enabled: false
update_interval: never
fast_jpeg:
id: doorbell_jpg
url: ${stream_a_url}
display_id: lcd
update_interval: 150ms
big_endian: false