reolink(nvr): ONVIF push-based motion for Home Hub battery cameras - #2070
Open
SnoElement wants to merge 1 commit into
Open
reolink(nvr): ONVIF push-based motion for Home Hub battery cameras#2070SnoElement wants to merge 1 commit into
SnoElement wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2072.
Problem
Battery/solar cameras behind a Reolink Home Hub (Pro) sleep to save power. While asleep, the hub answers the
GetMdState/GetAiStatepolling 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>SimpleItemVideoSourceConfigurationToken/Source/VideoSourceToken), interpret the topic into a motion flag + optional object class, and emit a separate channel-awareonvifChannelEvent(motion,class,channel). The existingonvifEvent/event/dataemissions 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 optionalObjectDetectorclass. 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 debouncedtriggerOnvifMotion()that setsmotionDetectedand fires theObjectDetectorevent (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
🤖 Generated with Claude Code