Problem description
Sometimes your devices sends a measurement in a unit which your user cannot interpret or understand. E.g. the device sends 5 unit a. By interpreting this, some people wants to see the values not as unit a they want to see them as unit b.
A different Scenario would be that your device sends for example 5 mV (milli Volt) and you need to convert this to meter or inches or kilogram.
There are some questions out of this which you need to answer yourself.
- in which unit are you storing the measurement in the platform.
- which are the unit my users want to see
- where do I mange and maintain the unit conversion from UI-perspective
- how often do I need one measurement in the platform
Assumption
It is assumed that the device sends a unit which cannot be changed on the device.
How to convert
Several options are available to solve this.
Option 1
This option uses a self developed micro service which receive the measurement from the device and uses one or multiple managed objects to convert the unit.
Option 2
This option uses a self developed micro service which polls for a new measurement from the device and uses one or multiple managed objects to convert the unit to create a second measurement.
Option 3
This option uses a self developed Apama code to poll for a new measurement from the device and uses Apama Memory to convert the unit to create a second measurement.
Option 4
This option uses a self developed Apama code to receive a new measurement from the device directly to CEP Engine and uses Apama Memory to convert the unit to create a the measurement.
Option 5
This Option uses a self developed UI Application which will do the unit conversion every time the user access the measurement.
Conclusion
Out there are different kind of devices with a Hugh variety of measurement type’s. I would differ them into categories.
- Devices which can send a measurement in Cumulocity style like where the unit and value already made Cumulocity ready on the Agent side
"c8y_SpeedMeasurement": {
"Speed": { "value": 1234, "unit": "km/h" }
}
- Devices which can send a measurement in Cumulocity style like where the unit and value already made Cumulocity ready on the Agent side but the unit need to be convert to the users extend
"c8y_BatteryLevel": {
"level": { "value": 1234, "unit": "mV" }
}
- Devices which can send only values to the platform and based on some additional information (stored in a managed object) the value needs to converted into a measurement with a converted value and an unit. e.g a sensor sends the value of 12 and the system needs to convert this 12 mV into a distance of 10 cm.
"c8y_Compression": {
"comp": { "value": 12}
}
try find the best solution for your use case. My intention was to give you something on the hand to solve this problem.
Top comments (0)