Skip to content

False positives: has_motion_event triggers on "motion ended" or idle status XML payloads #451

Description

@dev-rfc

The has_motion_event function incorrectly yields false positives because it only checks for the presence of topic strings and property names, completely ignoring the actual logical state (true/false) of the event.

In the current implementation, it uses simple strstr checks:

if (strstr(response, "CellMotionDetector") ||
    strstr(response, "PeopleDetector") ||
    strstr(response, "IsMotion") ||
    strstr(response, "IsPeople")) {
    return true;
}

Standard ONVIF WS-BaseNotification payloads include these topic names and property attributes in every single message, regardless of whether the state is transitionary or idle. For instance, when a camera reports that motion has stopped, or sends a status update, it transmits a payload containing Value="false" or Data=0, but still explicitly names the property:

<tt:SimpleItem Name="IsMotion" Value="false"/>

Because strstr(response, "IsMotion") evaluates to true here, the function returns true, causing the NVR to flag an active motion event when the scene is actually quiet.

The parsing logic needs to look for the actual assertion state. A quick substring approach could verify if Value="true" or Value="1" is tied to those attributes, though a minimal XML parsing check would be more robust to prevent matching standard metadata headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions