It’d be great to be able to use the Ubiquiti Unifi G3 cameras as motion sensors as well. There is an API endpoint to get the last recording, which includes timestamps, e.g.:
https://my-nvr-instance:7080/api/2.0/recording?cause[]=motionRecording&startTime=1543097000000&sortBy=startTime&sort=desc
Will return something like:
{
"data": [
{
"eventType": "motionRecording",
"startTime": 1543097377388,
"endTime": 1543097395360,
"cameras": [
"deadbeef"
],
"locked": false,
"inProgress": false,
"markedForDeletion": false,
"meta": {...},
"_id": "..."
},
.....
],
"meta": {...}
}
Querying this API at regular intervals could yield:
- whether a motion event is happening now on a device (based on
inProgress
flag of each camera) - the last recorded motion event (based on the
endTime
from the latest entry of each camera) - a list of recordings from each camera
I’d be happy to try to develop this feature if someone would mentor me through the process of contributing.