I’m building my own IP camera based on the ESP32 WROVER-E.
I use CameraWebServer library which provides urls to capture and stream video.
I use IP Camera binding in openHAB to connect the camera and it works fine.
I also have a PIR sensor in my camera. Right now I use MQTT to provide information about motion detection to openHAB, but it makes my project quite complex. I would like not to use MQTT and replce it with a simple url. I found that openHAB IP Camera binding has some options to handle motion detection, like “Alarm Input URL”. How can I use this field? Is there a better way to do this?
As I understand it, your camera needs to provide a URL for the binding to check to see if there is a motion alarm. Obviously there will be some delay. And not all of the Things support that channel. I can’t tell if the ESP32 Things do or not.
Otherwise, you could configure the IP camera binding to do the mission detection locally using ffmjpeg.
Another option will be to have the camera call OH’s REST API to update an item, but it will have to use an auth token or basic auth and use a POST, not a GET.
In my experience, your project will be no less complex if you drop MQTT. It will just move the complexity and move your system away from standards to a bespoke and custom config.
It can be done you just need to supply the ipcamera. Mjpeg url to use as the ffmpeg input and change the options to allow mjoeg streams with the setting mentioned in the ipcamera docs. The esp32 camera can only supply a single stream so you need to use the bindings ability to copy and serve multi STREAMS if you want to watch a stream and do motion detection at the same time.
This thread has helpful back ground and the changes are merged.
Edit. To work out if you want to explore this I should mention it uses around 15% cpu non stop on my Arm based odroid n2+ to handle this but it may be lower if it’s a 1fps frame rate stream. A lower PI is going to use more so you have to factor in if the load is worth while for you.
Personally I prefer a real camera with built in. Ight vision and motion detection as they don’t really cost that much more then a esp32 camera. Especially second hand.