Skip to content

ESP-P4-Eth Camera not being integrated #15430

Description

@ama-0431

The problem

Hi, I have an Waveshare ESP-P4-Eth since about 3 months and started slowly working on getting it to work.
Sadly as I got to the part which I wanted the most to integrate into HomeAssistant, it didn't work.

I want to use my Raspberry Pi cam (B) which came in the set.
Can anyone help with this or is there already a fix?

Which version of ESPHome has the issue?

2026.3.2

What type of installation are you using?

Home Assistant Add-on

What platform are you using?

ESP32

Component causing the issue

No response

YAML Config

substitutions:
  device_description: "ESP32-P4-Eth 10.1 Smart screen"
  project_name: "WaveShare.ESP32_P4_10.1"
  project_version: "1.0.1"

  lightbulb: "\U000F0335"
  ceiling_light: "\U000F0769"
  lamp: "\U000F06B5"
  floor_lamp: "\U000F08DD"
  string_lights: "\U000F12BA"

esphome:
  name: esp32-p4
  friendly_name: Waveshare ESP32-P4 Eth
  on_boot:
    - priority: -200
      then:
        - delay: 200ms
        - audio_dac.set_volume:
            id: es8311_dac
            volume: 85%
        - lvgl.slider.update:
            id: dimmer_slider
            value: !lambda |-
              return (int)(id(backlight).current_values.get_brightness() * 255);
    - priority: 850
      then:
        - logger.log: Initializing display backlight
        - lambda: |-
            id(display_backlight_i2c).write_byte(0x95, 0x11);
            id(display_backlight_i2c).write_byte(0x95, 0x17);

esp32:
  board: esp32-p4-evboard
  variant: esp32p4
  flash_size: 16MB
  cpu_frequency: 360MHZ
  framework:
    type: esp-idf
    advanced:
      enable_idf_experimental_features: yes
    sdkconfig_options:
      CONFIG_CAMERA_OV5647: y
#    sdkconfig_options:
#      CONFIG_CAMERA_CTRL_ISP_DVP_CAM_SUPPORTED: y
#      CONFIG_CAMERA_CTRL_ISP_CSI_CAM_SUPPORTED: y

# needed for mipi_dsi
psram:
  mode: hex
  speed: 200MHZ

external_components:
  - source: github://pr#7639
    components: [camera, camera_encoder, camera_pipeline, camera_sensor, esp32_camera]
    refresh: 1h
  # For the backlight
  - source: github://pr#9879
    components: [mipi_dsi]
    refresh: 1h

# Enable logging
logger:
  level: DEBUG
  hardware_uart: UART0

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

ota:
  - platform: esphome
    password: ""
# Example configuration entry
web_server: 
  port: 80

ethernet:
  type: IP101
  mdc_pin: GPIO31
  mdio_pin: GPIO52
  power_pin: GPIO51
  clk: 
    mode: CLK_EXT_IN
    pin: GPIO50
  phy_addr: 1
  # Optional manual IP
#  manual_ip:
#    static_ip: 192.168.3.187
#    gateway: 192.168.3.1
#    subnet: 255.255.255.0

time:
  - platform: homeassistant
    id: time_comp
    on_time_sync:
      - script.execute: time_update
    on_time:
      - minutes: '*'
        seconds: 0
        then:
          - script.execute: time_update

