Skip to content

reolink(nvr): ONVIF push-based motion for Home Hub battery cameras - #2070

Open
SnoElement wants to merge 1 commit into
koush:mainfrom
SnoElement:reolink-onvif-hub-motion
Open

reolink(nvr): ONVIF push-based motion for Home Hub battery cameras#2070
SnoElement wants to merge 1 commit into
koush:mainfrom
SnoElement:reolink-onvif-hub-motion

Conversation

@SnoElement

@SnoElement SnoElement commented Jun 21, 2026

Copy link
Copy Markdown

Fixes #2072.

Problem

Battery/solar cameras behind a Reolink Home Hub (Pro) sleep to save power. While asleep, the hub answers the GetMdState/GetAiState polling the NVR client relies on with "device offline", so motion never reaches Scrypted/HomeKit and HomeKit Secure Video never records. The hub does, however, push these events over ONVIF PullPoint.

Change

Adds an opt-in ONVIF push path for hub channels:

  • onvif-api.ts: extract the source-channel token from each event (<tt:Source> SimpleItem VideoSourceConfigurationToken/Source/VideoSourceToken), interpret the topic into a motion flag + optional object class, and emit a separate channel-aware onvifChannelEvent (motion, class, channel). The existing onvifEvent / event / data emissions are left unchanged, so this is purely additive and existing consumers are unaffected.
  • nvr.ts: open one hub-level PullPoint subscription and route each event by channel to the matching camera, mapping Reolink rule topics (People/Vehicle/DogCat/Face/Package + CellMotion/MotionAlarm) to motion and an optional ObjectDetector class. Raw event XML is logged only when Debug Events is enabled.
  • camera.ts: a "Use ONVIF for Object Detection" control that registers the channel, plus a debounced triggerOnvifMotion() that sets motionDetected and fires the ObjectDetector event (gated on the camera's advertised classes).

Validation

We made these changes to get the plugin working on our own setup — a Reolink Home Hub Pro with sleeping battery cameras — and have confirmed success in day-to-day use. Person/vehicle/motion events now arrive over the push subscription and trigger HomeKit recordings where polling returned "device offline".

Notes

  • Related: Reolink nvr #1947, Reolink Doorbell not Sending Notifications via Scrypted #1642.
  • Known limitation (documented in code as a follow-up): there is no plugin-level liveness watchdog yet — if the onvif library's pull loop wedges on a non-retryable error, the subscription isn't auto-restarted. Acceptable for the initial opt-in; flagged for a follow-up before relying on it as the sole motion source for sleeping cameras.

🤖 Generated with Claude Code

Battery/solar cameras behind a Reolink Home Hub (Pro) sleep to save power.
While asleep the hub answers the GetMdState/GetAiState polling the NVR client
relies on with "device offline", so motion never reaches Scrypted/HomeKit and
HomeKit Secure Video never records. The hub does, however, push these events
over ONVIF PullPoint.

Add an opt-in ONVIF push path for hub channels:

- onvif-api.ts: extract the source channel token from each event
  (<tt:Source> SimpleItem VideoSourceConfigurationToken/Source/VideoSourceToken),
  interpret the topic into a motion flag plus an optional object class, and emit
  a separate channel-aware 'onvifChannelEvent' (motion, class, channel). The
  existing 'onvifEvent'/'event'/'data' emissions are left unchanged, so this is
  purely additive and existing consumers are unaffected.
- nvr.ts: open ONE hub-level PullPoint subscription, route each event by
  channel to the matching camera, mapping Reolink rule topics
  (People/Vehicle/DogCat/Face/Package + CellMotion/MotionAlarm) to motion and
  an optional ObjectDetector class. Raw event XML is logged only when
  'Debug Events' is enabled.
- camera.ts: add a 'Use ONVIF for Object Detection' control that registers the
  channel and a debounced triggerOnvifMotion() that sets motionDetected and
  fires the ObjectDetector event.

Validated on real hardware (Home Hub Pro, firmware-current) with sleeping
battery cameras: person/vehicle/motion events now arrive over the push
subscription and trigger HomeKit recordings where polling returned offline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reolink battery cameras behind a Home Hub don't report motion while asleep

1 participant