diff --git a/crates/extensions/c8y_mapper_ext/src/converter.rs b/crates/extensions/c8y_mapper_ext/src/converter.rs index b85704f432b..9f8c52ef57d 100644 --- a/crates/extensions/c8y_mapper_ext/src/converter.rs +++ b/crates/extensions/c8y_mapper_ext/src/converter.rs @@ -1159,6 +1159,7 @@ impl CumulocityConverter { OperationType::FirmwareUpdate => { self.register_firmware_update_operation(&source) } + OperationType::DeviceProfile => self.register_device_profile_operation(&source), OperationType::Custom(c8y_op_name) => { self.register_custom_operation(&source, c8y_op_name) } diff --git a/crates/extensions/c8y_mapper_ext/src/operations/convert.rs b/crates/extensions/c8y_mapper_ext/src/operations/convert.rs index db155e8ec36..18bfbaed606 100644 --- a/crates/extensions/c8y_mapper_ext/src/operations/convert.rs +++ b/crates/extensions/c8y_mapper_ext/src/operations/convert.rs @@ -353,4 +353,25 @@ impl CumulocityConverter { MqttMessage::new(&topic, request.to_json()).with_retain() ]) } + + /// Converts a device_profile metadata message to supported operation "c8y_DeviceProfile" + pub fn register_device_profile_operation( + &mut self, + topic_id: &EntityTopicId, + ) -> Result, ConversionError> { + if !self.config.capabilities.device_profile { + warn!("Received device_profile metadata, however, device_profile feature is disabled"); + return Ok(vec![]); + } + + match self.register_operation(topic_id, "c8y_DeviceProfile") { + Err(err) => { + error!( + "Failed to register `device_profile` operation for {topic_id} due to: {err}" + ); + Ok(vec![]) + } + Ok(messages) => Ok(messages), + } + } }