Home Assistant Deck component (HA Deck)

It doesn’t seem to be related to the HA platform. Changing the screen seems to cause the issue in my setup:

I have a button “Licht” on my main screen. It’s should be checked, if any light is switched on.

        # C2: Button Licht
        - type: button
          position: 126, 216
          text: "Licht"
          icon: 󰝩
          enabled: return true;
          checked: |-
            return id(**licht_kontrolle**).state;
          on_click:
            lambda: |- 
                id(deck).switch_screen("$SCREEN_LICHT");

In my scenario, id(licht_kontrolle).state is true. The button “Licht” is checked.

After switching to another screen e.g. “Licht” and going back to the main screen, Button “Light” is unchecked. The state of licht_kontrolle has not been changed at all.

Updating the binary sensor id(licht_kontrolle) checks the button on the main screen again.

My feeling is, that the state of licht_kontrolle is lost after switching the screen and not reloaded.

  1. Enable web UI and add a template sensor
binary_sensor:
- platform: template
  id: test
  name: test
  lambda: return id(licht_kontrolle).state;
  1. Open the web UI, reproduce the bug performing screen change, or whatever is needed.
  2. Check the state of the test sensor

If the state doesn’t correlate with the current button state on the screen - it’s a bug in the component rendering. If the binary sensor changed its state but shouldn’t - I don’t know what is happening. Maybe check that you have enough free RAM.

Nice approach.
The test sensor is ok. It stays “on” after switching the screen, but the button gets unchecked.

|23:50:58|[D]|[homeassistant.binary_sensor:026]|'light.licht_wohnzimmer_z2m': Got state ON|
| --- | --- | --- | --- |
|23:50:58|[D]|[homeassistant.binary_sensor:026]|'binary_sensor.licht_kontrolle': Got state ON|
|23:50:58|[D]|[binary_sensor:036]|'licht_kontrolle': Sending state ON|
|23:50:58|[D]|[binary_sensor:036]|'test': Sending state ON|

I solved it:

        # C2: Button Licht
        - type: button
          position: 126, 216
          text: "Licht"
          icon: 󰝩
          toggle: true   #added
          enabled: return true;
          checked: |-
            return id(licht_kontrolle).state;
          on_turn_off: #added
            lambda: |- 
                id(deck).switch_screen("$SCREEN_LICHT");
          on_turn_on: # added
            lambda: |- 
                id(deck).switch_screen("$SCREEN_LICHT");
          # on_click:
          #  lambda: |- 
          #     id(deck).switch_screen("$SCREEN_LICHT");

toggle: true needs to be active, but the screen is crashing when “on_click” is used.
So I switched to on_turn_off: and on_turn_on:

Now ist works.

Hello,
you do a geat job. Thanks for this! How can i use only your display component? You are the only Guy who brings the WT32 SC01 PLus in ESPHome and it works perfect. I have also a WT32 SC01 without plus. i can work with this Display with the nativ LVGL who now supportet in ESPHome with extern component. But ESPHome work at the moment not with the display from the Plus Model, because the display driver ST7796UI MCU 8 Bit is not supported

You cannot use the display component only, as it isn’t the correct ESPHome display driver (it was created for ha_deck).

There is a PR in ESPHome with a working display component for the SC01 Plus: Implement i80 bus for ili9xxx displays by clydebarrow · Pull Request #6537 · esphome/esphome · GitHub
I used it in combination with LVGL LVGL implementation for ESPHome by clydebarrow · Pull Request #6363 · esphome/esphome · GitHub and it works pretty well.

If you use bare LVGL, you have to write more code than for HA Deck, because there is not implicit update triggered for changes of an entity.

Thanks Man! This is what i need.
I connected 2 sensors on this board and love to work with ESPHome.
Its pretty easy, but the grafik with the display component looks very oldscool. now i can use LVGL on the WT32 SC01 Plus.

thanks for your answer. i like your style. but for me its easier the work with the LVGL component to edit something in the config.

Can you share your config please? I have some problems with display dimensions.
My config is working without dispay dimension. but i see only the half display. the touch is working with the right size. when i fill in my config the dimensions. lvgl will crash

This should be the relevant part of my config:

external_components:
  - source: github://pr#6537
    components: [ io_bus, i80, spi, ili9xxx ]
  - source: github://esphome/esphome@dev
    components: [ lvgl ]

i80:
  - id: i80bus
    dc_pin:
      number: GPIO0
      ignore_strapping_warning: true
    wr_pin: GPIO47
    data_pins:
      - GPIO9
      - number: GPIO46
        ignore_strapping_warning: true
      - number: GPIO3
        ignore_strapping_warning: true
      - GPIO8
      - GPIO18
      - GPIO17
      - GPIO16
      - GPIO15

display:
  - platform: ili9xxx
    id: display0
    model: ST7796
    bus_type: i80
    reset_pin: GPIO4
    pixel_mode: 16bit
    color_order: bgr
    invert_colors: true
    dimensions:
      width: 480
      height: 320
    transform:
      swap_xy: true
    auto_clear_enabled: false
    update_interval: never

touchscreen:
  - platform: ft63x6
    id: touch
    interrupt_pin: GPIO7
    transform:
      swap_xy: true
      mirror_x: true
    on_release:
      - if:
          condition: lvgl.is_paused
          then:
            - lvgl.resume:
            - lvgl.widget.redraw:
            - light.turn_on: display_backlight

output:
  - platform: ledc
    id: backlight_pwm
    pin:
      number: GPIO45
      ignore_strapping_warning: true

light:
  - platform: monochromatic
    id: display_backlight
    output: backlight_pwm
    restore_mode: ALWAYS_ON
    name: display_backlight

lvgl:
  id: lvgl0
  log_level: WARN
  color_depth: 16
  bg_color: 0x000000
  text_font: roboto_8
  align: center
  touchscreens:
    - touchscreen_id: touch
  widgets:
    - obj:
        id: obj_office
        x: 0
        y: 20
        width: 220
        height: 300
        widgets:
          - label:
              text: "Office"

Does anyone know how to enable PSRAM for the WT32-SC01 PLUS?

psram:
  mode: quad
  speed: 80MHZ