esphome / issues

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

TTGO t-camera ESP32 WROVER - web/api/ota stops working after enabling esp32_ble_tracker #1660

Closed PiotrPolewczak closed 3 years ago

PiotrPolewczak commented 3 years ago

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

ESP (ESP32/ESP8266, Board/Sonoff): TTGO t-camera ESP32 WROVER

ESPHome version (latest production, beta, dev branch) ESPHome version like v1.15.3 and 1.16-dev

Affected component: web/ota/api

Description of problem: web/api/ota does not start after enabling esp32_ble_tracker

in debug we have :

[E][AsyncTCP.cpp:1273] begin(): failed to start task

Problem-relevant YAML-configuration entries:

substitutions:
  devicename: ttgocam
  friendly_name: ttgocam

esphome:
  name: $devicename
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_psk

web_server:
  port: 80

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: GPIO33
    name: $friendly_name PIR
    device_class: motion

  - platform: gpio
    pin:
      number: GPIO34
      mode: INPUT_PULLUP
      inverted: True
    name: $friendly_name Button

  - platform: status
    name: $friendly_name Status

esp32_ble_tracker:

sensor:
  - platform: wifi_signal
    name: $friendly_name WiFi Signal
    update_interval: 10s
  - platform: uptime
    name: $friendly_name Uptime

esp32_camera:
  name: $friendly_name Camera
  external_clock:
    pin: GPIO32
    frequency: 20MHz
  i2c_pins:
    sda: GPIO13
    scl: GPIO12
  data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
  vsync_pin: GPIO27
  href_pin: GPIO25
  pixel_clock_pin: GPIO19
  power_down_pin: GPIO26
  resolution: 640x480
  jpeg_quality: 10
  vertical_flip: false
  horizontal_mirror: false

i2c:
  sda: GPIO21
  scl: GPIO22

font:
  - file: "fonts/times-new-roman.ttf"
    id: tnr1
    size: 20
  - file: "fonts/times-new-roman.ttf"
    id: tnr2
    size: 35

time:
  - platform: homeassistant
    id: homeassistant_time

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
      it.strftime(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "%H:%M", id(homeassistant_time).now());

switch:
  - platform: restart
    name: "switch_name"

Logs (if applicable):

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
␛[0;32m[I][logger:166]: Log initialized␛[0m
␛[0;32m[I][app:029]: Running through setup()...␛[0m
␛[0;36m[D][binary_sensor:034]: 'ttgocam PIR': Sending initial state OFF␛[0m
␛[0;36m[D][binary_sensor:034]: 'ttgocam Button': Sending initial state OFF␛[0m
␛[0;36m[D][binary_sensor:034]: 'ttgocam Status': Sending initial state OFF␛[0m
␛[0;36m[D][esp32_ble_tracker:148]: Starting scan...␛[0m
␛[0;35m[C][ssd1306_i2c:010]: Setting up I2C SSD1306...␛[0m
␛[0;35m[C][wifi:033]: Setting up WiFi...␛[0m
␛[0;36m[D][wifi:324]: Starting scan...␛[0m
␛[0;36m[D][sensor:092]: 'ttgocam Uptime': Sending state 2.77800 s with 0 decimals of accuracy␛[0m
␛[0;36m[D][binary_sensor:036]: 'ttgocam PIR': Sending state ON␛[0m
␛[0;36m[D][esp32_ble_tracker:544]: Found device 3B:78:D6:F0:16:F2 RSSI=-87␛[0m
␛[0;36m[D][esp32_ble_tracker:565]:   Address Type: RANDOM␛[0m
␛[0;36m[D][esp32_camera:159]: Got Image: len=38692␛[0m
␛[0;36m[D][esp32_camera:159]: Got Image: len=38056␛[0m
␛[0;36m[D][esp32_ble_tracker:544]: Found device 4C:FA:E9:9A:2F:91 RSSI=-47␛[0m
␛[0;36m[D][esp32_ble_tracker:565]:   Address Type: RANDOM␛[0m
␛[0;36m[D][wifi:339]: Found networks:␛[0m
...
␛[0;32m[I][wifi:194]: WiFi Connecting to 'wifi'...␛[0m
␛[0;36m[D][esp32_camera:159]: Got Image: len=35442␛[0m
␛[0;32m[I][wifi:457]: WiFi Connected!␛[0m
␛[0;35m[C][wifi:303]:   SSID: ␛[5m'wifi'␛[6m␛[0m
␛[0;35m[C][wifi:304]:   IP Address: 192.168.168.27␛[0m
␛[0;35m[C][wifi:306]:   BSSID: ␛[5m10:FE:ED:84:55:07␛[6m␛[0m
␛[0;35m[C][wifi:307]:   Hostname: 'ttgocam'␛[0m
␛[0;35m[C][wifi:311]:   Signal strength: -40 dB ␛[0;32m▂▄▆█␛[0m␛[0m
␛[0;35m[C][wifi:315]:   Channel: 13␛[0m
␛[0;35m[C][wifi:316]:   Subnet: 255.255.255.0␛[0m
␛[0;35m[C][wifi:317]:   Gateway: 192.168.168.1␛[0m
␛[0;35m[C][wifi:318]:   DNS1: 192.168.168.1␛[0m
␛[0;35m[C][wifi:319]:   DNS2: 0.0.0.0␛[0m
␛[0;36m[D][binary_sensor:036]: 'ttgocam PIR': Sending state OFF␛[0m
␛[0;36m[D][esp32_ble_tracker:544]: Found device 79:4B:3F:EF:F2:76 RSSI=-88␛[0m
␛[0;36m[D][esp32_ble_tracker:565]:   Address Type: RANDOM␛[0m
␛[0;35m[C][api:022]: Setting up Home Assistant API server...␛[0m
[E][AsyncTCP.cpp:1273] begin(): failed to start task
␛[0;32m[I][app:059]: setup() finished successfully!␛[0m
␛[0;36m[D][sensor:092]: 'ttgocam WiFi Signal': Sending state -41.00000 dB with 0 decimals of accuracy␛[0m
␛[0;32m[I][app:105]: ESPHome version 1.16.0-dev compiled on Nov 29 2020, 14:42:14␛[0m
␛[0;35m[C][wifi:443]: WiFi:␛[0m
␛[0;35m[C][wifi:303]:   SSID: ␛[5m'wifi'␛[6m␛[0m
␛[0;35m[C][wifi:304]:   IP Address: 192.168.168.27␛[0m
␛[0;35m[C][wifi:306]:   BSSID: ␛[5m10:FE:ED:84:55:07␛[6m␛[0m
␛[0;35m[C][wifi:307]:   Hostname: 'ttgocam'␛[0m
␛[0;35m[C][wifi:311]:   Signal strength: -41 dB ␛[0;32m▂▄▆█␛[0m␛[0m
␛[0;35m[C][wifi:315]:   Channel: 13␛[0m
␛[0;35m[C][wifi:316]:   Subnet: 255.255.255.0␛[0m
␛[0;35m[C][wifi:317]:   Gateway: 192.168.168.1␛[0m
␛[0;35m[C][wifi:318]:   DNS1: 192.168.168.1␛[0m
␛[0;35m[C][wifi:319]:   DNS2: 0.0.0.0␛[0m
␛[0;35m[C][i2c:028]: I2C Bus:␛[0m
␛[0;35m[C][i2c:029]:   SDA Pin: GPIO21␛[0m
␛[0;35m[C][i2c:030]:   SCL Pin: GPIO22␛[0m
␛[0;35m[C][i2c:031]:   Frequency: 50000 Hz␛[0m
␛[0;32m[I][i2c:033]: Scanning i2c bus for active devices...␛[0m
␛[0;32m[I][i2c:040]: Found i2c device at address 0x3C␛[0m
␛[0;35m[C][gpio.binary_sensor:015]: GPIO Binary Sensor 'ttgocam PIR'␛[0m
␛[0;35m[C][gpio.binary_sensor:015]:   Device Class: 'motion'␛[0m
␛[0;35m[C][gpio.binary_sensor:016]:   Pin: GPIO33 (Mode: INPUT)␛[0m
␛[0;35m[C][gpio.binary_sensor:015]: GPIO Binary Sensor 'ttgocam Button'␛[0m
␛[0;35m[C][gpio.binary_sensor:016]:   Pin: GPIO34 (Mode: INPUT_PULLUP, INVERTED)␛[0m
␛[0;35m[C][uptime.sensor:030]: Uptime Sensor 'ttgocam Uptime'␛[0m
␛[0;35m[C][uptime.sensor:030]:   Unit of Measurement: 's'␛[0m
␛[0;35m[C][uptime.sensor:030]:   Accuracy Decimals: 0␛[0m
␛[0;35m[C][uptime.sensor:030]:   Icon: 'mdi:timer-outline'␛[0m
␛[0;35m[C][logger:185]: Logger:␛[0m
␛[0;35m[C][logger:186]:   Level: DEBUG␛[0m
␛[0;35m[C][logger:187]:   Log Baud Rate: 115200␛[0m
␛[0;35m[C][logger:188]:   Hardware UART: UART0␛[0m
␛[0;35m[C][status:034]: Status Binary Sensor 'ttgocam Status'␛[0m
␛[0;35m[C][status:034]:   Device Class: 'connectivity'␛[0m
␛[0;35m[C][esp32_ble_tracker:530]: BLE Tracker:␛[0m
␛[0;35m[C][esp32_ble_tracker:531]:   Scan Duration: 300 s␛[0m
␛[0;35m[C][esp32_ble_tracker:532]:   Scan Interval: 320.0 ms␛[0m
␛[0;35m[C][esp32_ble_tracker:533]:   Scan Window: 30.0 ms␛[0m
␛[0;35m[C][esp32_ble_tracker:534]:   Scan Type: PASSIVE␛[0m

Additional information and things you've tried:

adding heap_caps_print_heap_info(MALLOC_CAP_8BIT); before task is creating

with esp32_ble_tracker enabled

Heap summary for capabilities 0x00000004: At 0x3ffb2730 len 15448 free 0 allocated 15128 min_free 0 largest_free_block 0 alloc_blocks 18 free_blocks 0 total_blocks 18 At 0x3f800000 len 4194303 free 4148792 allocated 43976 min_free 4146488 largest_free_block 4146488 alloc_blocks 92 free_blocks 4 total_blocks 96 At 0x3ffaff10 len 240 free 0 allocated 120 min_free 0 largest_free_block 0 alloc_blocks 5 free_blocks 1 total_blocks 6 At 0x3ffb6388 len 7288 free 0 allocated 6920 min_free 0 largest_free_block 0 alloc_blocks 21 free_blocks 0 total_blocks 21 At 0x3ffb9a20 len 16648 free 20 allocated 15300 min_free 20 largest_free_block 0 alloc_blocks 79 free_blocks 5 total_blocks 84 At 0x3ffcd330 len 77008 free 20 allocated 74332 min_free 12 largest_free_block 0 alloc_blocks 162 free_blocks 5 total_blocks 167 At 0x3ffe0440 len 15072 free 4 allocated 14360 min_free 0 largest_free_block 0 alloc_blocks 41 free_blocks 2 total_blocks 43 At 0x3ffe4350 len 113840 free 5664 allocated 106232 min_free 916 largest_free_block 5624 alloc_blocks 117 free_blocks 7 total_blocks 124 Totals: free 4154500 allocated 276368 min_free 4147436 largest_free_block 4146488

without esp32_ble_tracker enabled before api task creating

Heap summary for capabilities 0x00000004: At 0x3f800000 len 4194303 free 4194252 allocated 0 min_free 4194252 largest_free_block 4194252 alloc_blocks 0 free_blocks 1 total_blocks 1 At 0x3ffaff10 len 240 free 0 allocated 120 min_free 0 largest_free_block 0 alloc_blocks 5 free_blocks 1 total_blocks 6 At 0x3ffb6388 len 7288 free 0 allocated 6920 min_free 0 largest_free_block 0 alloc_blocks 21 free_blocks 0 total_blocks 21 At 0x3ffb9a20 len 16648 free 16 allocated 15308 min_free 16 largest_free_block 0 alloc_blocks 79 free_blocks 4 total_blocks 83 At 0x3ffc8a90 len 95600 free 80 allocated 92244 min_free 56 largest_free_block 12 alloc_blocks 199 free_blocks 12 total_blocks 211 At 0x3ffe0440 len 15072 free 4708 allocated 9348 min_free 236 largest_free_block 4696 alloc_blocks 60 free_blocks 3 total_blocks 63 At 0x3ffe4350 len 113840 free 52336 allocated 61440 min_free 47212 largest_free_block 52336 alloc_blocks 1 free_blocks 1 total_blocks 2 Totals: free 4251640 allocated 185164 min_free 4241772 largest_free_block 4194252

after api task creating

Heap summary for capabilities 0x00000004: At 0x3f800000 len 4194303 free 4194252 allocated 0 min_free 4194252 largest_free_block 4194252 alloc_blocks 0 free_blocks 1 total_blocks 1 At 0x3ffaff10 len 240 free 0 allocated 120 min_free 0 largest_free_block 0 alloc_blocks 5 free_blocks 1 total_blocks 6 At 0x3ffb6388 len 7288 free 0 allocated 6920 min_free 0 largest_free_block 0 alloc_blocks 21 free_blocks 0 total_blocks 21 At 0x3ffb9a20 len 16648 free 16 allocated 15308 min_free 16 largest_free_block 0 alloc_blocks 79 free_blocks 4 total_blocks 83 At 0x3ffc8a90 len 95600 free 80 allocated 92244 min_free 56 largest_free_block 12 alloc_blocks 199 free_blocks 12 total_blocks 211 At 0x3ffe0440 len 15072 free 4584 allocated 9488 min_free 236 largest_free_block 4540 alloc_blocks 59 free_blocks 3 total_blocks 62 At 0x3ffe4350 len 113840 free 35928 allocated 77832 min_free 35928 largest_free_block 35928 alloc_blocks 2 free_blocks 1 total_blocks 3 Totals: free 4234860 allocated 201912 min_free 4230488 largest_free_block 4194252

brumela commented 3 years ago

I can confirm this. My setup is AI Thinker ESP32-CAM; board = esp32cam
ESPHome version: 1.15.3

esphome:
  name: $devicename
  platform: ESP32
  board: esp32cam

api:
ota:

#esp32_camera:
#   external_clock:
#     pin: GPIO0
#     frequency: 20MHz
#   i2c_pins:
#     sda: GPIO26
#     scl: GPIO27
#   data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
#   vsync_pin: GPIO25
#   href_pin: GPIO23
#   pixel_clock_pin: GPIO22
#   power_down_pin: GPIO32
#   name: $devicename
#   vertical_flip: false
#   horizontal_mirror: false

esp32_ble_tracker:

sensor:
  - platform: ble_rssi
    mac_address: $flora2Mac
    name: "${flora2} RSSI value"

  - platform: xiaomi_hhccjcy01
    mac_address: $flora2Mac
    temperature:
      name: "${flora2} Temperature"
    moisture:
      name: "${flora2} Moisture"
    illuminance:
      name: "${flora2} Illuminance"
    conductivity:
      name: "${flora2} Soil Conductivity"

It works either _with esp32_camera: or esp32_ble_tracker:_ configuration, but not with both. If both are enabled I get [E][AsyncTCP.cpp:709] connect(): failed to start task

buxtronix commented 3 years ago

Not enough ram on the device to support both BLE and camera I'm afraid.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.