need to get the latest alert via http

rabittn

n3wb
Sep 2, 2014
26
7
Trying to pull the latest alert image in as its own camera in another application (Home assistant)

The closest thing i can find is using the url/alerts/@record and possible using the json interface to find the latest alert record number?

Am i missing something simple?
 
That’s how I do it.
1) use json to get the record# from the camera ... use the JSON cmd ‘camlist’ and from the result, use key [data][camid][lastalert];
2) use {ip-port}/file/clips/@record#[&session=session] to get the image... ‘&session=session’ may not be necessary
 
No need for a camlist command for this.

You're right. I should have suggested the more direct json 'alertlist' cmd
[cmd] => alertlist
[camera] => {shortname}
[session] =>xxxx

From the result, use key [data][0][path] ... The latest alert record is always the first one listed in the result, hence the [0].
The value of 'path' is like '@501384001.bvr', and it can be used directly in /file/clips/ HTTP command (i.e., no need to remove the '.bvr)
 
You can get the alert's thumbnail with /thumbs/path. For example /thumbs/@13891853512.bvr. It is a bit faster and usually more relevant than the first frame of the alert.
 
  • Like
Reactions: jaydeel
You can get the alert's thumbnail with /thumbs/path.

Thanks! Learned something new. .. HTTP command /thumbs/path with the same path does not show the same jpg as /alerts/path and /file/clips/path.

So I’m assuming the offset value is applied to when getting the thumbnail?
 
Thank you for your responses, however they seem to be over my head... I will see if I can come up with what you are saying should work.