Esp32 cam login attempt or request with invalid authentication from

It’s possibly your own IP address? You can google whatsmyip to find out. In which case it is your router or something misconfigured somewhere. (Or someone else in Sweden trying to look at your camera!)

It is my own ip. When trying to see it from my phone outside the network I’m getting a similar ip warning. It’s so weird that my other esp multi sensor is working just fine but the camera is “blocked”

I think I have found the problem. I did a log on it via OTA and it seems like it disconnects from the api after initial setup and from there it tries to connect again but isn’t allowed.

Hi all,

It looks like I am on the same boat here.

I also got my TTGO Cam Plus and I am running into the same issues just that on my side I am getting invalid logon from the IP of the computer I use to browse the HA page.

I have another ESP32 camera flashed a while ago that is running fine. Unfortunately I do not have the same development environment to test with. I did tried reverting the ESPHome to 1.13.0 and 1.13.6 the behaviour was similar. Maybe the 37000+ byte image payload is too much for the API.

The original FW on the board worked for the demo purposes ok.
Maybe I have an hardware issue. I don’t know how to track this API disconnections.

Best regards.

I have exactly the same problem. I have tried different kind of things for 3 weeks. The api keeps bugging out everytime. I tried running it as a webserver and connecting but still not working. I think the best thing to do is buy the ttgo and not the plus.

Hi,

I think I got this working a bit better. It is just too late to watch how it performs, but I did added the following lines to the configuration:

i2c:
  sda: 18
  scl: 23
  scan: False

spi:
  clk_pin: GPIO21
  mosi_pin: GPIO19
  miso_pin: GPIO22

output:
  - platform: gpio
    pin: GPIO0
    id: CS_GPIO0
  - platform: gpio
    pin: GPIO12
    id: CS_GPIO12
  - platform: gpio
    pin: GPIO2
    id: CS_GPIO2

I think that some pins needed a better default state than what the normal default is.

It is still running a bit slow and I am not seeing any increase on the frame rate once it is streaming but there are no more API disconnections, or at least as long as it took this to write this.

Let me know if is not just a coincidence.
:slight_smile:

Wonderful! I will try this as soon as I get home! :slight_smile:

I’m just geting an error while uploading. Can you please show the whole camera config? :slight_smile: @COX

Hi, if you are trying to OTA update it will fail because of the API issues. You will have to use an USB cable.

I did it via usb-cable. Did you just add it to the bottom and keep the rest or did you change anything?

No,

I added this at the end of the
esp32_camera:
element.

Like this:

esp32_camera:
  name: TTGoCam
  external_clock:
    pin: GPIO4
    frequency: 20MHz
  i2c_pins:
    sda: GPIO18
    scl: GPIO23
  data_pins: [GPIO34, GPIO13, GPIO26, GPIO35, GPIO39, GPIO38, GPIO37, GPIO36]
  vsync_pin: GPIO5
  href_pin: GPIO27
  pixel_clock_pin: GPIO25
  resolution: 800x600
  jpeg_quality: 16
  vertical_flip: true
  horizontal_mirror: true

i2c:
  sda: 18
  scl: 23
  scan: False

spi:
  clk_pin: GPIO21
  mosi_pin: GPIO19
  miso_pin: GPIO22
  id: SDCard

output:
  - platform: gpio
    pin: GPIO0
    id: CS_GPIO0
  - platform: gpio
    pin: GPIO12
    id: CS_GPIO12
  - platform: gpio
    pin: GPIO2
    id: CS_GPIO2

switch:
  - platform: restart
    name: "TTGoCam Restart"

sensor:
  - platform: wifi_signal
    name: "TTGoCam dB"
    update_interval: 60s

Thank you! It works perfectly but without the i2c part! I’m guessing you might have the bme sensor on yours :slight_smile:

Thanks again!

I’m using the TTGO T-Camera plus camera.

I’m gettting the following error:
[20:37:15][E][esp32_camera:091]: Setup Failed: ERROR

my config:

esphome:
  name: ttgocam
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "zxc"
  password: "zxc"
  fast_connect: true
# Enable logging
logger:
  level: VERBOSE
# Enable Home Assistant API
api:
  password: "zxc"

ota:
  password: "zxc"
web_server:
  port: 80

# ttgo_camearv16 configuration
esp32_camera:
  external_clock:
    pin: GPIO04
    frequency: 20MHz
  i2c_pins:
    sda: GPIO18
    scl: GPIO23
  data_pins: [GPIO34, GPIO13, GPIO26, GPIO35, GPIO39, GPIO38, GPIO37, GPIO36]
  vsync_pin: GPIO05
  href_pin: GPIO27
  pixel_clock_pin: GPIO25
 # resolution: 800x600
 # jpeg_quality: 16
  vertical_flip: true
  horizontal_mirror: true
  name: My Camera

Hi!

Are you uploading via USB or OTA?
try adding this code on the buttom of your config and set the resolution to 640x480:

i2c:
  sda: 18
  scl: 23
  scan: False

spi:
  clk_pin: GPIO21
  mosi_pin: GPIO19
  miso_pin: GPIO22
  id: SDCard

output:
  - platform: gpio
    pin: GPIO0
    id: CS_GPIO0
  - platform: gpio
    pin: GPIO12
    id: CS_GPIO12
  - platform: gpio
    pin: GPIO2
    id: CS_GPIO2

I’m updating via OTA.
Tried with this code as well, no joy.
My log output looks like this:

[21:55:40][C][wifi:372]: WiFi:
[21:55:40][C][wifi:254]:   SSID: zxc
[21:55:40][C][wifi:255]:   IP Address: 192.168.2.214
[21:55:40][C][wifi:257]:   BSSID: zxc
[21:55:40][C][wifi:258]:   Hostname: 'ttgocam'
[21:55:40][C][wifi:262]:   Signal strength: -69 dB ▂▄▆█
[21:55:40][C][wifi:263]:   Channel: 1
[21:55:40][C][wifi:264]:   Subnet: 255.255.255.0
[21:55:40][C][wifi:265]:   Gateway: 192.168.2.1
[21:55:40][C][wifi:266]:   DNS1: 192.168.2.1
[21:55:40][C][wifi:267]:   DNS2: 0.0.0.0
[21:55:40][C][i2c:028]: I2C Bus:
[21:55:40][C][i2c:029]:   SDA Pin: GPIO18
[21:55:40][C][i2c:030]:   SCL Pin: GPIO23
[21:55:40][C][i2c:031]:   Frequency: 50000 Hz
[21:55:40][C][spi:096]: SPI bus:
[21:55:40][C][spi:097]:   CLK Pin: GPIO21 (Mode: OUTPUT)
[21:55:41][C][spi:098]:   MISO Pin: GPIO22 (Mode: INPUT)
[21:55:41][C][spi:099]:   MOSI Pin: GPIO19 (Mode: OUTPUT)
[21:55:41][C][gpio.output:010]: GPIO Binary Output:
[21:55:41][C][gpio.output:011]:   Pin: GPIO0 (Mode: OUTPUT)
[21:55:41][C][gpio.output:010]: GPIO Binary Output:
[21:55:41][C][gpio.output:011]:   Pin: GPIO12 (Mode: OUTPUT)
[21:55:41][C][gpio.output:010]: GPIO Binary Output:
[21:55:41][C][gpio.output:011]:   Pin: GPIO2 (Mode: OUTPUT)
[21:55:41][C][logger:137]: Logger:
[21:55:41][C][logger:138]:   Level: VERBOSE
[21:55:41][C][logger:139]:   Log Baud Rate: 115200
[21:55:41][C][logger:140]:   Hardware UART: UART0
[21:55:41][C][esp32_camera:043]: ESP32 Camera:
[21:55:41][C][esp32_camera:044]:   Name: My Camera
[21:55:41][C][esp32_camera:045]:   Board Has PSRAM: YES
[21:55:41][C][esp32_camera:047]:   Data Pins: D0:34 D1:13 D2:26 D3:35 D4:39 D5:38 D6:37 D7:36
[21:55:41][C][esp32_camera:048]:   VSYNC Pin: 5
[21:55:41][C][esp32_camera:049]:   HREF Pin: 27
[21:55:41][C][esp32_camera:050]:   Pixel Clock Pin: 25
[21:55:41][C][esp32_camera:051]:   External Clock: Pin:4 Frequency:20000000
[21:55:41][C][esp32_camera:052]:   I2C Pins: SDA:18 SCL:23
[21:55:41][C][esp32_camera:053]:   Reset Pin: -1
[21:55:41][C][esp32_camera:074]:   Resolution: 640x480 (VGA)
[21:55:41][E][esp32_camera:091]:   Setup Failed: ERROR
[21:55:41][C][web_server:125]: Web Server:
[21:55:41][C][web_server:126]:   Address: ttgocam.local:80
[21:55:41][C][ota:029]: Over-The-Air Updates:
[21:55:41][C][ota:030]:   Address: ttgocam.local:3232
[21:55:41][C][ota:032]:   Using Password.
[21:55:41][C][api:103]: API Server:
[21:55:41][C][api:104]:   Address: ttgocam.local:6053
[21:55:55][V][api:542]: Hello from client: 'Home Assistant 0.96.5 (192.168.2.10)'
[21:55:55][D][api:573]: Client 'Home Assistant 0.96.5 (192.168.2.10)' connected successfully!
[21:56:04][V][api:1191]: on_camera_image_request_ stream=YES single=NO
[21:56:04][V][api:1191]: on_camera_image_request_ stream=NO single=YES