script:
  - id: time_update
    then:
      - lvgl.indicator.update:
          id: minute_hand
          value: !lambda |-
            return id(time_comp).now().minute;
      - lvgl.indicator.update:
          id: hour_hand
          value: !lambda |-
            auto now = id(time_comp).now();
            return std::fmod(now.hour, 12) * 60 + now.minute;
      - lvgl.label.update:
          id: date_label
          text: !lambda |-
            static const char * const mon_names[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
            static char date_buf[8];
            auto now = id(time_comp).now();
            snprintf(date_buf, sizeof(date_buf), "%s %2d", mon_names[now.month-1], now.day_of_month);
            return date_buf;
      - lvgl.label.update:
          id: day_label
          text: !lambda |-
            static const char * const day_names[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
            return day_names[id(time_comp).now().day_of_week - 1];  

esp_ldo:
  - channel: 3
    id: display_supply_ldo
    voltage: 2.5V

# Needed for gt911 touchscreen
i2c:
  sda: GPIO7
  scl: GPIO8
  frequency: 400kHz
  scan: True

i2c_device:
  - address: 0x45
    id: display_backlight_i2c

number:
  - platform: camera_sensor
    type: isp
    brightness:
      name: Brightness
    hue:
      name: Hue
    contrast:
      name: Contrast
    saturation:
      name: Saturation
    filter:
      name: Filter
    red:
      name: Red
    green:
      name: Green
    blue:
      name: Blue

camera:
    name: Camera

camera_sensor:
  type: mipi_csi
  mode: "MIPI_2lane_24Minput_RAW8_800x640_50fps"

camera_pipeline:
  - id: input
    type: input
    next: encode

  - id: encode
    type: output
    camera_encoder_id: jpeg_encoder

camera_encoder:
  id: jpeg_encoder
  type: accelerated_jpeg

esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot

audio_dac:
  - platform: es8311
    id: es8311_dac
    bits_per_sample: 16bit
    address: 0x18
    sample_rate: 16000
    use_mclk: True
    use_microphone: False
    mic_gain: 42DB

text_sensor:
  - platform: ethernet_info
    ip_address:
      name: "IP Address"
      id: ip_address
      entity_category: diagnostic
      on_value: 
        then:
          - lvgl.label.update:
              id: ip_address_label
              text:
                format: "%s"
                args: [ 'id(ip_address).get_state().c_str()' ]
      address_0:
        name: device IP Address 0
      address_1:
        name: device IP Address 1
      address_2:
        name: device IP Address 2
      address_3:
        name: device IP Address 3
      address_4:
        name: device IP Address 4
    mac_address:
      name: device Mac Ethernet Address
    dns_address:
      name: device DNS Address     
  - platform: homeassistant
    id: light_e2_6_state
    entity_id: light.e2_6
    on_value:
      then:
        - lvgl.widget.update:
            id: lv_button_1
            state:
              checked: !lambda 'return x == "off";'           
            
# needs github://pr#9879 until merged to main
light:
  - platform: mipi_dsi
    id: backlight
    pwm_register: 0x96
    restore_mode: RESTORE_DEFAULT_ON    

display:
  - platform: mipi_dsi
    id: tenone_display
    model: WAVESHARE-P4-NANO-10.1
    rotation: 270
    show_test_card: true
#    update_interval: never


touchscreen:
  - platform: gt911
    id: tenone_touchscreen
    transform:
      swap_xy: true
      mirror_y: false
      mirror_x: true
    on_touch:
      - logger.log:
          format: Touch at (%d, %d)
          args: [touch.x, touch.y]
      - lambda: |-
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );
lvgl:
  displays:
    - tenone_display
    #on_idle:
    #  - timeout: 30s
    #    then:
    #      - logger.log: idle timeout
    #      - if:
    #          condition:
    #            lvgl.is_idle:
    #              timeout: 5s
    #          then:
    #            - logger.log: LVGL is idle
    #  - timeout: 35s
    #    then:
    #      - logger.log: idle 15s timeout
    #      - light.turn_off: 
    #          id: backlight
    #          transition_length: 5s
    #      - lvgl.pause:
    #          show_snow: true      
  color_depth: 16
  buffer_size: 100%
  byte_order: little_endian
  style_definitions:
    - id: style_line
      line_color: 0x0000FF
      line_width: 8
      line_rounded: true
    - id: date_style
      align: center
      text_color: 0x333333
      bg_opa: cover
      radius: 4
      pad_all: 2
  pages:
    - id: main_page
      skip: false
      layout:
        type: flex
        flex_flow: column_wrap
      width: 100%
      bg_color: 0x000000
      bg_opa: cover
      pad_all: 5
      widgets:
        - button:
            height: 120
            checkable: true
            id: lv_button_1
            widgets:
              - label:
                  align: top_left
                  text: $lightbulb
                  id: lv_button_1_icon
              - label:
                  align: bottom_left
                  text: "Light E2.6"
                  long_mode: dot
            on_value:
              - if:
                  condition:
                    lambda: 'return x;'
                  then:
                    - homeassistant.service:
                        service: light.turn_off
                        data:
                          entity_id: light.e2_6
                  else:
                    - homeassistant.service:
                        service: light.turn_on
                        data:
                          entity_id: light.e2_6
                        data_template:
                          color_temp_kelvin: "3000"
                          brightness_pct: "100"
        - obj:
            widgets:
            - label:
                id: ip_address_label
                align: CENTER
                text: 'Not connected'
                text_color: ha_blue
                y: +10
        - obj:
            width: 240
            widgets:
            - label:
                align: CENTER
                text: 'backlight'
                text_color: ha_blue
                y: +10              
            - slider:
                id: dimmer_slider
                min_value: 50
                max_value: 255
                value: 255
                on_value:
                  - light.turn_on: 
                      id: backlight
                      brightness: !lambda return x / 255.0;
        - obj:
            width: 230
            height: 230
            widgets:
            - meter:
                height: 200
                width: 200
                align: center
                #widgets:
                    
                        
                bg_opa: TRANSP
                text_color: 0xFFFFFF
                scales:
                  - ticks:
                      width: 1
                      count: 61
                      length: 10
                      color: 0xFFFFFF
                    range_from: 0
                    range_to: 60
                    angle_range: 360
                    rotation: 270
                    indicators:
                      - line:
                          id: minute_hand
                          value: !lambda |-
                            return id(time_comp).now().minute;
                          width: 3
                          color: 0xE0E0E0
                          r_mod: -1

                  - 
                    angle_range: 330
                    rotation: 300
                    range_from: 1
                    range_to: 12
                    ticks:
                      width: 1
                      count: 12
                      length: 1
                      major:
                        stride: 1
                        width: 4
                        length: 8
                        color: 0xC0C0C0
                        label_gap: 6

                  - angle_range: 360
                    rotation: 270
                    range_from: 0
                    range_to: 720
                    indicators:
                      - line:
                          id: hour_hand
                          value: !lambda |-
                            auto now = id(time_comp).now();
                            return std::fmod(now.hour, 12) * 60 + now.minute;
                          width: 4
                          color: 0xA0A0A0
                          r_mod: -20               
            - label:
                styles: date_style
                id: day_label
                #y: -20
                text: !lambda |-
                  static const char * const day_names[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
                  return day_names[id(time_comp).now().day_of_week-1];
            - label:
                styles: date_style
                id: date_label
                #y: +20
                text: !lambda |-
                  static const char * const mon_names[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
                  static char date_buf[8];
                  auto now = id(time_comp).now();
                  snprintf(date_buf, sizeof(date_buf), "%s %2d", mon_names[now.month-1], now.day_of_month);
                  return date_buf;
    - id: etusivu
      widgets:
        - obj:
            x: 30
            y: 350
            width: 450
            height: 200
            bg_color: 0x000000
            border_width: 2    

color:
  - id: ha_blue
    hex: 51c0f2

Anything in the logs that might be useful for us?

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions