@@ -378,6 +378,82 @@ c8y/measurement/measurements/create
378378
379379</div >
380380
381+ ### Measurement units
382+
383+ The Cumulocity mapper uses the measurement meta topics to attach units to measurement values.
384+
385+ The metadata for a measurement topic:
386+
387+ ``` mermaid
388+ graph LR
389+ te --/--- entity_id["<entity id>"] --/--- m --/--- measurement_type["<measurement type>"]
390+ ```
391+
392+ are to be published to the associated meta topic:
393+
394+ ``` mermaid
395+ graph LR
396+ te --/--- entity_id["<entity id>"] --/--- m --/--- measurement_type["<measurement type>"] --/--- meta
397+ ```
398+
399+ The idea is to describe in a single metadata message all the units of the measurements published under the measurement topic.
400+ This message uses the same shape as the measurements and is published as retained on the meta topic of the measurement topic.
401+
402+ ``` shell
403+ tedge mqtt pub -r ' te/device/main///m//meta' ' {
404+ "Climate":{
405+ "Temperature": {"unit": "°C"},
406+ "Humidity": {"unit": "%RH"}
407+ },
408+ "Acceleration":{
409+ "X-Axis": {"unit": "m/s²"},
410+ "Y-Axis": {"unit": "m/s²"},
411+ "Z-Axis": {"unit": "m/s²"}
412+ }
413+ }'
414+ ```
415+
416+ The measurements published to the topic for measurements of the same type:
417+
418+ ``` shell
419+ tedge mqtt pub ' te/device/main///m/' ' {
420+ "Climate":{
421+ "Temperature":23.4,
422+ "Humidity":95.0
423+ },
424+ "Acceleration":{
425+ "X-Axis":0.002,
426+ "Y-Axis":0.015,
427+ "Z-Axis":5.0
428+ }
429+ }'
430+ ```
431+
432+ are then forwarded to C8Y with their units.
433+
434+ ``` json
435+ {
436+ "type" : " ThinEdgeMeasurement" ,
437+ "Climate" : {
438+ "Temperature" : {"value" :23.4 ,"unit" :" °C" },
439+ "Humidity" :{"value" :95 ,"unit" :" %RH" }
440+ },
441+ "Acceleration" : {
442+ "X-Axis" : {"value" :0.002 ,"unit" :" m/s²" },
443+ "Y-Axis" : {"value" :0.015 ,"unit" :" m/s²" },
444+ "Z-Axis" : {"value" :5 ,"unit" :" m/s²" }
445+ },
446+ "time" :" 2025-09-03T10:05:47.226Z"
447+ }
448+ ```
449+
450+ - A message received on ` te/device/main///m/<type> ` uses the units defined on ` te/device/main///m/<type>/meta ` , if any.
451+ - If the unit for a measurement is unknown, the measurement value is simply sent with no unit.
452+ - Other metadata such as the precision or the min and max values can be attached to a measurement.
453+ However, these are ignored by the Cumulocity mapper.
454+ - ` "Temperature" ` , ` "Climate": { "Temperature" } ` and ` "Engine": { "Temperature" } ` can be given different units.
455+ - Units and all measurement metadata can be cleared by publishing an empty retained message on ` te/device/main///m/<type>/meta ` .
456+
381457### Events
382458
383459<div class =" code-indent-left " >
0 commit comments