Do it via USB instead until you get a stable stream. The it’s probably fine

Just tried it via USB. The same.

I noticed the following:

[23:01:36][E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
[23:01:36][E][esp32_camera:017]: esp_camera_init failed: ERROR
[23:01:36][E][component:153]: Component was marked as failed.

The full log.

========================= [SUCCESS] Took 59.11 seconds =========================
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[23:01:36][D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled
[23:01:36][I][logger:116]: Log initialized
[23:01:36][C][ota:364]: There have been 1 suspected unsuccessful boot attempts.
[23:01:36][I][app:028]: Running through setup()...
[23:01:36][V][app:029]: Sorting components by setup priority...
[23:01:36][V][esp32-hal-i2c.c:1483] i2cInit(): num=0 sda=18 scl=23 freq=0
[23:01:36][V][esp32-hal-i2c.c:1677] i2cSetFrequency(): freq=100000Hz
[23:01:36][V][esp32-hal-i2c.c:1692] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[23:01:36][V][esp32-hal-i2c.c:1698] i2cSetFrequency(): Fifo delta=1
[23:01:36][V][esp32-hal-i2c.c:1677] i2cSetFrequency(): freq=50000Hz
[23:01:36][V][esp32-hal-i2c.c:1692] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=50000Hz
[23:01:36][V][esp32-hal-i2c.c:1698] i2cSetFrequency(): Fifo delta=1
[23:01:36]
[23:01:36]SCCB_Write [ff]=01 failed
[23:01:36]SCCB_Write [12]=80 failed
[23:01:36][E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
[23:01:36][E][esp32_camera:017]: esp_camera_init failed: ERROR
[23:01:36][E][component:153]: Component was marked as failed.
[23:01:36][C][wifi:029]: Setting up WiFi...
[23:01:36][V][wifi_esp32:033]: Enabling STA.
[23:01:36]I (1637) wifi: wifi driver task: 3ffb55f4, prio:23, stack:3584, core=0
[23:01:36]I (3489) wifi: wifi firmware version: 6b44342
[23:01:36]I (3493) wifi: config NVS flash: enabled
[23:01:36]I (3496) wifi: config nano formating: disabled
[23:01:36]I (3518) wifi: Init dynamic tx buffer num: 32
[23:01:36]I (3519) wifi: Init data frame dynamic rx buffer num: 10
[23:01:36]I (3519) wifi: Init management frame dynamic rx buffer num: 10
[23:01:36]I (3523) wifi: Init static rx buffer size: 1600
[23:01:36]I (3527) wifi: Init static rx buffer num: 4
[23:01:36]I (3530) wifi: Init dynamic rx buffer num: 10
[23:01:36]I (3602) wifi: mode : softAP (cc:50:e3:b5:fc:e1)
[23:01:36]I (3603) wifi: Init max length of beacon: 752/752
[23:01:36]I (3604) wifi: Init max length of beacon: 752/752
[23:01:36][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[23:01:36][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[23:01:36][V][wifi_esp32:339]: Event: WiFi AP start
[23:01:36][V][wifi_esp32:288]: Event: WiFi ready
[23:01:36]I (3626) wifi: mode : sta (cc:50:e3:b5:fc:e0)
[23:01:36][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[23:01:36][V][wifi_esp32:297]: Event: WiFi STA start
[23:01:36][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[23:01:36]I (3645) wifi: Set ps type: 0
[23:01:36]
[23:01:36][D][wifi:272]: Starting scan...
[23:01:39][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 1 - SCAN_DONE
[23:01:39][V][wifi_esp32:293]: Event: WiFi Scan Done status=0 number=6 scan_id=128
[23:01:39][D][wifi:287]: Found networks:
[23:01:39][I][wifi:322]: - [redacted] [redacted]▂▄▆█
[23:01:39][D][wifi:323]:     Channel: 1
[23:01:39][D][wifi:324]:     RSSI: -72 dB
[23:01:39][D][wifi:326]: - [redacted] [redacted]▂▄▆█
[23:01:39][D][wifi:326]: - [redacted] [redacted]▂▄▆█
[23:01:39][D][wifi:326]: - [redacted] [redacted]▂▄▆█
[23:01:39][D][wifi:326]: - [redacted] [redacted]▂▄▆█
[23:01:39][D][wifi:326]: - [redacted] [redacted]▂▄▆█
[23:01:39][I][wifi:164]: WiFi Connecting to [redacted]...
[23:01:39][V][wifi:166]: Connection Params:
[23:01:39][V][wifi:167]:   SSID: [redacted]
[23:01:39][V][wifi:170]:   BSSID: 16:91:82:37:6E:D2
[23:01:39][V][wifi:174]:   Password: [redacted]
[23:01:39][V][wifi:176]:   Channel: 1
[23:01:39][V][wifi:186]:   Using DHCP IP
[23:01:39][V][wifi:188]:   Hidden: NO
[23:01:39]I (6453) wifi: new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
[23:01:40]I (7190) wifi: state: init -> auth (b0)
[23:01:40]I (7214) wifi: state: auth -> assoc (0)
[23:01:40]I (7237) wifi: state: assoc -> run (10)
[23:01:40]I (7251) wifi: connected with [redacted], channel 1, bssid = 16:91:82:37:6e:d2
[23:01:40]I (7252) wifi: pm start, type: 0
[23:01:40]
[23:01:40][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
[23:01:40][V][wifi_esp32:310]: Event: Connected ssid='[redacted]' bssid=[redacted] channel=1, authmode=WPA2 PSK
[23:01:42][D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
[23:01:42][D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.2.214, MASK: 255.255.255.0, GW: 192.168.2.1
[23:01:42][V][wifi_esp32:331]: Event: Got IP static_ip=192.168.2.214 gateway=192.168.2.1
[23:01:42][I][wifi:380]: WiFi connected!
[23:01:42][C][wifi:254]:   SSID: [redacted]
[23:01:42][C][wifi:255]:   IP Address: 192.168.2.214
[23:01:42][C][wifi:257]:   BSSID: [redacted]
[23:01:42][C][wifi:258]:   Hostname: 'ttgocam'
[23:01:42][C][wifi:262]:   Signal strength: -66 dB ▂▄▆█
[23:01:42][C][wifi:263]:   Channel: 1
[23:01:42][C][wifi:264]:   Subnet: 255.255.255.0
[23:01:42][C][wifi:265]:   Gateway: 192.168.2.1
[23:01:42][C][wifi:266]:   DNS1: 192.168.2.1
[23:01:42][C][wifi:267]:   DNS2: 0.0.0.0
[23:01:42][C][web_server:068]: Setting up web server...
[23:01:42][C][ota:029]: Over-The-Air Updates:
[23:01:42][C][ota:030]:   Address: ttgocam.local:3232
[23:01:42][C][ota:032]:   Using Password.
[23:01:42][C][api:030]: Setting up Home Assistant API server...
[23:01:42][I][app:060]: setup() finished successfully!
[23:01:42][I][app:096]: esphome version 1.13.6 compiled on Aug  5 2019, 21:54:03
[23:01:42][C][wifi:372]: WiFi:
[23:01:42][C][wifi:254]:   SSID: [redacted]
[23:01:42][C][wifi:255]:   IP Address: 192.168.2.214
[23:01:42][C][wifi:257]:   BSSID: [redacted]
[23:01:42][C][wifi:258]:   Hostname: 'ttgocam'
[23:01:42][C][wifi:262]:   Signal strength: -67 dB ▂▄▆█
[23:01:42][C][wifi:263]:   Channel: 1
[23:01:42][C][wifi:264]:   Subnet: 255.255.255.0
[23:01:42][C][wifi:265]:   Gateway: 192.168.2.1
[23:01:42][C][wifi:266]:   DNS1: 192.168.2.1
[23:01:42][C][wifi:267]:   DNS2: 0.0.0.0
[23:01:42][C][i2c:028]: I2C Bus:
[23:01:42][C][i2c:029]:   SDA Pin: GPIO18
[23:01:42][C][i2c:030]:   SCL Pin: GPIO23
[23:01:42][C][i2c:031]:   Frequency: 50000 Hz
[23:01:42][C][spi:096]: SPI bus:
[23:01:42][C][spi:097]:   CLK Pin: GPIO21 (Mode: OUTPUT)
[23:01:42][C][spi:098]:   MISO Pin: GPIO22 (Mode: INPUT)
[23:01:42][C][spi:099]:   MOSI Pin: GPIO19 (Mode: OUTPUT)
[23:01:42][C][gpio.output:010]: GPIO Binary Output:
[23:01:42][C][gpio.output:011]:   Pin: GPIO0 (Mode: OUTPUT)
[23:01:42][C][gpio.output:010]: GPIO Binary Output:
[23:01:42][C][gpio.output:011]:   Pin: GPIO12 (Mode: OUTPUT)
[23:01:42][C][gpio.output:010]: GPIO Binary Output:
[23:01:42][C][gpio.output:011]:   Pin: GPIO2 (Mode: OUTPUT)
[23:01:42][C][logger:137]: Logger:
[23:01:42][C][logger:138]:   Level: VERBOSE
[23:01:42][C][logger:139]:   Log Baud Rate: 115200
[23:01:42][C][logger:140]:   Hardware UART: UART0
[23:01:42][C][esp32_camera:043]: ESP32 Camera:
[23:01:42][C][esp32_camera:044]:   Name: My Camera
[23:01:42][C][esp32_camera:045]:   Board Has PSRAM: YES
[23:01:42][C][esp32_camera:047]:   Data Pins: D0:34 D1:13 D2:26 D3:35 D4:39 D5:38 D6:37 D7:36
[23:01:42][C][esp32_camera:048]:   VSYNC Pin: 5
[23:01:42][C][esp32_camera:049]:   HREF Pin: 27
[23:01:42][C][esp32_camera:050]:   Pixel Clock Pin: 25
[23:01:42][C][esp32_camera:051]:   External Clock: Pin:4 Frequency:20000000
[23:01:42][C][esp32_camera:052]:   I2C Pins: SDA:18 SCL:23
[23:01:42][C][esp32_camera:053]:   Reset Pin: -1
[23:01:42][C][esp32_camera:074]:   Resolution: 640x480 (VGA)
[23:01:42][E][esp32_camera:091]:   Setup Failed: ERROR
[23:01:42][C][web_server:125]: Web Server:
[23:01:42][C][web_server:126]:   Address: ttgocam.local:80
[23:01:42][C][ota:029]: Over-The-Air Updates:
[23:01:42][C][ota:030]:   Address: ttgocam.local:3232
[23:01:42][C][ota:032]:   Using Password.
[23:01:42][C][api:103]: API Server:
[23:01:42][C][api:104]:   Address: ttgocam.local:6053
[23:01:49][V][api:542]: Hello from client: 'Home Assistant 0.96.5 (192.168.2.10)'
[23:01:49][D][api:573]: Client 'Home Assistant 0.96.5 (192.168.2.10)' connected successfully!
[23:02:08][V][api:1191]: on_camera_image_request_ stream=YES single=NO
[23:02:31][V][api:1191]: on_camera_image_request_ stream=NO single=YES

This is my code. I got the same error when I was using i2c when I didn’t have the bme sensor on my camera.

esphome:
  name: ttgo
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "Secret ssid"
  password: "sercret password"
  manual_ip:
    static_ip: cool ip
    gateway: cooler gateway
    subnet: 255.255.255.0
  fast_connect: true
# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

esp32_camera:
  name: TTGoCam
  external_clock:
    pin: GPIO4
    frequency: 20MHz
  i2c_pins:
    sda: GPIO18
    scl: GPIO23
  data_pins: [GPIO34, GPIO13, GPIO26, GPIO35, GPIO39, GPIO38, GPIO37, GPIO36]
  vsync_pin: GPIO5
  href_pin: GPIO27
  pixel_clock_pin: GPIO25
  resolution: 640x480
  jpeg_quality: 12
  vertical_flip: false
  horizontal_mirror: true
  idle_framerate: 0.1fps
  
spi:
  clk_pin: GPIO21
  mosi_pin: GPIO19
  miso_pin: GPIO22
  id: SDCard

output:
  - platform: gpio
    pin: GPIO0
    id: CS_GPIO0
  - platform: gpio
    pin: GPIO12
    id: CS_GPIO12
  - platform: gpio
    pin: GPIO2
    id: CS_GPIO2

switch:
  - platform: restart
    name: "TTGoCam Restart"
    id: restart1
    

sensor:
  - platform: wifi_signal
    name: "TTGoCam dB"
    update_interval: 300s
  - platform: uptime
    name: Uptime TTgo

Have you got yours working better? I get some pictures now and then but nothing more :slight_smile:

Hi,

It just sits for now on the desk. But I took the camera module and installed it on an esp32cam board. In the meantime I bought a couple of ttgo beam or something, those that have a small display and antenna. These are working way better but still, from time to time I need to send the rest request.

I think that most of the issues are coming from the board manufacturing quality and from the quality of the cameras.

MFG.