8.8 Camera with Home Assistant

This project will guide you in setting up a video stream web server for the ESP32 camera and integrating it with the popular home automation platform, Home Assistant. This integration will allow you to access the server from any device on your network.

Note

Before diving into this project, you need to have an operating system with Home Assistant installed.

We recommend installing the Home Assistant OS on a Raspberry Pi.

If you don’t have a Raspberry Pi, you can also install it on a virtual machine running on Windows, macOS, or Linux.

For installation instructions, refer to the official website link: https://www.home-assistant.io/installation/

Please proceed with this project only after successful installation.

Required Components

In this project, we need the following components.

It’s definitely convenient to buy a whole kit, here’s the link:

Name

ITEMS IN THIS KIT

LINK

ESP32 Starter Kit

320+

ESP32 Starter Kit

You can also buy them separately from the links below.

COMPONENT INTRODUCTION

PURCHASE LINK

ESP32 WROOM 32E

BUY

ESP32 Camera Extension

-

1. Configuration in ESP Home

  1. First plug in the camera.

  2. Connect your ESP32 to the host where you’ve installed the Home Assistant system (e.g., if installed on a Raspberry Pi, connect to the Pi).

    ../../_images/plugin_esp32.png
  3. Install ESPHome Addon.

    ../../_images/sp230629_145928.png
  4. Click START, then OPEN WEB UI.

    ../../_images/sp230629_172645.png
  5. Add new devices.

    ../../_images/sp230629_172733.png
  6. A prompt might appear. Click CONTINUE.

    ../../_images/sp230629_172816.png
  7. Create a configuration. Here, you can enter any desired name for Name. For WiFi, enter details of the network on which your Home Assistant system is present.

    ../../_images/sp230629_172926.png
  8. Select the ESP32 as the device type.

    ../../_images/sp230629_173043.png
  9. When you see a fireworks celebration icon, it means you’ve successfully created the device. Click skip (DO NOT click INSTALL).

    ../../_images/sp230629_173151.png

    At this point, you’ve only added the device in ESPHome. To integrate the ESP32 module into Home Assistant, additional configurations are needed:

  10. Click EDIT.

    ../../_images/sp230629_173322.png
  11. After entering the .yaml interface, modify the ssid and password with your WiFi details.

    ../../_images/sp230629_174301.png
  12. Under the captive_portal section, paste the following code:

    # Example configuration entry
    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
    
        # Image settings
        name: My Camera
        # ...
    

    Note

    For more details on the .yaml configuration for ESP32, you can refer to ESP32 Camera - ESPHome.

  13. Save, then click INSTALL.

    ../../_images/sp230629_174447.png
  14. Choose the USB port method for installation.

    ../../_images/sp230629_174852.png

    Note

    The initial compilation will download dependency packages, which might take around 10 minutes. Please be patient. If the process stalls for a long time, check if there’s enough disk space on your system.

  15. Wait for the INFO Successfully compiled program. message, indicating firmware compilation is complete.

    ../../_images/sp230630_115109.png

    Note

    At this point, you should see the node as ONLINE. If not, ensure your ESP32 is on the same network segment or try rebooting the device.

    ../../_images/sp230630_153024.png

2. Configuration in Home Assistant

After integrating with Esphome, you still need to configure the camera in homeassistant.

  1. Go to Settings > Devices & Services.

    ../../_images/sp230630_155917.png
  2. Now you should see the esphome tab. Click CONFIGURE.

    ../../_images/sp230630_155736.png
  3. Click SUBMIT.

    ../../_images/sp230630_162218.png
  4. Wait for the Success message.

    ../../_images/sp230630_162311.png
  5. In Overview, click the top-right menu and select Edit Dashboard.

    ../../_images/sp230630_164745.png
  6. Click ADD CARD.

    ../../_images/sp230630_164850.png
  7. Choose Picture entity.

    ../../_images/sp230630_164935.png
  8. In the entity field, select the ESP32 you just added. Then save.

    ../../_images/sp230630_165019.png
  9. Lastly, click DONE to exit the EDIT interface.

    ../../_images/sp230630_165235.png

Now, you can view your camera feed on Home Assistant.