ESP32 Cam - working!

Thanks so much for getting back. With the other firmware I’m having trouble with the control of the on board LED through the Hassio.
Is there a DVR system that would support a direct stream from the ESP32 cam with esphome on it? Maybe I could a stream there, which I could then import into the Hassio.

Go to the camera entity in dev tools/states. Copy the url to the ‘entity picture’

In motion, add the camera as network

for the url use

http://your_ip:8123/api/camera_proxy/camera.foyer?token=dbc7b2d9595b005910b2809eff5c5b6a6b5e857b39db05baa00ed90a801e3487

The token changes, but I think can be replaced by a long lived token.

EDIT: sorry I was wrong, you can’t use a long lived token https://github.com/home-assistant/core/issues/24617

I would like to use Blue Iris to get my ESP32 Cam feed, can someone explain these two options to me in English. lol

You can use an access token to access the camera feed by setting the Authorization header in your GET request. You can also generate a signed path to create a GET request with embedded authentication.

1 Like

I really don’t think either of these will help

As a signed path only lasts 30 seconds, I don’t think it will help.

This means that you need to insert a long lived token into the header of your request, which would require, at least in motion’s case, a source change. The difficulty is that these long lived tokens can’t be used in the url, they need to be in the header.

I am trying to think through a way to get these cameras working like we want, but it’ll take a bit of experimentation.

1 Like

Ah, thanks for englishing it out for me :wink:
Makes sense.
Looks like right now there are 2 options. ESPHome for simple integration and all the functions I need (Using it as a garage door opener also) just no stream. Option 2 default ESP32-Cam web server that does the stream, just no simple plug and play for the rest of the stuff.

That is exactly my problem now! I’ve tried today this modification of the web server. It works quite well, I could get the feed into the Motion eye without any difficulties. You can control the PWM LED light over the web. But as you have mentioned there is no easy way to get the rest of the stuff from the chip to the home assistant. I wish there was a modification which could do MQTT, that would be neat.
Or EPHome with RTSP support, not that hard XD

Come on there are plenty of mqtt examples on the net, just add them to the .ino file.

Good find by the way.

that was my plan I was just saying XD

Has anyone actually managed to get this thing working properly with ESPhome so it can be streamed to a hub and if so can you point me at the correct yaml/guide etc. Be much appreciated. FYI it works with pinkywaifers code and I followed DrZZZ’s tutorial but really want to get this setup to stream to a hub and act as a doorbell. Thanks.

Last days I have to use my Ai Thinker esp32cam modules and I have found that the only usable solution is this one:

You can integrate it with HA as MJPEG IP Camera and use it with tinycam in the same time. Just read the comments in esp32-cam.ino file and you will find what to do. For me the best settings are:

  • FRAMESIZE_HD - 1280x720
  • framerate 10fps 6fps

so in ino file should be:
const int FPS = 6;

.frame_size     = FRAMESIZE_HD,
.jpeg_quality   = 12,
.fb_count       = 2
1 Like

I’ll take a look at that - thankyou :slight_smile:

Tachikoma1973 did you try cHunter789’s approach and if so did it work?

in the process of trying I’ve broken the camera module (fat fingers :slight_smile: ) so I have taken another approach.

I’ve fitted one of my tapo indoor cameras outside (its in a very sheltered spot under the eves in a doorway), Ive used removed the camera from the ttgo and just using the PIR and button sensors. This too will be hidden in the eve’s but I’ve fitted a wired doorbell button extension too it using low voltage wire. When the PIR detects motion HA automation alerts the house via google say (still messing with how to get to not stop whatever is playing on the devices). If the button (doorbell) is pressed then HA automation alerts house via google say and streams rtsp from tapo camera to relevant google hubs. Separately the tapo app/camera is configured to record to SD card when motion detected by the camera.

I’m looking at motioneye to replace the motion detection in the tapo app but the hardware I have isnt up to the task at present. Happy to share further details if interested.

It work but you can’t use higher resolution than HD (1280x760).

1 Like

Hi,
I want to use the esp cam module for both camera and ble module for getting data from mi temperature sensors. When I program the module it gets data from temp sensors but stops receiving any info from cam. Any way to fix it?
This is my yaml file

  hostname: 'espcam'
  ssid: 'xxx'
  password: 'xxx'
esphome:
  name: $hostname
  platform: ESP32
  board: esp32dev
wifi:
  ssid: $ssid
  password: $password
  fast_connect: True
api:
  reboot_timeout: 0s
ota:
logger:
esp32_ble_tracker:

# ESP32-CAM
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: living_room
  idle_framerate: 1 fps
  max_framerate: 15 fps
  resolution: 640x480
  jpeg_quality: 20
  vertical_flip: false

# Flashlight
output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4
    channel: 2
light:
  - platform: binary
    output: gpio_4
    name: $hostname light
switch:
  - platform: restart
    name: "ESPCam Living Room Restart"
    
sensor:
  - platform: uptime
    name: "${hostname}_Uptime Sensor"
    
  - platform: wifi_signal
    name: "${hostname} WiFi Signal"
    update_interval: 60s
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:FA:4C:CB
    bindkey: "05e04076be48f427f3d90e166d0fbd5e"
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    battery_level:
      name: "Battery Level"

@alexander.heikkila @Daemonic @GoSpursGoNL how are you guys getting on with the LilyGo T-camera ? Looks ideal. Can the PIR feed into Home Assistant for example? Does it do RTSP? Thanks!

This FW works fine, but can you give us hint, how to add in HA ?

Adding to HA is in the link you referenced. Just keep scrolling down until you get to the Home Assistant Integration section.

I was able to get brightness to work. I added a channel to the output configuration.

output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4
    channel: 7

I looked at the code for the esp32-cam-webserver . It used channel 7.

https://hackaday.io/project/168563-7-esp32-cam-example-expanded

I hope this helps.

1 Like

Needs some help here. Playing with role my own and adding MQTT to basically the webserver version https://github.com/easytarget/esp32-cam-webserver

It connects to the MQTT server in HA and using the HA I can fire the pin’s to activate my relay. The problem is that HA doesn’t see the status, it just say unknow.
The cover settings in HA look like this

cover:
  - platform: mqtt
    name: "Garage Test Cover"
    command_topic: "Garage/cover/set"
    state_topic: "Garage/cover/state"
    availability:
      - topic: "Garage/cover/availability"
    qos: 0
    retain: true
    payload_open: "OPEN"
    payload_close: "CLOSE"
    payload_stop: "STOP"
    state_open: "open"
    state_closed: "closed"
    position_open: 100
    position_closed: 0
    payload_available: "online"
    payload_not_available: "offline"
    optimistic: false
    value_template: "{{ value.x }}"

In my sketch my topic is defined as

const char *COVER_STATE_TOPIC = "Garage/cover/state";

when the state changes I use this

client.publish(COVER_STATE_TOPIC, "closed");

What am I missing?