The ESP32-Cam already has a feature-rich demo named CameraWebServer. This repo further adds several useful features to it. The core is the support of Alexa voice commands. We used a modified version of this repo to emulate a Wemo plug. Eventually one can say "Alexa turn on camera one" and then receive a notice from IFTTT on the phone. The rich notice contains a thumbnail to the captured photo, and tapping it leads to the ESP32-Cam server.
This repo is for information only as is. Due to the limit of time, the author provides minimal support. Please raise all questions in the issues, and I will try to answer that if time permits.
- Clone the repo. Open the
CameraWebServer.ino
. - Download the code from this repo as a zip file. And add this zip file to the library using Sketch -> Include Library -> Add .zip library in Arduino IDE.
- Change related configs, especially the ssid, password, etc. You may need to read the code to understand what the config means.
- In Alexa app, discover new devices (choose Wemo Plug). It should discover a new device with the name as set in
alexa_name
. - In IFTTT, set up an applet that if receive a WebHook as in the variable
ifttt_event
(e.g.richnotice
), then send a rich notice to the phone. Putvalue1
in the title,value2
in the image, andvalue3
in the link. You also need to get the WebHook key and fill it inifttt_key
in the code. - Compile and upload.
In order to achieve this, we made the following changes:
- Integrate with the mDNS libaray to get rid of the hard coded IP.
- Integrate with the esp32-alexa-wemo-emulator libaray. Since Wemo PnP needs port 80, we have to move the camera server to 8080 and 8081. In addition to change the C code, this also involves changing the index.html, gzipping it, and putting it in
camera_index.h
. - Running Wemo daemon and AsyncWebServer didn't work out of the box, considering they both have separate message queues. Fortunately ESP32 has two cores, so we have to pin each task to a core, and let them run in parallel. This works, but the system gets more sensitive on the power supply. It seems to draw more current and heats more when both cores are used.
- "Alexa turn on the camera" won't do anything if the device is already on. And memorizing the device's state is quite unpractical. So we added code to manually turn off the device immediately after it executes the turning on callback. This makes "alexa turn on the camera" always work. That's why we need a modified version of esp32-alexa-wemo-emulator.
- In order to get good streaming speed, it's highly suggested to get an external antenna.
This repo also provides some useful utilities: