esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

esp_camera stops working when display component is added #583

Closed TimSoethout closed 5 years ago

TimSoethout commented 5 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

hass custom install

ESP (ESP32/ESP8266, Board/Sonoff):

ESP32, TTGO T-Journal camera, esp32dev

Affected component:

https://esphome.io/components/esp32_camera.html https://esphome.io/components/display/index.html

Description of problem: I have a TTGO T-journal ESP32 camera. It works nicely, but when I add the display component the camera stops working. The display works fine. Verbose Logs show:

[21:06:49][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[21:06:49][V][app:078]: Components should block for at most 20-30ms in loop().
[21:06:49][V][app:079]: This will become a warning soon.

Problem-relevant YAML-configuration entries:

esphome:
  name: aquarium
  platform: ESP32
  board: esp32dev

debug:

wifi:
  ssid: "xxx"
  password: "xxx"

# Enable logging
logger:
  level: VERBOSE

# Enable Home Assistant API
api:

ota:

#camera
esp32_camera:
  external_clock:
    pin: GPIO27
    frequency: 20MHz
  i2c_pins:
    sda: GPIO25
    scl: GPIO23
  data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
  vsync_pin: GPIO22
  href_pin: GPIO26
  pixel_clock_pin: GPIO21
  resolution: 1024x768
  # resolution: 800x600
  vertical_flip: false
  jpeg_quality: 11
  # Image settings
  name: aquarium-cam
  test_pattern: true

#temparature sensor
dallas:
  - pin: GPIO2

sensor:
  - platform: dallas
    address: 0x03020A92452EC728
    id: aquarium
    name: "Aquarium Temperature"

# display 
i2c:
  sda: GPIO14
  scl: GPIO13

time:
  - platform: sntp
    id: time1
    servers:
      - 0.pool.ntp.org

font:
  - file: "OpenSans-Regular.ttf"
    id: font1
    size: 30

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    rotation: 270
    # SH1106 128x64
    reset_pin: GPIO15
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(font1), TextAlign::TOP_LEFT, "%.1f°C", id(aquarium).state);
      it.strftime(0, 40, id(font1), "%H:", id(time1).now());
      it.strftime(it.get_width(), 80, id(font1), TextAlign::TOP_RIGHT, " %M", id(time1).now());

Logs (if applicable):

INFO Successfully connected to aquarium.local
[20:58:10][I][app:096]: esphome version 1.13.6 compiled on Aug 14 2019, 20:57:33
[20:58:10][C][wifi:372]: WiFi:
[20:58:10][C][wifi:254]:   SSID: 'xxx'
[20:58:10][C][wifi:255]:   IP Address: 192.168.1.194
[20:58:10][C][wifi:257]:   BSSID: 98:DE:D0:5E:24:C0
[20:58:10][C][wifi:258]:   Hostname: 'aquarium'
[20:58:10][C][wifi:262]:   Signal strength: -45 dB ▂▄▆█
[20:58:10][C][wifi:263]:   Channel: 6
[20:58:10][C][wifi:264]:   Subnet: 255.255.255.0
[20:58:10][C][wifi:265]:   Gateway: 192.168.1.1
[20:58:10][C][wifi:266]:   DNS1: 192.168.1.1
[20:58:10][C][wifi:267]:   DNS2: 0.0.0.0
[20:58:10][C][i2c:028]: I2C Bus:
[20:58:10][C][i2c:029]:   SDA Pin: GPIO14
[20:58:10][C][i2c:030]:   SCL Pin: GPIO13
[20:58:10][C][i2c:031]:   Frequency: 50000 Hz
[20:58:10][I][i2c:033]: Scanning i2c bus for active devices...
[20:58:10][I][i2c:040]: Found i2c device at address 0x3C
[20:58:10][C][logger:137]: Logger:
[20:58:10][C][logger:138]:   Level: VERBOSE
[20:58:10][C][logger:139]:   Log Baud Rate: 115200
[20:58:10][C][logger:140]:   Hardware UART: UART0
[20:58:10][C][esp32_camera:043]: ESP32 Camera:
[20:58:10][C][esp32_camera:044]:   Name: aquarium-cam
[20:58:10][C][esp32_camera:045]:   Board Has PSRAM: NO
[20:58:10][C][esp32_camera:047]:   Data Pins: D0:17 D1:35 D2:34 D3:5 D4:39 D5:18 D6:36 D7:19
[20:58:10][C][esp32_camera:048]:   VSYNC Pin: 22
[20:58:10][C][esp32_camera:049]:   HREF Pin: 26
[20:58:10][C][esp32_camera:050]:   Pixel Clock Pin: 21
[20:58:10][C][esp32_camera:051]:   External Clock: Pin:27 Frequency:20000000
[20:58:10][C][esp32_camera:052]:   I2C Pins: SDA:25 SCL:23
[20:58:10][C][esp32_camera:053]:   Reset Pin: -1
[20:58:10][C][esp32_camera:080]:   Resolution: 1024x768 (XGA)
[20:58:10][C][esp32_camera:097]:   JPEG Quality: 11
[20:58:10][C][esp32_camera:099]:   Contrast: 0
[20:58:10][C][esp32_camera:100]:   Brightness: 0
[20:58:10][C][esp32_camera:101]:   Saturation: 0
[20:58:10][C][esp32_camera:102]:   Vertical Flip: OFF
[20:58:10][C][esp32_camera:103]:   Horizontal Mirror: ON
[20:58:10][C][esp32_camera:120]:   Test Pattern: NO
[20:58:10][V][api:542]: Hello from client: 'Home Assistant 0.97.2 (192.168.1.42)'
[20:58:10][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:10][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:10][V][app:079]: This will become a warning soon.
[20:58:10][C][dallas.sensor:070]: DallasComponent:
[20:58:10][C][dallas.sensor:071]:   Pin: GPIO2 (Mode: INPUT)
[20:58:10][C][dallas.sensor:072]:   Update Interval: 60.0s
[20:58:10][D][dallas.sensor:077]:   Found sensors:
[20:58:10][D][dallas.sensor:080]:     0x03020A92452EC728
[20:58:10][C][dallas.sensor:085]:   Device 'Aquarium Temperature'
[20:58:10][C][dallas.sensor:085]:     Unit of Measurement: '°C'
[20:58:10][C][dallas.sensor:085]:     Accuracy Decimals: 1
[20:58:10][C][dallas.sensor:085]:     Icon: 'mdi:thermometer'
[20:58:10][V][dallas.sensor:085]:     Unique ID: 'dallas-03020A92452EC728'
[20:58:10][C][dallas.sensor:093]:     Address: 0x03020A92452EC728
[20:58:10][C][dallas.sensor:094]:     Resolution: 12
[20:58:10][D][api:573]: Client 'Home Assistant 0.97.2 (192.168.1.42)' connected successfully!
[20:58:10][C][ssd1306_i2c:023]: I2C SSD1306
[20:58:10][C][ssd1306_i2c:023]:   Rotations: 270 °
[20:58:10][C][ssd1306_i2c:023]:   Dimensions: 64px x 128px
[20:58:10][C][ssd1306_i2c:024]:   Address: 0x3C
[20:58:10][C][ssd1306_i2c:025]:   Model: SSD1306 128x64
[20:58:10][C][ssd1306_i2c:026]:   Reset Pin: GPIO15 (Mode: OUTPUT)
[20:58:10][C][ssd1306_i2c:027]:   External VCC: NO
[20:58:10][C][ssd1306_i2c:028]:   Update Interval: 1.0s
[20:58:10][C][ota:029]: Over-The-Air Updates:
[20:58:10][C][ota:030]:   Address: aquarium.local:3232
[20:58:10][V][api:1191]: on_camera_image_request_ stream=NO single=YES
[20:58:10][C][api:103]: API Server:
[20:58:10][C][api:104]:   Address: aquarium.local:6053
[20:58:10][C][sntp:043]: SNTP Time:
[20:58:10][C][sntp:044]:   Server 1: '0.pool.ntp.org'
[20:58:10][C][sntp:045]:   Server 2: ''
[20:58:10][C][sntp:046]:   Server 3: ''
[20:58:10][C][sntp:047]:   Timezone: 'CET-1CEST-2,M3.5.0/2,M10.4.0/3'
[20:58:11][D][debug:023]: ESPHome version 1.13.6
[20:58:11][D][debug:025]: Free Heap Size: 101804 bytes
[20:58:11][D][debug:053]: Flash Chip: Size=4096kB Speed=40MHz Mode=DIO
[20:58:11][D][debug:086]: Chip: Model=ESP32, Features=WIFI_BGN,BLE,BT, Cores=2, Revision=1
[20:58:11][D][debug:088]: ESP-IDF Version: v3.3-beta1-179-ge931fe9f5-dirty
[20:58:11][D][debug:091]: EFuse MAC: 00001C8F2FC40A24
[20:58:11][D][debug:143]: Reset Reason: Software Reset CPU
[20:58:11][D][debug:186]: Wakeup Reason: Unknown
[20:58:11][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:11][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:11][V][app:079]: This will become a warning soon.
[20:58:12][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:12][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:12][V][app:079]: This will become a warning soon.
[20:58:13][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:13][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:13][V][app:079]: This will become a warning soon.
[20:58:14][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:14][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:14][V][app:079]: This will become a warning soon.
[20:58:15][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:15][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:15][V][app:079]: This will become a warning soon.
[20:58:16][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:16][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:16][V][app:079]: This will become a warning soon.
[20:58:17][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:17][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:17][V][app:079]: This will become a warning soon.
[20:58:18][V][app:077]: A component took a long time in a loop() cycle (0.2 s).
[20:58:18][V][app:078]: Components should block for at most 20-30ms in loop().
[20:58:18][V][app:079]: This will become a warning soon.
^C⏎                                                                                                                                                                                                        

Additional information and things you've tried:

TimSoethout commented 5 years ago

Without the camera and the sensor, the message still shows up. It might be caused by the display.

TimSoethout commented 5 years ago

Found it!

reset_pin: GPIO15 is the reset pin of the camera, but I had it configured in the display. Probably I copy-pasted it from some site...

Now it works!