Skip to content

video/Multi-dimensional-Sensor-Data#610

Open
WANGXIAOMIN-HIK wants to merge 20 commits intodevelopmentfrom
video/Multi-dimensional-Sensor-Data
Open

video/Multi-dimensional-Sensor-Data#610
WANGXIAOMIN-HIK wants to merge 20 commits intodevelopmentfrom
video/Multi-dimensional-Sensor-Data

Conversation

@WANGXIAOMIN-HIK
Copy link
Copy Markdown

…roposal, supporting multi-dimensional sensor data as metadata, events, and MQTT reports. Main changes include:

  1. Metadata Stream Support for Sensor Data:

    • Modified metadatastream.xsd, added SensorDataStream element and SensorData complex type to support XML representation of sensor data.
    • Defined core fields such as SensorType, SensorValue, and SensorUnit, along with necessary attributes and extension points.
  2. Sensor Event Topic Definitions:

    • Added sensor event topics in Core.xml, defining event topics related to temperature and humidity sensors.
    • Added standard structure descriptions for sensor event messages.
    • Provided XML and JSON examples for sensor events.
  3. MQTT Sensor Data Publication:

    • Added sensor data MQTT topics and JSON payload definitions in Analytics.xml.
    • Added SensorDataFilter element in event.wsdl to control sensor data topics published via MQTT.
  4. Sensor Capability Descriptions:

    • Added sensor data related capability description fields in analytics.wsdl, such as SensorDataSupport, SensorTypesSupported, and SensorMQTTSupport.

This PR provides detailed examples for temperature and humidity sensors, laying the foundation for future extensions to other types of sensors.

…roposal, supporting multi-dimensional sensor data as metadata, events, and MQTT reports. Main changes include:

1. **Metadata Stream Support for Sensor Data**:
   - Modified metadatastream.xsd, added SensorDataStream element and SensorData complex type to support XML representation of sensor data.
   - Defined core fields such as SensorType, SensorValue, and SensorUnit, along with necessary attributes and extension points.

2. **Sensor Event Topic Definitions**:
   - Added sensor event topics in Core.xml, defining event topics related to temperature and humidity sensors.
   - Added standard structure descriptions for sensor event messages.
   - Provided XML and JSON examples for sensor events.

3. **MQTT Sensor Data Publication**:
   - Added sensor data MQTT topics and JSON payload definitions in Analytics.xml.
   - Added SensorDataFilter element in event.wsdl to control sensor data topics published via MQTT.

4. **Sensor Capability Descriptions**:
   - Added sensor data related capability description fields in analytics.wsdl, such as SensorDataSupport, SensorTypesSupported, and SensorMQTTSupport.

This PR provides detailed examples for temperature and humidity sensors, laying the foundation for future extensions to other types of sensors.
```
@WANGXIAOMIN-HIK WANGXIAOMIN-HIK changed the title This PR implements the ONVIF Multi-dimensional Sensor Data Standard P… video/Multi-dimensional-Sensor-Data Jul 16, 2025
doc/Core.xml Outdated

<programlisting><![CDATA[Topic: tns1:Device/Sensor/temperature/High
Event description:
<tt:MessageDescription IsProperty="true">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the events(i.e tns1:Device/Sensor/temperature/High, tns1:Device/Sensor/temperature/Low, tns1:Device/Sensor/humidity/High, tns1:Device/Sensor/humidity/Low) are property events? which parameter in the event schema holds true/false values if it is property event?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the expert question! Regarding the sensor event types, we have indeed modified sensor events from property events to regular events.

Modification Rationale:
Sensor threshold trigger events (such as temperature/humidity High/Low) are essentially one-time trigger events that are reported only when sensor values exceed or fall below set thresholds. These events are more appropriately defined as regular events because:

  • They are not continuous property changes
  • They only occur when thresholds are triggered, with clear trigger timing
  • If upper-layer applications need continuous sensor data, they can obtain it through Metadata integration

Technical Implementation:

  • Changed IsProperty="true" to IsProperty="false"

<xs:sequence>
<xs:element name="SensorType" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="SensorValue" type="xs:float" minOccurs="1" maxOccurs="1"/>
<xs:element name="SensorUnit" type="xs:string" minOccurs="0" maxOccurs="1"/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any specific reason Sensor Unit is optional parameter?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the expert question! Regarding the sensor unit parameter, we have modified it from an optional parameter to a required parameter.

Modification Rationale:
Sensor units are essential parameters for upper-layer application business logic because:

  • Different sensors may use different units (e.g., temperature: °C/°F, humidity: %RH)
  • Upper-layer applications need unit information to correctly parse and display sensor data
  • Avoids data parsing errors caused by missing units

Technical Implementation:

  • Changed minOccurs="0" to minOccurs="1", making SensorUnit a required parameter

- Changed `IsProperty="true"` to `IsProperty="false"`
- Changed `minOccurs="0"` to `minOccurs="1"`, making SensorUnit a required parameter
Copy link
Copy Markdown
Contributor

@kieran242 kieran242 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read over the PR and like the ideas and have raised a couple of questions for clarity?

doc/Core.xml Outdated
</listitem>
</itemizedlist>

<para>The following event should be generated with true value when a temperature sensor detects a value exceeding the configured high threshold.</para>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WANGXIAOMIN-HIK You state "event should be generated with true value when a temperature sensor detects a value exceeding the configured high threshold." where has this high threshold value been defined on a Sensor?

Are all these sensors attached to a camera device or external to the device relaying the Metadata? i,e. is a Camera or NVR taking metadata from multiple device sources externally and raising metadata events like a relay or performing a triggered action based on the Metadata?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your thorough review and valuable questions!

1: Your Question: "where has this high threshold value been defined on a Sensor?"

Our Answer:
Your question about sensor threshold definition is very critical. Indeed, sensor events need to be triggered based on certain thresholds. In current implementations, these thresholds are typically configured through the following methods:

  • Device Application Hardcoding: Threshold values are hardcoded in device applications
  • Vendor Proprietary Protocols: Configuration through device vendor's proprietary protocols
  • Device Web Interface: Manual configuration through device's web management interface

We recognize the importance of clearly defining sensor event threshold configuration in the ONVIF standard. In the future, we will add related sensor event threshold configuration interfaces and mechanisms to the ONVIF standard to improve interoperability and configuration standardization, ensuring unified sensor threshold management across devices from different vendors.

2: Your Question: "Are all these sensors attached to a camera device or external to the device relaying the Metadata? i,e. is a Camera or NVR taking metadata from multiple device sources externally and raising metadata events like a relay or performing a triggered action based on the Metadata?"

Our Answer:
Our design supports multiple sensor integration modes. ONVIF devices (such as Camera or NVR) can support multiple external sensors connected via direct connection:

  • Gateway Mode: ONVIF devices primarily act as gateway roles, directly forwarding data received from external sensors as metadata to upper-layer applications
  • Event Trigger Mode: ONVIF devices can also report sensor data as ONVIF events when preset thresholds are reached, implementing triggered actions based on sensor data.

doc/Core.xml Outdated
<para>tns1:Device/Sensor/[SensorType] - Generic sensor event topic</para>
</listitem>
<listitem>
<para>tns1:Device/Sensor/temperature/High - Temperature too high event</para>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all topics should be Pascal cased so topics are standard. So it would be better to change them to

tns1:Device/Sensor/Temperature/High

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the expert question!
We made the following changes.

  1. Topic Naming Convention Adjustment
    Modification: Standardized Topic naming convention by capitalizing the first letter
  • tns1:Device/Sensor/temperature/Hightns1:Device/Sensor/Temperature/High
  • tns1:Device/Sensor/temperature/Lowtns1:Device/Sensor/Temperature/Low
  • tns1:Device/Sensor/humidity/Hightns1:Device/Sensor/Humidity/High
  • tns1:Device/Sensor/humidity/Lowtns1:Device/Sensor/Humidity/Low

2. MetadataStream Structure Optimization
3. Naming Simplification
4. Unit Description Enhancement
@WANGXIAOMIN-HIK
Copy link
Copy Markdown
Author

We would like to express our sincere gratitude to all the experts who provided valuable feedback and suggestions during the ONVIF Canada conference. Based on the discussions held during the conference, we have implemented the following four key modifications to the ONVIF sensor data standard:

1. Topic Naming Convention Adjustment

Modification: Standardized Topic naming convention by capitalizing the first letter

  • tns1:Device/Sensor/temperature/Hightns1:Device/Sensor/Temperature/High
  • tns1:Device/Sensor/temperature/Lowtns1:Device/Sensor/Temperature/Low
  • tns1:Device/Sensor/humidity/Hightns1:Device/Sensor/Humidity/High
  • tns1:Device/Sensor/humidity/Lowtns1:Device/Sensor/Humidity/Low

Modified Files: Core.xml (event topic list, MessageDescription examples, MQTT examples)

2. MetadataStream Structure Optimization

Modification: Moved SensorDataStream from Extension2 to be at the same level as VideoAnalytics, PTZ, and Event, elevating its importance in the metadata stream

  • Added <xs:element name="SensorDataStream" type="tt:SensorDataStream"/> after <xs:element name="Event" type="tt:EventStream"/>
  • Removed SensorDataStream element from MetadataStreamExtension2

Modified Files: metadatastream.xsd

3. Naming Simplification

Modification: Simplified sensor data related naming to improve readability and consistency

  • SensorTypeType
  • SensorValueValue
  • SensorUnitUnit

Modified Files:

  • metadatastream.xsd (XML Schema definitions)
  • Core.xml (MessageDescription and MQTT examples)
  • Analytics.xml (all documentation, XML examples, JSON examples)

4. Unit Description Enhancement

Modification: Added clarification for absolute temperature and absolute humidity to eliminate ambiguity

  • Temperature unit: "°C" or "°F" or "K" (absolute temperature)
  • Humidity unit: "%RH" (absolute humidity)

1. Schema Update: Add `SensorID` attribute to the `SensorData` complex type in `metadatastream.xsd`
2. Documentation Update: Update related examples in `Analytics.xml` and `Core.xml` to demonstrate multi-sensor data usage scenarios
Temperature unit: Kelvin
absolute humidity unit: g/m³
relative humidity unit: %
Copy link
Copy Markdown
Contributor

@kieran242 kieran242 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WANGXIAOMIN-HIK I will be happy to approve this

@ocampana-videotec ocampana-videotec added this to the 26.06 milestone Dec 4, 2025
Copy link
Copy Markdown
Contributor

@kieran242 kieran242 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WANGXIAOMIN-HIK I have re-reviewed all your latest changes and still happy to approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants