Esp32-s3-touch-lcd-7 poprosze szanowne grono o pomoc

Mianowiccie na lcd mam miejsce które na nacisnieciu mialo sterowac przekaznikiem na d1mini . Niestety tego nie robi . Jedynie co dziala to podswietla jesli odpale z innego miejsca wiec stan widzi. Nie daje nazwijmy to polecenia do homa

substitutions:
  name: hadisplay
  friendly_name: "Home Assistant Display"
  device_description: "Smart Dashboard"

  lightbulb: "\U000F0335"
  ceiling_light: "\U000F0769"
  lamp: "\U000F06B5"
  floor_lamp: "\U000F08DD"
  string_lights: "\U000F12BA"
  clock: "\U000F0150"
  ceiling_fan: "\U000F1797"
  light_recessed: "\U000F179B"
  blinds_horizontal: "\U000F1A2B"
  blinds_horizontal_closed: "\U000F1A2C"
  curtains_closed: "\U000F1847"
  curtains: "\U000F1846"
  wallsconce: "\U000F091C"
  bed: "\U000F02E3"
  bed_empty: "\U000F08A0"
  thermometer_high: "\U000F10C2"
  humidity: "\U000F058E"
  wallsconce_variant: "\U000F091E"
  kiss: "\U000F0C73"
  hvac: "\U000F0D43"
  pump_icon: "\U000F058F"
  homeicon: "\U000F02DC"
  lefticon: "\U000F0141"
  righticon: "\U000F0142"
  grid: "\U000F0A72"

esphome:
  name: ${name}
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.esp-idf.memory_type: qio_opi
    board_build.flash_mode: dio
    board_upload.maximum_ram_size: 524288
    board_build.flash_size: 8MB

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 8MB
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
      CONFIG_ESP32S3_DATA_CACHE_64KB: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:
  level: DEBUG
  hardware_uart: UART0


# Enable Home Assistant API
api:
  encryption:
    key: "XXXXXXXXXXXXXXXXX"

ota:
  - platform: esphome
    password: "XXXXXXXXXXXXXXXX"

wifi:
  networks:
    - ssid: !secret wifi_ssid_dom
      password: !secret wifi_password_dom
    - ssid: !secret wifi_ssid_out
      password: !secret wifi_password
    - ssid: !secret wifi_ssid_piwnica
      password: !secret wifi_password_piwnica
    - ssid: !secret wifi_ssid_licznik
      password: !secret wifi_password_licznik
    - ssid: !secret wifi_ssid_in
      password: !secret wifi_password
  manual_ip:
  #   # Set this to the IP of the ESP
    static_ip: 192.168.1.XX
  #   # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.XX
  #   # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "HADisplay Fallback Hotspot"
    password: "XXXXXX"

web_server:
  port: 80

external_components:
  # - source: github://pr#7427
  #   components: [lvgl]

  # CH422G I/O Expander
  # https://github.com/esphome/esphome/pull/7356
  # - source: github://pr#7356
  #   components: [ch422g]

  # rpi_dpi_rgb
  # https://github.com/esphome/esphome/pull/7383
  - source: github://pr#7383
    components: [rpi_dpi_rgb]

  

time:
  - platform: homeassistant
    id: homeassistant_time

interval:
  - interval: 1s
    then:
      - lvgl.label.update:
          id: display_time
          text: !lambda |-
            static char time_buf[16];
            auto now = id(homeassistant_time).now();
            // Format 24-godzinny, więc godzina bez zmian
            snprintf(time_buf, sizeof(time_buf), "%02d:%02d", now.hour, now.minute);
            return std::string(time_buf);

      #      snprintf(time_buf, sizeof(time_buf), "%02d:%02d %s", hour_12, now.minute, is_pm ? "PM" : "AM");
      # - lvgl.label.update:
      #     id: display_time
      #     text: !lambda |-
      #       static char time_buf[17];
      #       auto now = id(sntp_time).now();            
      #       bool is_pm = now.hour >= 12;
      #       snprintf(time_buf, sizeof(time_buf), "%s");
      #       ESP_LOGI("time: %s", time_buf);
      #       return time_buf;

font:
  - file:
      type: gfonts
      family: Roboto
    id: roboto24
    size: 24
    bpp: 4
    extras:
      - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
        glyphs: [
            "\U000F004B",
            "\U000F006E",
            "\U000F012C",
            "\U000F179B",
            "\U000F0748",
            "\U000F1A1B",
            "\U000F02DC",
            "\U000F0A02",
            "\U000F035F",
            "\U000F0156",
            "\U000F0C5F",
            "\U000f0084",
            "\U000f0091",
            "\U000F058E",
            "\U000F10C3",
            "\U000F03F0", # mdi-percent
            "\U000F0504", # mdi- celcius
            "\U000F091E",
            "\U000F0140", # mdi-arrow_down
            "\U000F0141", # mdi-arrow_left
            "\U000F0142", # mdi-arrow_right
            "\U000F0143", # mdi-arrow_up
          ]
  - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
    id: weather70
    size: 70
    bpp: 4
    glyphs: &mdi-weather-glyphs
      - "\U000F0A72" # mdi-grid
      - "\U000F0590" # mdi-weather-cloudy
      - "\U000F0F2F" # mdi-weather-cloudy-alert
      - "\U000F0E6E" # mdi-weather-cloudy-arrow-right
      - "\U000F0591" # mdi-weather-fog
      - "\U000F0592" # mdi-weather-hail
      - "\U000F0F30" # mdi-weather-hazy
      - "\U000F0898" # mdi-weather-hurricane
      - "\U000F0593" # mdi-weather-lightning
      - "\U000F067E" # mdi-weather-lightning-rainy
      - "\U000F0594" # mdi-weather-clear-night
      - "\U000F0F31" # mdi-weather-night-partly-cloudy
      - "\U000F0595" # mdi-weather-partly-cloudy
      - "\U000F0F32" # mdi-weather-partly-lightning
      - "\U000F0F33" # mdi-weather-partly-rainy
      - "\U000F0F34" # mdi-weather-partly-snowy
      - "\U000F0F35" # mdi-weather-partly-snowy-rainy
      - "\U000F0596" # mdi-weather-pouring
      - "\U000F0597" # mdi-weather-rainy
      - "\U000F0598" # mdi-weather-snowy
      - "\U000F0F36" # mdi-weather-snowy-heavy
      - "\U000F067F" # mdi-weather-snowy-rainy
      - "\U000F0599" # mdi-weather-sunny
      - "\U000F0F37" # mdi-weather-sunny-alert
      - "\U000F14E4" # mdi-weather-sunny-off
      - "\U000F059A" # mdi-weather-sunset
      - "\U000F059B" # mdi-weather-sunset-down
      - "\U000F059C" # mdi-weather-sunset-up
      - "\U000F0F38" # mdi-weather-tornado
      - "\U000F059D" # mdi-weather-windy
      - "\U000F059E" # mdi-weather-windy-variant
      - "\U000F0E6D" # mdi-transmission-tower

  - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
    id: light32
    size: 32
    bpp: 4
    glyphs: [
        "\U000F0335", # mdi-lightbulb
        "\U000F0769", # mdi-ceiling-light
        "\U000F08DD", # mdi-floor-lamp
        "\U000F12BA", # mdi-string-lights
        "\U000F0150", # mdi-clock
        "\U000F1797", # mdi-ceiling_fan
        "\U000F179B", # mdi-light_recessed
        "\U000F1A2B", # mdi-blinds_horizontal
        "\U000F1A2C", # mdi-blinds_horizontal_closed
        "\U000F1847", # mdi-curtains_closed
        "\U000F1846", # mdi-curtains
        "\U000F091C", # mdi-wallsconce
        "\U000F02E3", # mdi-bed
        "\U000F08A0", # mdi-bed_empty
        "\U000F10C2", # mdi-thermometer_high
        "\U000F058E", # mdi-humidity
        "\U000F091E", # mdi-wallsconce_variant
        "\U000F0C73", # mdi-kiss
        "\U000F0D43", # mdi- hvac
        "\U000F058F", # mdi-water_pump
      ]

  - file: "gfonts://Roboto"
    id: roboto10
    size: 10
    bpp: 4

  - file: "gfonts://Roboto"
    id: roboto22
    size: 22
    bpp: 4

  - file: 
      type: gfonts
      family: Roboto
      weight: 900
    id: roboto90
    size: 180
    bpp: 4

  - file: 
      type: gfonts
      family: Roboto
      weight: 900
    id: roboto55bold
    bpp: 4
    size: 55

  - file: "gfonts://Roboto"
    id: roboto55
    size: 55
    extras:
      - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
        glyphs: [
            "\U000F004B",
            "\U000F006E",
            "\U000F012C",
            "\U000F179B",
            "\U000F0748",
            "\U000F1A1B",
            "\U000F02DC",
            "\U000F0A02",
            "\U000F035F",
            "\U000F0156",
            "\U000F0C5F",
            "\U000f0084",
            "\U000f0091",
            "\U000F058E",
            "\U000F10C3",
            "\U000F03F0", # mdi-percent
            "\U000F0504", # mdi- celcius
            "\U000F091E",
            "\U000F0140", # mdi-arrow_down
            "\U000F0141", # mdi-arrow_left
            "\U000F0142", # mdi-arrow_right
            "\U000F0143", # mdi-arrow_up
          ]

  - file: 
      type: gfonts
      family: Roboto
      weight: 900
    id: roboto40bold
    size: 40

  - file: "gfonts://Roboto"
    bpp: 4
    id: roboto40
    size: 40
    
  - file: 
      type: gfonts
      family: Roboto
      weight: 900
    id: roboto30bold
    bpp: 4
    size: 30

  - file: "gfonts://Roboto"
    id: roboto30
    bpp: 4
    size: 30

image:
  - file: "images/dashboard1.jpg"
    id: disp_bg
    resize: 800x480
    type: RGB565

i2c:
  - id: bus_a
    sda: GPIO8
    scl: GPIO9
    scan: true

ch422g:
  - id: io_ex
    # address: 0x24

# Toggles backlight of Waveshare ESP32-S3-Touch-LCD-4.3
switch:
  - platform: gpio
    id: backlight_switch
    name: "Backlight Toggle"
    pin: 
      ch422g: io_ex
      number: 2
      allow_other_uses: true
    # CH422G saves the last state internally, but gpio switch sets state as off except when using RESTORE_ modes
    restore_mode: ALWAYS_ON
  - platform: template
    id: przekaznik
    name: "przekaznik dom fotowoltaika 220v"
    optimistic: True
    restore_mode: RESTORE_DEFAULT_OFF

# deep_sleep:
#   run_duration:
#     default: 30s
#     touch_wakeup_reason: 30s
#   touch_wakeup: True
#   sleep_duration: 10min

touchscreen:
  platform: gt911
  # address: 0x5D
  id: my_touchscreen
  update_interval: 16ms
  interrupt_pin: 4
  reset_pin:
    ch422g: io_ex
    number: 1
  on_touch:
    - lambda: |- 
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );
  on_release:
    - if:
        condition: lvgl.is_paused
        then:
          - logger.log: "LVGL resuming"
          - lvgl.resume:
          - lvgl.widget.redraw:
          - switch.turn_on: backlight_switch

display:
  - platform: rpi_dpi_rgb
    id: my_display
    #rotation: 90
    auto_clear_enabled: false
    update_interval: never
    color_order: RGB
    pclk_frequency: 14MHz
    dimensions:
      width: 800
      height: 480
    de_pin:
      number: 5
    reset_pin:
      ch422g: io_ex
      number: 3
    enable_pin:
      ch422g: io_ex
      number: 2
      allow_other_uses: true
    hsync_pin:
      number: 46
      ignore_strapping_warning: true
    vsync_pin:
      number: 3
      ignore_strapping_warning: true
    pclk_pin: 7
    pclk_inverted: false
    hsync_back_porch: 10
    hsync_front_porch: 20
    hsync_pulse_width: 10
    vsync_back_porch: 10
    vsync_front_porch: 10
    vsync_pulse_width: 10
    data_pins:
      red:
        - 1 # R3
        - 2 # R4
        - 42 # R5
        - 41 # R6
        - 40 # R7
      green:
        - 39 # G2
        - 0 # G3
        - 45 # G4
        - 48 # G5
        - 47 # G6
        - 21 # G7
      blue:
        - 14 # B3
        - 38 # B4
        - 18 # B5
        - 17 # B6
        - 10 # B7

