clydebarrow / esphome

ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
https://esphome.io/
Other
16 stars 11 forks source link

VNC: host binary crashes on client disconnect #93

Open nagyrobi opened 3 months ago

nagyrobi commented 3 months ago

I run ESPHome in host mode like this:

#!/bin/bash
esphome compile config/_02_host_VNC_only.yaml
if [ $? -eq 0 ]; then
  echo "Compile successful, running..."
  ./config/.esphome/build/esp32-test-vnc-host/.pioenvs/esp32-test-vnc-host/program
else
  echo "Compile failed"
fi

Runs fine and I can connect with a VNC client (TightVNC client v2.8.81, Windows). When I exit the client (close client's window with X) I see the host binary of ESPHome also terminating on the server, Not consistent, but happens in 95% of the cases. When it doesn't crash, I can't connect the second time with the client anymore. I can quit the application by pressing Ctrl+C in the console. It also seems to depend on the time, eg. quitting the client after longer sessions always crash the binary, short sessions not always.

Config to reproduce:

substitutions:
  device_name: esp32-test-vnc-host
  friendly_name: "VNC test host"
  device_description: "LVGL host VNC only"

external_components:
  - source: github://clydebarrow/esphome@remote_display
    refresh: 1min
    components: [ vnc ]

esphome:
  friendly_name: "${friendly_name}"
  name: ${device_name}
  comment: "${device_description}"
  platformio_options:
    build_unflags: -Werror=all

host:
  mac_address: "xx:xx:xx:xx:xx:xx"

logger:
  level: DEBUG

api:
  reboot_timeout: 0min

button:
  - platform: restart
    name: ${friendly_name} restart
  - platform: factory_reset
    name: ${friendly_name} factory reset

binary_sensor:
  - platform: status
    name: ${friendly_name} connected

touchscreen:
  - platform: vnc
    id: vnc_touch
    display: vnc_display

sensor:
  - platform: uptime
    name: ${friendly_name} uptime
    disabled_by_default: false

display:
  - platform: vnc
    id: vnc_display
    update_interval: 1s
    auto_clear_enabled: true
    dimensions:
      width: 720 
      height: 320 
    pages:
      - id: page1
        lambda: |-
          it.fill(COLOR_ON);
          it.print(0, 10, id(my_font), COLOR_OFF, "Hello World!", COLOR_ON);

font:
  - file: "gfonts://Roboto"
    id: my_font
    bpp: 4
    size: 24