Reeve Docs

Docs / Reference

Baby monitor

The baby monitor turns a household camera into an alarm. An administrator creates a profile that names a camera, says what the monitor reacts to (sounds, motion or both) and lists the people who may use it. Those people start a monitoring session from the Android app. The backend evaluates the camera's sound and motion events, decides when there is an alarm and pushes it to every phone that has a live session. A phone rings for a new alarm, and any phone can acknowledge it.

The backend decides what an alarm is. The phone only presents it and keeps a few obligations (see Phone obligations). The reasoning behind this split is in the architecture page.

Turning it on

The monitor is a deployment option, off by default:

BabyMonitor:
  Enabled: true        # environment variable: BabyMonitor__Enabled

The option is read once at start-up, so a change needs a restart. There is no switch in the web app or the phone. All options and their ranges are in the configuration reference.

Clients learn the setting without a second call: the features member of GET /api/auth/me, and the read-only HomeResponse.BabyMonitorEnabled. UpdateHomeSettingsRequest.BabyMonitorEnabled still exists. A value equal to the option is accepted and ignored, a different value answers 400.

While the monitor is off:

  • every /api/baby-monitor route answers 409 with errorCode: "baby-monitor-disabled",
  • the web navigation entry and the phone entry are hidden,
  • nothing is evaluated,
  • profiles stay in the database and work again when the monitor is turned back on.

Profiles

A profile describes one monitored room.

Field Rule
Name Required, unique, at most 100 characters, no control characters, trimmed
CameraDeviceId A logical device of type Camera that the editing user can view
SoundClasses At most 20 entries, each at most 64 characters, no control characters or commas, trimmed, duplicates ignored regardless of case
SoundSensitivity low, medium or high
SoundOverride Optional Count (1-20), WindowSeconds (1-300), MinConfidence (0-1). Replaces the sensitivity preset
MotionEnabled, MotionMinSeconds Motion rule on or off, and how long motion must last: 5-600 seconds (the web form defaults to 25)
QuietMinutes 1-60. How long without activity ends an alarm
ReminderMinutes Null (no reminders), or 1-120
MemberUserIds At most 100 users who may start sessions

A profile must react to at least one sound class or to motion.

The sensitivity presets are the sound rule when no override is set:

Sensitivity Detections Within Minimum confidence
low 3 15 s 0.7
medium 2 10 s 0.6
high 1 any 0.5

An override can ask for at most ceil(WindowSeconds / 2) detections, because a camera event without an identifier is counted at most once per two seconds (see Sound detections).

Each edit increments Version, including a change of members only. PUT accepts an optional expectedVersion. If it differs from the stored version the request answers 409 instead of overwriting a newer edit.

Errors: a duplicate name answers 409, an unknown profile 404, and validation failures, a missing camera or a camera the editor cannot view all answer 400. The camera errors are deliberately identical so the response does not reveal which devices exist.

Only a user being newly added to a profile must be active. A member who is disabled later keeps their place, but cannot use the profile (see Sessions).

Deleted and replaced cameras

If the profile's camera device is deleted, CameraDeviceId becomes null and the profile is kept. A camera that was replaced by a device-type change is treated the same way while the profile still points at it. Such a profile cannot run:

  • Saving a profile with a replaced camera answers 400, even for a rename. The editor must choose another camera.
  • Starting a session answers 404, a running session's next heartbeat answers 403 baby-monitor-access-revoked, and profiles/mine leaves the profile out.
  • An open episode ends with ended(profile-changed).
  • The profile shows an open model finding "The camera was replaced" (ModelFindingCount above zero in the response). Managers who also hold devices.view can read it at GET model-findings?objectType=babymonitor. Saving the profile with another camera clears it.
  • The retired camera is kept from clean-up while a profile names it.

The camera is only re-checked when the evaluator reloads profiles (ProfileRefreshSeconds, default 5 s), so a replaced camera can keep serving for that long. A manager cannot re-point or delete a profile while the monitor is off.

Permissions

babymonitor.manage allows creating, editing and deleting profiles and reading the helper endpoints. It is granted to Administrator and Power User. The grant is seeded once, so removing it from Power User sticks. Existing sessions pick up a new permission at their next sign-in.

Using a profile needs no permission code. A user may start a session when they are an active member and can view the profile's camera right now, including the camera's Hidden override and any time window.

API

All routes are under /api/baby-monitor. The profile routes need babymonitor.manage:

Endpoint Notes
GET profiles, GET profiles/{id} List and read
POST profiles, PUT profiles/{id}, DELETE profiles/{id} PUT takes an optional expectedVersion
GET candidates?cameraDeviceId= Users with their access to that camera: full, time-limited or none
GET sound-classes?cameraDeviceId= Sound classes the camera reported in the last 30 days, at most 50
GET profiles/{id}/live-sessions Who is watching: session id, user id and name, and the last four characters of the installation id. No push token. 503 while Redis is unreachable

candidates and sound-classes take the camera, not a profile, because the form needs them before the profile exists. The session routes are listed under Sessions.

Every create, update and delete writes an audit entry (babymonitor.profile.created, .updated, .deleted, scope babymonitor). An update records whether the camera changed and which members were added or removed. Session starts, heartbeats and acknowledgements are operational data and are not audited.

Sessions

A phone starts a session per profile. Each installation has one session per profile and user, so starting again replaces that installation's previous session. A profile allows 16 simultaneous sessions by default (BabyMonitor:MaxSessionsPerProfile). The session routes accept cookie-authenticated users only. A personal access token gets 401, and a bearer token next to a cookie gets 403.

Endpoint Success Notes
GET profiles/mine 200 Profiles the caller may use now
POST profiles/{id}/sessions 201 Body { "installationId": "..." } (up to 64 characters: letters, digits, _, -). Returns the session id, heartbeat interval, session lifetime and the current state
PUT profiles/{id}/sessions/{sid}/heartbeat 200 Renews the lease (90 s by default) and returns the state
DELETE profiles/{id}/sessions/{sid} 204 Always allowed for the owner. Ending a missing session also answers 204, another user's session 404
GET profiles/{id}/state 200 Current state
POST profiles/{id}/episodes/{episodeId}/acknowledge 202 409 baby-monitor-episode-not-current if the episode is not the current one
POST profiles/{id}/sessions/{sid}/test-alert 202 429 baby-monitor-test-rate-limited inside the cooldown (30 s by default)

A profile the caller cannot use answers 404. Reaching the session limit answers 409 baby-monitor-session-limit. Changes to a camera's Hidden override, roles or time windows reach a running session by its next heartbeat.

Heartbeat outcomes

Outcome HTTP errorCode When Phone does
ok 200 none All checks pass. The lease is renewed Reconcile ringing with the returned state
disabled 409 baby-monitor-disabled The monitor is off One notification, stop
session-unknown 404 baby-monitor-session-unknown The session expired, was deleted, belongs to another user or Redis lost it Start a new session. Failing for 60 s is reported quietly
access-revoked 403 baby-monitor-access-revoked The profile is gone, the caller is no longer an active member, or cannot view the camera now. The session is deleted One notification, stop
unavailable 503 baby-monitor-unavailable Redis failed Counts towards the 60 s link loss

If the access check itself errors or takes longer than two seconds (a database outage), the heartbeat renews the lease and logs a warning. Only a definite "no access" revokes.

State

The state response is the authority for a phone, whatever happened to the messages:

Field Meaning
Episode The current episode (id, start, trigger, sound class, last activity, ring count, acknowledgement), or null when calm
Health Camera problems currently listed: camera-offline, no-picture, motion-stuck
RecentEvents The last 20 episode starts, acknowledgements, endings and session starts
ServerTimeUtc Server time at the response
EvaluatorLastCommittedAtUtc When the evaluator last evaluated this profile. Null until the first evaluation

A non-null, unacknowledged Episode means ring. A null Episode means calm. For a profile with no stored state yet the response has a null Episode and a null EvaluatorLastCommittedAtUtc.

How alarms are decided

One replica of the cluster evaluates every profile once per second (BabyMonitor:EvaluatorTickMilliseconds). All working state is in Redis, so another replica takes over without losing episodes if the evaluating one goes away. Messages are sent only after the new state is stored, at most once per transition. A message that is lost is not repeated, because the phone also learns the state from its next heartbeat.

Sound events and motion flow in from the camera's plugin. The evaluator turns them into an episode: a stretch of activity with one alarm.

Motion

A motion sample is the camera's counted motion stretch at the motion gate (see camera media), not the camera's stored camera.motion state. Motion does not require the camera to be available, because the plugin's availability must not veto another source's motion.

A stretch lasts from the first report until about 6 s after the last one, and the reporter's own off-delay comes first. A stretch therefore outlives the movement by the off-delay plus 4 to 6 s. With Frigate's mqtt_off_delay: 5 that is roughly 9 to 11 s. For this reason the default MotionMinSeconds is 25. A long off-delay (Frigate's default is 30 s) makes short movements alarm, so set the minimum above the off-delay plus 6 s.

Motion must stay true across samples that are no more than 5 seconds apart. A longer gap restarts the run, and false motion resets it. Unknown motion (no reading, or Redis does not answer) neither extends nor resets a run. Motion that lasts 10 minutes is marked motion-stuck, stops counting as activity, and is reported once per run.

Sound detections

Every replica receives the camera's sound events, and one of them counts each detection for the matching profiles. The detection is counted once even when several replicas hear it:

Event Counted once per Window
Has an event id, raw payload or observed timestamp That event 60 s
Has none of these Camera and sound class 2 s

Two classes reported under one event id count once, and so do two identity-less detections of one class within two seconds. If Redis does not answer, every replica that heard the sound counts it.

A new profile, camera or sound class is picked up within BabyMonitor:CameraIndexRefreshSeconds (default 10). A camera whose event source has silently stopped looks the same as a quiet room.

A detection counts when its sound class is one the profile lists (ignoring case), it comes from the profile's camera, its confidence reaches the minimum (a missing confidence passes) and it is not more than 60 seconds old.

Episodes

Event Result
The configured number of detections arrives within the window An episode starts with trigger sound, and an alert is sent
Motion has been true for MotionMinSeconds An episode starts with trigger motion, and an alert is sent
More activity during an episode Extends the episode
No activity for QuietMinutes The episode ends (ended, reason quiet)
Unacknowledged, 5 minutes since the last ring, and activity since Re-rings (alert, higher RingCount)
Acknowledged, ReminderMinutes since the later of the acknowledgement and the last ring, and activity since reminder
First acknowledgement of the episode acknowledged goes to every phone
The profile's camera changes or is removed The episode ends (ended, reason profile-changed)

Acknowledging never ends an episode. A continuing cry after an acknowledgement does not start a new episode until the quiet period ends the current one. Re-rings and reminders need new activity after the previous ring, so they do not repeat on every tick. Other edits to a profile reset the counters of a calm profile and keep an open episode.

An acknowledgement that was accepted with 202 can still be ignored if the episode ended just before the next tick. Acknowledging an already acknowledged current episode also answers 202 and changes nothing.

Camera health

While a profile has a live session, the evaluator watches its camera and lists a fault in State.Health:

Reason Meaning
camera-offline The camera has no active source, or the active source is offline
no-picture The camera is online but its picture cannot be fetched
motion-stuck Motion has been true for 10 minutes

Camera faults never ring. Only motion-stuck is also sent as a health message. The phone reads faults from State.Health and posts one quiet notification.

A fault is raised after the camera has failed continuously for BabyMonitor:HealthFailingSeconds (default 60, range 2-600). It clears after the camera has been fine for half that time. A silence in the observations longer than 10 s (availability) or 75 s (picture) restarts the count, but a raised fault stays raised until the evaluator sees positive evidence that the camera is fine again.

The picture is checked every BabyMonitor:PictureProbeIntervalSeconds (default 30) for each camera of a profile that has a live session. The check requests a snapshot, or, for a camera that has none, asks whether a live stream can be negotiated. A camera whose plugin is not running counts as failing only after BabyMonitor:PictureProbeWarmupSeconds (default 180) following start-up or the plugin being enabled again.

An operator who disables or removes a camera's plugin has not broken the camera. Nothing is listed or sent in that case, and the monitor is blind until the plugin is back. Workload pauses, restarts and plugin updates keep the instance enabled and count as faults.

Delivery

Messages are SignalR calls to the method babyMonitor on DeviceUpdatesHub, sent to a per-user group. Only cookie-authenticated connections join the group, so personal access tokens never receive them. Each message names its ProfileId, and a client without a live session for that profile ignores it.

Kind Sent when To Fields
alert An episode starts, or re-rings while unacknowledged Everyone with a live session EpisodeId, RingCount, Trigger, SoundClass, ProfileName
reminder An acknowledged episode has new activity and its reminder interval passed Everyone with a live session EpisodeId, RingCount
acknowledged The first acknowledgement Everyone with a live session EpisodeId, SubjectUserId, SubjectDisplayName
ended The quiet period passed, or the camera changed Everyone with a live session EpisodeId, Reason (quiet or profile-changed)
health Motion held for 10 minutes Everyone with a live session Reason (motion-stuck)
revoked The recipient can no longer use the profile That user Reason (access), ProfileName
test A test alarm was requested The requesting user SessionId

SentAtUtc is the time of the evaluation that produced the message, the same value the state response returns as EvaluatorLastCommittedAtUtc. Messages and heartbeat answers arrive on different connections, so a client orders them by these times, never by arrival.

Access is checked for every recipient when sending. A recipient who definitely has no access gets one revoked instead of the message, and the server deletes their sessions for that profile. If the check fails or takes longer than a second, the message is delivered anyway, so a database outage never silences an alarm. Delivery of one dispatch is limited to 5 seconds. Whatever it cannot send reaches the phone through its next heartbeat.

A session that lapses without DELETE is dropped silently and nobody is told.

Test alarm

POST .../test-alert rings only the requesting session's own phone and never changes episode state. It is accepted for sessions of the caller only and is rate limited per session by BabyMonitor:TestAlertCooldownSeconds. A test request older than 60 seconds when the evaluator reads it is dropped.

Acknowledgement

POST .../acknowledge checks that the episode is the current one and queues the acknowledgement. The evaluator applies it on its next tick, which sends acknowledged. The phone that acknowledges stops its own ring at once and sends the call on a best-effort basis.

Phone obligations

The server cannot enforce these. A phone client must keep to them:

  • Ring only for a new, unacknowledged episode (an alert, or a heartbeat State that shows one) and for test. A reminder is a quiet notification.
  • Ring an episode once per phone, and remember which episodes it already rang for across restarts. Later RingCount values give one quiet notice.
  • Deduplicate alert and reminder by (EpisodeId, RingCount), since a message and a heartbeat can report the same ring.
  • Order episode inputs by their commit time. A heartbeat answer older than a message already applied must not end, acknowledge or re-ring the episode.
  • Read camera faults from State.Health only. Never ring for a problem: 60 seconds without the server, a stale evaluator, a camera fault or the phone's own watchdog each give one quiet notification and a status on screen.
  • Ring a test message only for the session it names. The hub group is per user, so other phones and web tabs of that user also receive it.
  • Treat 404 from POST sessions like access-revoked: one notification and stop.
  • Count 401, every 5xx including 503 and every network failure towards the 60 seconds of link loss.
  • On revoked or access-revoked, send DELETE for the session on a best-effort basis.
  • Judge the evaluator per profile. If the later of EvaluatorLastCommittedAtUtc and the session start's ServerTimeUtc is more than 60 seconds older than the response's ServerTimeUtc, the evaluator is not watching the profile. A null commit time means "not yet", not "missing".

Phone

The Android app runs the sessions. How it fits the app (background job, wake lock, notification channels, permissions) is on the mobile page.

  • Entry. Home and a launcher shortcut show "Baby monitor" while the monitor is on and profiles/mine is not empty. The screen shows one tile per running profile, up to four, with the camera picture, a sound toggle, the PTZ pad for users with devices.control, a status line and the recent events.
  • Full screen. The icon on a picture fills the screen. A ring, an alarm still waiting for OK and a lost camera or picture stay visible over it. The picture zooms with pinch (up to 4x), drag and double-tap.
  • Rings. A new episode and the test alarm ring on the alarm audio stream, so they get through a silenced ringer, for at most 60 seconds, with a full-screen alarm over the lock screen. OK stops the ring on this phone and acknowledges the episode, which stops the server's re-rings. Acknowledging on another phone does not stop a ring that is already sounding here, and a phone that has not rung never rings for an episode acknowledged elsewhere.
  • Readiness. A traffic-light screen checks notifications, the full-screen permission, exact alarms, battery optimisation, the alarm volume and Do Not Disturb. It never blocks Start.
  • Per phone settings. Alarm style, sound, alarm volume and an optional auto-stop time are stored on the phone and cleared when another user signs in.
  • Auto-stop. The run stops every session at the next occurrence of the chosen time (a time already past today means tomorrow). Changing the time while running re-arms it from that moment.
  • Alarm volume. 0 to 100 percent, 25 percent by default. At 0 the ring only vibrates and readiness shows a warning. The phone scales its own gain and never changes the system alarm volume, which therefore acts as a ceiling.

Managers see who is watching on each profile card in the web app (Watching now, refreshed every 15 seconds).

Failure behaviour

Failure Effect
Redis is unavailable Session routes answer 503 baby-monitor-unavailable. The evaluator cannot read or store state, so the profile is not evaluated and phones report that the monitor is not watching after 60 seconds. Sound detections are counted by every replica that hears them
The database is unavailable Sound evaluation continues against the cached profiles. Motion is unknown and the delivery access checks that fail let the message through with a warning. After a failed profile refresh the evaluator retries after at least 30 seconds and reads no motion until then
The evaluating replica stops Another replica takes over and continues from the stored state. Messages missed in the hand-over reach phones through the heartbeat state
No replica evaluates EvaluatorLastCommittedAtUtc goes stale and phones report it
A phone loses the server After 60 seconds it posts a quiet notification. It never rings for this

Redis keys for sessions expire on their own (session 90 s by default, state shortly after the last session and episode are gone), so turning the monitor off or deleting a profile leaves nothing to clean up.

The metric reeve_window_claim_errors_total counts Redis errors while claiming sound detections.

Limitations

  • While a camera's plugin is disabled the monitor is blind: no sounds, no motion and no picture check, and nothing on the phone says why.
  • A camera that only supports a WebRTC stream is judged by its availability alone and never raises no-picture.
  • A plugin call for the picture check that never returns keeps that camera's picture check failing until the backend restarts. The effect is a quiet no-picture status.
  • During a hand-over of the evaluator, two owners can send messages for different transitions that interleave on a phone for up to one heartbeat. A phone that orders by commit time can then ignore a late message.