core: ESP32 camera not working after update to 2021.7.0

The problem

After updating to core-2021.7.0 my ESP32 camera feed stopped displaying in my lovelace view. Looking into the HA logbook, I found the camera entity was continually toggling between available and unavailable. This ESP32 camera module is running firmware compiled with ESPHome (1.19.4).

The ESP32 board in question also has a a few sensors connected to its GPIO pins as well as some very generic ESPHome sensors (uptime, wifi signal, reboot switch, etc).

I notice that every time HA tries to poll the ESP32 for an image, the HA API disconnects from the device (which causes all the other sensors/switches/entities associated with the ESP32 to briefly toggle offline too).

If I remove the esp32_camera component from the firmware, the HA API remains connected and the entity state of my sensors/switches remains online as expected.

Rolling back to HA 2021.6.6 fixes the issue - the camera feed works and the HA API remains connected with no problem.

What is version of Home Assistant Core has the issue?

core-2021.7.0

What was the last working version of Home Assistant Core?

core-2021.6.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ESPHome

Link to integration documentation on our website

https://www.home-assistant.io/integrations/esphome/

Example YAML snippet

Example config components from ESPHome - these are the sensors, camera, etc
sensor:
  - platform: wifi_signal
    name: ${devname} WiFi Signal
    id: ${devname}_wifi_signal
    update_interval: 60s

  - platform: uptime
    name: ${devname} Uptime
    id: ${devname}_uptime

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
  max_framerate: 1 fps
  resolution: SXGA
  jpeg_quality: 20
  contrast: 2
  saturation: 2
  name: ${devname} camera
  id: ${devname}_camera

switch:
  - platform: restart
    name: ${devname} Restart
    id: ${devname}_restart

Anything in the logs that might be useful for us?

Every 10 seconds when HA polls the ESP32 for an image, the ESP32 logs the following:
[14:26:05][D][esp32_camera:156]: Got Image: len=38209
[14:26:05][D][api:067]: Disconnecting Home Assistant 2021.7.0 (192.168.6.8)
[14:26:06][D][api.connection:630]: Client 'Home Assistant 2021.7.0 (192.168.6.8)' connected successfully!
[14:26:06][D][time:040]: Synchronized time: Thu Jul  8 14:26:06 2021

... and any entities associated with the ESP32 toggle offline in the logbook:
espcam_1 Restart turned off
2:26:06 PM - 17 minutes ago
espcam_1 Restart became unavailable

Additional information

  • Rolling back to HA 2021.6.6 resolves the issue
  • Commenting out the esp32_camera settings (which obviously stops HA from polling the camera) also makes the HA API stabilise and the remaining sensors/switches work fine.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 9
  • Comments: 37 (12 by maintainers)

Most upvoted comments

I have de same problem

I’ve upgraded to 2021.7.1, verified my venv install has the new 5.0.0 version of aioesphome and I’m still not getting my camera in Home Assistant (just a broken image icon). I turned the Home Assistant logging all the way to debug for homeassistant.components.esphome, but nothing esphome-related is showing up since the 2021.7.1 update. The other entities tied to the device (a restart switch and the on-board led light) aren’t going unavailable every few seconds like they were, but still no image 😦. I’m at work and can not access the esphome logging until I get home later today to see if there is anything telling from that end.

Hello,

Same issue with HA 2021.7.1 with ESPHome 1.19.4 on a Raspberry Pi 4.

Same here. No video for the esp32cam. HA 2021.7.1 ESPHOME 1.19.4 Debian Buster / NUC Docker

Same issue here. Just updated to 2021.7.1. No longer getting connection / re-connection issues but still no video.

Now the video is broken but the API is working OK after the first fix that was doing the module rebooting then was not able having communication with the module.

Yes, still broken…

The open the “camera window” ESPHCamB ESPHome cam is starting sending images with fast rate but HA is not using them so somthing more is broken.

[D][sensor:117]: 'Sun Azimuth': Sending state 287.24930 ° with 1 decimals of accuracy�
[D][esp32_camera:156]: Got Image: len=19455�
[D][esp32_camera:156]: Got Image: len=21192�
[D][esp32_camera:156]: Got Image: len=21037�
[D][esp32_camera:156]: Got Image: len=19995�
[D][sensor:117]: 'Sun Elevation': Sending state 14.63072 ° with 1 decimals of accuracy�
[D][esp32_camera:156]: Got Image: len=20132�
[D][esp32_camera:156]: Got Image: len=20211�
[D][esp32_camera:156]: Got Image: len=20368�
[D][esp32_camera:156]: Got Image: len=20399�
[D][esp32_camera:156]: Got Image: len=20116�
[D][esp32_camera:156]: Got Image: len=20188�
[D][esp32_camera:156]: Got Image: len=20186�
[D][esp32_camera:156]: Got Image: len=20166�
[D][esp32_camera:156]: Got Image: len=20185�
[D][esp32_camera:156]: Got Image: len=20190�
[D][esp32_camera:156]: Got Image: len=20236�
[D][esp32_camera:156]: Got Image: len=20363�
[D][esp32_camera:156]: Got Image: len=20129�
[D][esp32_camera:156]: Got Image: len=20145�
[D][esp32_camera:156]: Got Image: len=20141�
[D][esp32_camera:156]: Got Image: len=20141�
[D][esp32_camera:156]: Got Image: len=20185�
[D][esp32_camera:156]: Got Image: len=20109�

The first part (4 images) is idle and and then its “live streaming” in very short interval.

Yeah bro… i have the same problem here…

Hope they fix as soon possible!

Confirming this issue is resolved after updating to 2021.7.2

Same here. Good job. All cams are working again.

Confirming this issue is resolved after updating to 2021.7.2

Remember NEVER MORE update HA for a new release!!! The way is wait till 4 releases after…

Now all my esp32 cam projects is stopped…and not depends on me to fix 😦

Same for me since the update. I’ve not change anything and it was working on 2021.6 The cam itself work, but no video at all.

Updated to 2021.7.1 Still no camera image here. No errors in the log, just a blank image where the camera picture normally is.

Same here the cam is broken in 2021.7 on the HA side not in ESPHome.

2021-07-08 12:08:48 INFO (MainThread) [homeassistant.components.esphome] Successfully connected to 192.168.2.80
2021-07-08 12:08:58 INFO (MainThread) [aioesphomeapi.connection] 192.168.2.80: Unexpected error while reading incoming messages: 'CameraImageResponse' object has no attribute 'image'
2021-07-08 12:08:58 INFO (MainThread) [homeassistant.components.esphome] Disconnected from ESPHome API for 192.168.2.80

Its looks ESPHome is trying sending one images but HA cant handling it and ESPHome is disconnecting for API.

The device is flagged offline but is responding to commands like toggling the flashlight without problems so its only that HA is refusing receiving the images from our cams.