Wire automatic motion event lifecycle

This commit is contained in:
2026-03-08 15:15:00 +00:00
parent 72903a97eb
commit f6849f425c
3 changed files with 159 additions and 25 deletions

View File

@@ -53,10 +53,10 @@ export const api = {
end: (id) => request(`/streams/${id}/end`, { method: 'POST', body: JSON.stringify({ reason: 'completed' }) })
},
events: {
startMotion: () =>
startMotion: (payload = {}) =>
request('/events/motion/start', {
method: 'POST',
body: JSON.stringify({ title: 'Simulated Motion', triggeredBy: 'motion' })
body: JSON.stringify({ title: 'Simulated Motion', triggeredBy: 'motion', ...payload })
}),
endMotion: (id) => request(`/events/${id}/motion/end`, { method: 'POST', body: JSON.stringify({ status: 'completed' }) }),
finalizeRecording: (id, payload) => request(`/recordings/${id}/finalize`, { method: 'POST', body: JSON.stringify(payload) })