evilmarty / mjpeg-timelapse

Mjpeg Timelapse integration for Home Assistant
MIT License
24 stars 4 forks source link

[Question] Use case #15

Closed e2m32 closed 1 year ago

e2m32 commented 1 year ago

Hi. This looks like an interesting project. I am wondering if it will work for my use case, and if so how to configure it properly.

I am currently using cctv-gif-buffer to store a buffer of images from my cameras. When there is an event (i.e. alarm triggered), I take a snapshot of the HA "camera" which requests a gif of the last 30 seconds from the cctv-gif-buffer server. That gif is downloaded to HA and sent in a notification to me. The nice thing about this is that it's always the previous 30 seconds before the event so I can see what triggered the event.

At my old house I had a photoeye on my driveway and when that would trip, I would get a gif of the object that tripped it. It was awesome. Even if it was a car driving fast, I could always see what it was. The downside of this implementation is that it takes a while to build the gif and send it to HA, so in order to make this work in HA, I had to customize the Generic Camera integration to allow for a longer timeout period before throwing an error. Since moving, I haven't messed around with this much, but now I am putting in the time to set up this new house. Since then many updates to HA have broken my custom Generic Camera, so I am looking for alternatives.

Will this integration work for me? I tried installing it, and it looks like the timelapse camera is showing me history, but when does it create a new mjpeg video? Is it just creating a new video every x seconds? So if I trigger a snapshot it may be the last x seconds or it maybe older than that? In my limited testing, it looks like the videos are a bit outdated...

evilmarty commented 1 year ago

I don't know if this component will serve your needs or not. Ultimately that's for you to figure out and decide. MJPEG is a misnomer format because it's not a file format but rather a protocol(s).

In regards to mjpeg_timelapse, it simply captures a JPEG from a URL periodically. It the. Uses Home Assistance built-in MJPEG streamer.

e2m32 commented 1 year ago

Ah. Thank you for the clarification. So the MJPEG streamer just plays back however many jpegs you have captured. So it keeps a buffer of images and then when the stream starts it just plays what's there. Does that mean that the stream is updated on the fly? If I am currently streaming, will it continue to update the most recent jpegs? I thought it was saving off recordings and I might miss the most recent event in the recording captured. It doesn't seem like you can create a snapshot with this though, but I could use this to stream to a mobile notification. I tried a snapshot and it failed. The error said I needed to provide a width parameter. I didn't try providing one though.

evilmarty commented 1 year ago

It will only update the playback images when one of the images does not exist anymore. This will cause it to fetch the list images again. You are welcome to submit a fix to allow taking a snapshot.