need to get the latest alert via http

rabittn

n3wb
Joined
Sep 2, 2014
Messages
23
Reaction score
6
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?
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,133
Reaction score
1,241
Location
SF Bay Area
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
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,133
Reaction score
1,241
Location
SF Bay Area
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)
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,676
Reaction score
14,023
Location
USA
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.
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,133
Reaction score
1,241
Location
SF Bay Area
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?
 

rabittn

n3wb
Joined
Sep 2, 2014
Messages
23
Reaction score
6
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.
 
Top