#-------------------------------------------
# Home Assistant Sensors
#-------------------------------------------
sensor:
  # temperatura zewnetrzna 
  - platform: homeassistant 
    id: temp
    entity_id: sensor.czujnik_naslonecznieniaa_i_temp_temperatura_zewnetrzna

  # moc paneli z fotowoltaiki
  - platform: homeassistant 
    id: inwenter_pv_power
    entity_id: sensor.inwenter_inveter_pv_charging_power
    on_value:
      - lvgl.label.update:
          id: inwenter_pv_power_label
          text:
            format: "Moc Paneli: %.0f W"
            args: [x]

  # moc  pobierana przez warsztat
  - platform: homeassistant
    id: inwenter_power_warsztat
    entity_id: sensor.pozostalosc_po_odjeciu
    on_value:
      - lvgl.label.update:
          id: inwenter_power_warsztat_label
          text:
            format: "Warsztat: %.0f W"
            args: [x]

   # temp zewnetrzna 
  - platform: homeassistant   
    entity_id: sensor.czujnik_naslonecznieniaa_i_temp_temperatura_zewnetrzna
    id: outdoor_temp
    on_value:
      - lvgl.label.update:
          id: weather_label
          text:
            format: "%.1f\u00B0C"
            args: [x]

  #moc pomierana przez dom
  - platform: homeassistant
    id: grid_power
    entity_id: sensor.zamel_lew_01_electricity_meter_power_active_phase_1
    on_value:
      - lvgl.label.update:
          id: power_dom_label
          text:
            format: "OffGrid Dom: %.0f W"
            args: [x]

  # moc pobierana przez dom elektrownia 
  - platform: homeassistant
    entity_id: sensor.elektrownia_moc_dom
    id: grid_power_dom
    on_value:
      - lvgl.label.update:
          id: grid_power_dom_label
          text:
            format: "Elektrownia: %.0f W"
            args: ["x"]

  # produkcja dzis
  - platform: homeassistant
    name: "Energy Today"
    id: energy_today
    entity_id: sensor.energy_production_today
    on_value:
      then:
        - lambda: |-
            char buffer[16];
            snprintf(buffer, sizeof(buffer), "Dzis: %.2f kWh", x);
            lv_label_set_text(id(robo22_label), buffer);

   # produkcja jutro       
  - platform: homeassistant
    name: "Energy Today"
    id: energy_tomarow
    entity_id: sensor.energy_production_tomorrow
    on_value:
      then:
        - lambda: |-
            char buffer[16];
            snprintf(buffer, sizeof(buffer), "Jutro: %.2f kWh", x);
            lv_label_set_text(id(robo22_label2), buffer);

  - platform: homeassistant
    entity_id: sensor.inwenter_inveter_battery_voltage
    id: pv_power
    on_value:
      - lvgl.label.update:
          id:  batery_voltage_text
          text:
            format: "%.2fV"
            args: ["x"]

  - platform: homeassistant
    entity_id: sensor.bms_state_off_charge_1_2
    id: max_pv_power
    on_value:
      - lvgl.label.update:
          id:  batery_text
          text:
            format: "%.1f%%"
            args: ["x"]

  - platform: homeassistant
    entity_id: sensor.inwenter_inveter_output_load_percent
    id: total_unit
    on_value:
      - lvgl.label.update:
          id:  total_unit_text
          text:
            format: "%.1f%%"
            args: ["x"]
  

  # - platform: homeassistant
  #   entity_id: sensor.solar_inverter_battery_capacity
  #   id: battery_capacity
  #   on_value:
  #     - lvgl.label.update:
  #         id: battery_capacity_text

  - platform: homeassistant
    entity_id: sensor.elektrownia_moc_dom
    id: pv_units_today
    on_value:
      - lvgl.label.update:
          id: grid_power_text
          text:
            format: "%.1fW"
            args: ["x"]

  - platform: homeassistant
    entity_id: sensor.zamel_mew_01_licznik_glowny_dom_total_forward_active_energy
    id: grid_sold
    on_value:
      - lvgl.label.update:
          id: pge_load_text
          text:
            format: "%.1fkWh"
            args: ["x"]

  - platform: homeassistant
    entity_id: sensor.zamel_lew_01_electricity_meter_power_active_phase_1
    id: grid_bought
    on_value:
      - lvgl.label.update:
          id: off_power_text
          text:
            format: "%.1fW"
            args: ["x"]

  - platform: homeassistant
    entity_id: sensor.zamel_lew_01_electricity_meter_total_forward_active_energy
    id: total_unit_consumed
    on_value:
      - lvgl.label.update:
          id: off_zuzycie_text
          text:
            format: "%.1fkWh"
            args: ["x"]
            

  - platform: wifi_signal
    name: "WiFi Signal"
    id: wifi_signal_db
    update_interval: 60s
    entity_category: diagnostic
    internal: true

  - platform: copy
    source_id: wifi_signal_db
    name: "WiFi Strength"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: diagnostic

text_sensor:
  - platform: template
    name: "Current Time"
    id: current_time
    lambda: |-
      static char time_buf[16];
      auto now = id(homeassistant_time).now();
      int hour_12 = now.hour % 12;
      if (hour_12 == 0) hour_12 = 12;
      snprintf(time_buf, sizeof(time_buf), "%02d:%02d", hour_12, now.minute);
      return {time_buf};
  - platform: wifi_info
    ip_address:
      name: "IP Address"
      entity_category: diagnostic
    ssid:
      name: "Connected SSID"
      entity_category: diagnostic
    mac_address:
      name: "Mac Address"
      entity_category: diagnostic
  

number:
  - platform: template
    name: LVGL Screen timeout
    optimistic: true
    id: display_timeout
    unit_of_measurement: "s"
    initial_value: 45
    restore_value: true
    min_value: 10
    max_value: 180
    step: 5
    mode: box

binary_sensor:
  # - platform: esp32_touch
  #   id: my_touchscreen
 
  - platform: homeassistant
    id: water_pump_switch
    entity_id: switch.przekaznik_dom_fotowoltaika_przekaznik_dom_fotowoltaika_220v
    publish_initial_state: true
    on_state:
      then:
        lvgl.widget.update:
          id: lv_button_solar
          state:
            checked: !lambda return x;

color:
  - id: text_color
    hex: FFFFFF
  - id: light_red
    hex: FF3340
  - id: red
    hex: FF0000
  - id: white
    hex: FFFFFF
  - id: light_blue
    hex: 009EFF
  - id: grey
    hex: 989898
  - id: light_green
    hex: A8F698
  - id: orange
    hex: CC5E14
  - id: green
    hex: 2CAE65
  - id: blue
    hex: 3792CB
  - id: dark_blue
    hex: 0000FF


#-------------------------------------------
# lvgl Buttons
#-------------------------------------------
lvgl:
  touchscreens:
    - touchscreen_id: my_touchscreen
#  on_idle:
#    timeout: !lambda "return (id(display_timeout).state * 1000);"
#    then:
#      - logger.log: "LVGL is idle"
#      - switch.turn_off: backlight_switch
#      - lvgl.pause:
  color_depth: 16
  disp_bg_image: disp_bg
  page_wrap: true
  bg_opa: TRANSP
  style_definitions:
    - id: style_line
      line_color: 0x0000FF
      line_width: 8
      line_rounded: true
    - id: date_style
      text_font: roboto24
      align: center
      text_color: 0x333333
      bg_opa: cover
      radius: 4
      pad_all: 2

    ####Header_Footer##########
    - id: header_footer
      bg_color: 0x1b1b1b
      bg_grad_color: 0x1b1b1b
      bg_grad_dir: VER
      bg_opa: COVER
      border_width: 0
      radius: 0
      pad_all: 0
      pad_row: 0
      pad_column: 0
      border_color: 0x0077b3
      text_color: 0xFFFFFF
      width: 100%
      height: 40
  theme:
    buttonmatrix:
      bg_opa: TRANSP
      text_color: 0xFFFFFF
      pad_all: 0
      items:
        bg_color: 0x1b1b1b
        bg_grad_color: 0x1b1b1b
        bg_grad_dir: VER
        bg_opa: COVER
        text_color: 0xFFFFFF
        text_font: roboto24
        pressed:
          bg_color: 0xFF6700
          bg_grad_color: 0xa6521b
        checked:
          bg_color: 0xFF6700
          bg_grad_color: 0x03324A
          text_color: 0x005580
    button:
      text_font: roboto24
      scroll_on_focus: true
      radius: 5
      width: 100
      height: 150
      pad_left: 10px
      pad_top: 10px
      pad_bottom: 10px
      pad_right: 10px
      shadow_width: 0
      bg_color: 0x000000
      border_width: 0
      text_color: text_color
      checked:
        bg_color: 0xCC5E14
        text_color: text_color
    obj:
      text_font: roboto24
      scroll_on_focus: true
      radius: 5
      width: 400
      height: 150
      pad_left: 10px
      pad_top: 10px
      pad_bottom: 10px
      pad_right: 10px
      shadow_width: 0
      bg_color: 0x000000
      border_width: 0
      text_color: text_color
  top_layer:
    widgets:
      - buttonmatrix:
          align: bottom_mid
          styles: header_footer
          pad_all: 0
          outline_width: 0
          id: top_layer
          items:
            styles: header_footer
          rows:
            - buttons:
                - id: page_prev
                  text: $lefticon
                  on_press:
                    then:
                      - lvgl.page.previous:
                          animation: OUT_RIGHT
                          time: 300ms
                - id: page_home
                  text: $homeicon
                  on_press:
                    then:
                      - lvgl.page.show: main_page
                - id: page_next
                  text: $righticon
                  on_press:
                    then:
                      - lvgl.page.next:
                          animation: OUT_LEFT
                          time: 300ms
#      - label:
#          text_font: roboto24
#          text: "- %"
#          id: humidity_text
#          align: top_right
#          x: -20
#          y: 7
#          text_color: 0xFFFFFF

#      - label:
#          text_font: roboto24
#          text: "-.-°C"
#          id: temp_text
#          align: top_left
#          x: 12
#          y: 7
#          text_color: 0xFFFFFF
  pages:
    - id: main_page
      layout:
        type: grid
        grid_row_align: CENTER
        grid_column_align: CENTER
        grid_rows: [230px, 50px, 50px, 50px, 50px]
        grid_columns: [600px, 200px]
        pad_row: 0px
        pad_column: 0px 
      width: 100%
      pad_all: 2
      widgets:
        # Zegar
        - obj:
            id: lv_clock_obj
            checkable: true
            grid_cell_row_pos: 0
            grid_cell_column_pos: 0
            width: 525
            height: 150
            bg_opa: 0   # przezroczyste tło
            widgets:
              - label:
                  text_font: roboto90
                  text: "00:00"
                  id: display_time
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              
        # Temperatura
        - obj:
            checkable: true
            id: lv_weather_obj
            grid_cell_row_pos: 0
            grid_cell_column_pos: 1
            bg_opa: 0
            widgets:
              - label:
                  text_font: roboto55
                  text: "--.-"
                  id: weather_label
                  text_align: CENTER
                  text_color: 0xCC5E14
                  y: -20
              - label:
                  text_font: roboto22
                  text: "Dzis:0.00 kWh"
                  id: robo22_label
                  text_align: CENTER
                  text_color: 0xFFFFFF
                  y: 60
              - label:
                  text_font: roboto22
                  text: "Jutro:0.00 kWh"
                  id: robo22_label2
                  text_align: CENTER
                  text_color: 0xFFFFFF
                  y: 90

        # Przycisk na dole prawej kolumny   
        - button:
            checkable: false
            bg_opa: 0 
            id: lv_button_solar
            border_width: 2
            border_color: white
            border_side: ['TOP', 'BOTTOM', 'LEFT', 'RIGHT']
            grid_cell_row_pos: 1
            grid_cell_column_pos: 1
            widgets:
              - label:
                  text_font: roboto22
                  align: center
                  text: "Solar"
                  id: label_awaryjna
            on_short_click:
              - lambda: |-
                  ESP_LOGI("lvgl_button", "Button Solar clicked");
              - homeassistant.service:
                  service: switch.toggle
                  data:
                    entity_id: switch.przekaznik_dom_fotowoltaika_przekaznik_dom_fotowoltaika_220v

        # Dodatkowe sensory tekstowe w main_page
        - label:
            id: inwenter_pv_power_label
            text: "Moc Paneli: ---"
            text_font: roboto22
            align: center
            grid_cell_row_pos: 1
            grid_cell_column_pos: 0
            text_color: 0xFFFFFF
            width: 600
            height: 60

        - label:
            id: inwenter_power_warsztat_label
            text: "Moc Warsztat: ---"
            text_font: roboto22
            align: center
            grid_cell_row_pos: 2
            grid_cell_column_pos: 0
            text_color: 0xFFFFFF
            width: 600
            height: 60

        - label:
            id: power_dom_label
            text: "Moc Dom: ---"
            text_font: roboto22
            align: center
            grid_cell_row_pos: 3
            grid_cell_column_pos: 0
            text_color: 0xFFFFFF
            width: 600
            height: 60

        - label:
            id: grid_power_dom_label
            text: "Elektrownia Dom: ---"
            text_font: roboto22
            align: center
            grid_cell_row_pos: 4
            grid_cell_column_pos: 0
            text_color: 0xFFFFFF
            width: 600
            height: 60

    - id: power_page
      layout:
        type: grid
        grid_row_align: CENTER
        grid_column_align: CENTER
        grid_rows: [150px, 150px]
        grid_columns: [175px, 175px, 175px, 175px]
        pad_row: 20px
        pad_column: 20px 
      width: 100%
      pad_all: 5
      widgets:
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 0
            grid_cell_column_pos: 0
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: pge_load_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "PGE - Dom"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 0
            grid_cell_column_pos: 1
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: grid_power_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "PGE - Moc"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 0
            grid_cell_column_pos: 2
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: off_power_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "Offgrid - Moc"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 0
            grid_cell_column_pos: 3
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: off_zuzycie_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "Off - Dom"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 1
            grid_cell_column_pos: 0
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: batery_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "Bateria"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 1
            grid_cell_column_pos: 1
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: batery_voltage_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "Bateria Napiecie"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 1
            grid_cell_column_pos: 2
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: grid_bought_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "---"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        - obj:
            bg_opa: 0 
            grid_cell_row_pos: 1
            grid_cell_column_pos: 3
            width: 175
            height: 150
            pad_left: 0px
            pad_top: 0px
            pad_bottom: 0px
            pad_right: 0px
            widgets:
              - label:
                  text_font: roboto30bold
                  text: "---"
                  id: total_unit_text
                  align: center
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
              - label:
                  text_font: roboto22
                  text: "Obciarzenie"
                  align: bottom_mid
                  text_align: 'CENTER'
                  text_color: 0xFFFFFF
        

czyli co konkretnie, kod jest długi więc może wskaż jakieś konkretne fragmenty, które nie działają (u mnie działa wszystko co chciałem, ale to za dużo roboty by analizować całość)

Witam . niestety sam nie wiem o co chodzi. ogólnie mam 4 sensory które pokazują mi stan mocy pobieranej oraz produkowanej i to działa super . Z tego miejsca należy się podziękowania za prawie gotowca . Wracając do moich wypocin. Mam buton który po naciśnięciu się najpierw podświetlał lecz nic nie robił . Coś tam nakombinowałem teraz sam nie wiem co i teraz jak z Choma wlecze przekaźnik który sterowany jest z d1mini w innym oczywiście miejscu to zapala się podświetlenie batona ale nie reagują na jego dotykanie aby robił to z poziomu lcd. w logach widać ze dotyk jest dotykany ." [I][lvgl_button:918]: Button Solar clicked"

 homeassistant.service:
                  service: switch.toggle
                  data:
                    entity_id: switch.przekaznik_dom_fotowoltaika_przekaznik_dom_fotowoltaika_220v

Czy service jest jeszcze obsługiwane przez HA?

Podświetlenie przycisku jest obsługiwane przez inny kawałek kodu niż wywołanie akcji w HA, będę miał czas wieczorem to pokażę na tym moim przykładowym kodzie o co chodzi.

Można znacznie skrócić czas kompilacji, jeśli wywalisz wszystkie fragmenty z YAMLa, których nie używasz (mam oczywiście na myśli zbędne czcionki i inne pierdoły, a nie o zasadniczy kod, przy okazji będzie to znacznie czytelniejsze).

# […]

binary_sensor:
# […]
# tu sporo innego kodu związanego z innymi sensorami
# […]
  - platform: homeassistant #ten sensor służy do wczytania stanów przycisków na podstawie realnego stanu urządzeń czyli encji w HA
    id: kitchen_light
    entity_id: light.kuchnia # encja w HA
    publish_initial_state: true
    on_state:
      then:
        lvgl.widget.update:
          id: lv_button_1 # to jest ID przycisku, oba muszą się zgadzać
          state:
            checked: !lambda return x;

lvgl:
# […]
# tu sporo innego kodu związanego z LVGL
# […]
        - button:
            checkable: true
            id: lv_button_1 # to jest ID przycisku, oba muszą się zgadzać
            grid_cell_row_pos: 0
            grid_cell_column_pos: 1
            widgets:
              - label:
                  text_font: light32
                  align: top_left
                  text: $lightbulb
                  id: lv_button_1_icon
              - label:
                  text_font: roboto22
                  align: bottom_mid
                  text: "Kuchnia"
                  long_mode: dot
            on_short_click:
              - homeassistant.service:
                  service: light.toggle # wywołany serwis musi pasować do encji
                  data:
                    entity_id: light.kuchnia #to jest encja światła  w HA

Aby w ogóle można było wykonać akcję w HA musisz na to zezwolić urządzeniu ESPHome w jego integracji

i jeszcze taka uwaga, bo się trochę pozmieniało ostatnio
dawniejsze

homeassistant.service

to teraz

homeassistant.action

a odnośnie właściwej usługi

to będziesz przełączał raczej jakiś switch

              - homeassistant.action:
                  action: switch.toggle # wywołany serwis musi pasować do encji
                  data:
                    entity_id: switch.d1mini #to jest encja tego przełącznika, nie mam czasu na szuakanie jak się faktycznie nazywa

Ok dzieki za wszystkie uwagi i pomoc .

Nie wiem do kogo piszesz ale chyba do @artpc
sprawdzić masz to co pokazałem na obrazku (bo to opcja domyślnie wyłączona)

w ogóle masz taką encję w HA? (jak na mój gust nazwa jest absurdalnie długa, w dodatku masz mnóstwo literówek jak przeglądałem nazwy encji, więc pozostaje mieć nadzieję że literówki są w HA, a tu skopiowałeś tylko nazwy z oryginalnymi błędami)

switch.przekaznik_dom_fotowoltaika_przekaznik_dom_fotowoltaika_220v

Wlasnie wlaczylem zezwolenie na wykonywanie akcji. Co do literowek to fakt jest chaos . Powoli to poprawiam ale im glebiej w las tym wiecej drzew.

Teraz zrozumiałem to pytanie - service jest nadal obsługiwane, ale należy zamienić to na action, bo nie wiem do kiedy będzie wsparcie starego nazewnictwa, a zwykle jest to pół roku od zmian (na swoim repo zrobiłem poprawki w YAMLu v.1.2)


Witam . Dziekuje bardzo za pomoc . Dziala . Faktycznie jeden wyraz a robi taki problem .