Skip to content

Improve compatibility with Synology Surveillance Station's ONVIF implementation (Fix Motion Event Subscription) - #6

Open
erocm123 wants to merge 2 commits into
themactep:masterfrom
erocm123:master
Open

Improve compatibility with Synology Surveillance Station's ONVIF implementation (Fix Motion Event Subscription)#6
erocm123 wants to merge 2 commits into
themactep:masterfrom
erocm123:master

Conversation

@erocm123

@erocm123 erocm123 commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Improve compatibility with Synology Surveillance Station's ONVIF implementation.

image

This PR fixes several interoperability issues that prevented Synology from successfully discovering motion event capabilities, creating event subscriptions, and receiving motion events from Thingino ONVIF devices. The changes are limited to the affected ONVIF Media and Events operations and preserve existing behavior for other clients.

Changes

1. Allow unauthenticated GetEventProperties

Synology requests GetEventProperties before authenticating during camera discovery. Previously this request returned HTTP 401, preventing Surveillance Station from learning the supported event topics.

This PR classifies GetEventProperties the same way as the other ONVIF Events subscription lifecycle operations that are already handled as pre-auth requests.

Why this is safe

  • Only the authentication policy for GetEventProperties changes.
  • No event subscription or configuration operations become unauthenticated.
  • The remaining authentication behavior is unchanged.

2. Return a synthetic CreateProfile response for Synology mode

During camera setup, Synology always issues a CreateProfile request even though Thingino uses fixed profiles.

Previously this request returned a MaxNVTProfiles SOAP fault, causing Surveillance Station to abort camera setup.

When adv_synology_nvr is enabled, the server now returns a temporary synthetic profile (SynoProfileToken) instead of a fault. The profile exists only to satisfy the setup workflow and does not modify any real camera configuration.

Why this is safe

  • Only enabled when adv_synology_nvr is enabled.
  • No real camera profiles are created or modified.
  • Existing profile handling remains unchanged for other clients.

3. Allow deletion of the synthetic profile

After setup, Synology deletes the temporary profile it created.

The existing implementation correctly rejects deletion of fixed camera profiles, but now recognizes the synthetic SynoProfileToken and returns a successful DeleteProfile response only for that token.

Why this is safe

  • Only the synthetic profile can be deleted.
  • All actual camera profiles continue to return DeletionOfFixedProfile exactly as before.

4. Improve GetEventProperties topic generation

The generated ONVIF TopicSet now preserves the namespace for nested topic elements (for example, tns1:VideoSource/tns1:MotionAlarm) instead of only applying the namespace to the first level.

This matches the structure expected by clients parsing the advertised topic hierarchy.

Why this is safe

  • Only the XML namespace generation changes.
  • Event topics themselves are unchanged.
  • Existing topic names remain identical.

5. Advertise the standard VideoSource/MotionAlarm schema

For the VideoSource/MotionAlarm topic, GetEventProperties now advertises:

  • Source (tt:ReferenceToken)
  • State (xsd:boolean)

The existing CellMotionDetector/Motion schema remains unchanged (VideoSourceConfigurationToken / IsMotion).

Why this is safe

  • Only the advertised schema for VideoSource/MotionAlarm changes.
  • Existing CellMotionDetector/Motion clients are unaffected.

6. Match runtime event payloads to the advertised schema

Runtime PullMessages notifications now emit:

VideoSource/MotionAlarm

  • Source → Source
  • State → State

CellMotionDetector/Motion

  • Source → VideoSourceConfigurationToken
  • State → IsMotion

This keeps runtime notifications consistent with the metadata advertised by GetEventProperties.

Why this is safe

  • Only VideoSource/MotionAlarm payloads change.
  • Existing CellMotionDetector/Motion notifications remain unchanged.

Compatibility

These changes are intentionally narrow in scope.

  • Existing ONVIF operations are unchanged except where noted above.
  • Existing event topics remain available.
  • Existing CellMotionDetector/Motion notifications are preserved.
  • Fixed camera profiles remain immutable.
  • Synthetic profile handling is only enabled when adv_synology_nvr is enabled.

These changes were validated against Synology Surveillance Station and resolve camera discovery, event subscription, and motion event recognition while minimizing impact to other ONVIF clients.

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.

1 participant