RemoteWebViewClient icon indicating copy to clipboard operation
RemoteWebViewClient copied to clipboard

Booting screen for first time is always white screen / Sometime frees when i change HA Dashboard.

Open mikeo999 opened this issue 8 months ago • 4 comments

When i disconnect the power and put back power to the screen with USB it always boot to a white screen. I disconnect the usb again and put it back in and the booting is fine and starts HA screen.

I also notice when i edit the dashboard in HA and do this a while the result is always that at a moment the screen is frozen and i have to disconnect the usb cable the get it back a live. I looks like it is random.

Are the any tips for these problems.

Screen: [GUITION 4” 480x480 ESP32-S3-4848S040] Running the add on Home Assistant with a Rasp 4-64 / 4Gb

ESPhome code

esphome:
  name: esp32-4848s040-t1
  friendly_name: LCD_1
  platformio_options:
    board_build.flash_mode: dio
  on_boot:
    priority: -100
    then:
      - script.execute: inactivity_timer

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
    sdkconfig_options:
      COMPILER_OPTIMIZATION_SIZE: y
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y
    components:
      - name: "espressif/esp_websocket_client"
        ref: 1.5.0
      - name: "bitbank2/jpegdec"
        source: https://github.com/strange-v/jpegdec-esphome
psram:
  mode: octal
  speed: 80MHz

external_components:
  - source: github://strange-v/RemoteWebViewClient@main
    refresh: 0s
    components: [ remote_webview ]

logger:
  hardware_uart: UART0

api:
  encryption:
    key: "mykey"

ota:
  - platform: esphome
    password: "mypass"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    ssid: "Esp32-4848S040-T1"
    password: "XXXXXXXXXXXXXXXXXXX"

captive_portal:
    
spi:
  clk_pin: GPIO48
  mosi_pin: GPIO47

i2c:
  - id: bus_a
    sda: GPIO19
    scl: GPIO45

display:
  - platform: st7701s
    show_test_card: False
    update_interval: never
    auto_clear_enabled: False
    spi_mode: MODE3
    data_rate: 2MHz
    color_order: RGB
    invert_colors: False
    dimensions:
      width: 480
      height: 480
    cs_pin: 39
    de_pin: 18
    hsync_pin: 16
    vsync_pin: 17
    pclk_pin: 21
    pclk_frequency: 12MHz
    pclk_inverted: False
    hsync_pulse_width: 8
    hsync_front_porch: 10
    hsync_back_porch: 20
    vsync_pulse_width: 8
    vsync_front_porch: 10
    vsync_back_porch: 10
    init_sequence:
      - 1
      - [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10]
      - [0xCD, 0x00]
    data_pins:
      red:
        - GPIO11
        - GPIO12
        - GPIO13
        - GPIO14
        - GPIO0
      green:
        - GPIO8
        - GPIO20
        - GPIO3
        - GPIO46
        - GPIO9
        - GPIO10
      blue:
        - GPIO4
        - GPIO5
        - GPIO6
        - GPIO7
        - GPIO15

touchscreen:
  platform: gt911
  transform:
    mirror_x: false
    mirror_y: false
  on_touch:
    then:
      - script.execute: inactivity_timer

output:
  - platform: ledc
    pin: GPIO38
    id: backlight_pwm

light:
  - platform: monochromatic
    output: backlight_pwm
    name: "Display Backlight"
    id: back_light
    restore_mode: ALWAYS_ON

remote_webview:
  id: rwv
  server: myip:myport
  url: http://ipha:port/lovelace/0
  full_frame_tile_count: 1
  max_bytes_per_msg: 61440
  jpeg_quality: 85

text:
  - platform: template
    id: rwv_url
    name: "URL"
    optimistic: true
    restore_value: false
    mode: TEXT
    min_length: 1
    set_action:
      - lambda: |-
          if (!id(rwv).open_url(std::string(x.c_str()))) {
            id(rwv).set_url(std::string(x.c_str()));
            ESP_LOGI("remote_webview", "URL queued (not connected): %s", x.c_str());
          }

script:
  - id: inactivity_timer
    mode: restart
    then:
      - if:
          condition:
            light.is_off: back_light
          then:
            - light.turn_on:
                id: back_light
            - delay: 0.5s
            - lambda: |-
                id(rwv).disable_touch(false);
      - delay: 50s
      - light.turn_off:
          id: back_light
      - lambda: |-
          id(rwv).disable_touch(true);

mikeo999 avatar Mar 08 '26 12:03 mikeo999

I am also having this issue. In my own forks of the Client and Server I have not been able to resolve this on the Server side yet, but I think I have a way on the Client side on how to deal with this and refresh the page basically.

I think what is happening is this:

  • The Chromium server kills the unopen Tab after X duration of inactivity
  • When you turn your ESP32 Guition screen back on, it seems to open the Tab.
  • The server first opens the Tab as a blank "about:blank" page, which is just a white screen
  • The server is meant to refresh that to the URL you set in the Client, but for some reason it does not reliably do this most of the time the Tab is recreated (my speculation is this part here).
  • When you disconnect the USB and plug it back in immediately, the inactivity duration is not long enough for the Tab to be killed on the server
  • So when you plug it in, the Tab gets refreshed to the URL you set in the client and it all just works

The way I have worked around this (bad solution, I am hoping strange-v has a better one. Is to wait 30 seconds from the Boot to see if the Current URL on the display got set to the correct one on the Server side, and if it hadn't, then attempt to set it again. I am still testing this and not sure if it works 100% yet, only started testing this bug yesterday.

https://github.com/SleepinDevil/RemoteWebViewServer https://github.com/SleepinDevil/RemoteWebViewClient

These are my forks, I am also experimenting with adding an On Screen Keyboard, and an "on_frame_update" event on the Client.

SleepinDevil avatar Mar 09 '26 02:03 SleepinDevil

Sometimes I experience the same issue, but not always. I'll dig deeper when I have some free time.

strange-v avatar Mar 13 '26 06:03 strange-v

Thanks for all the work guys, I really love the project. I am facing this issue as well.

LeoLTM avatar May 04 '26 22:05 LeoLTM

Should be fixed in the release 1.3.0.

strange-v avatar Oct 10 '26 15:10 strange-v