The Universal Device Management Interface (UDMI) provides high-level specifications for the management and operation of physical Internet of Things systems. This data is usually exchanged with cloud entities that can maintain "digital twins" or "shadow devices" in the cloud. It is nominally used with Googe's Cloud IoT Core, and as an architecture, it can be applied to any data set or hosting setup. In addition, the architecture provides provisions for basic telemetry ingestion, such as the flow of data points from IoT devices.
In this tutorial we'll see step by step how to implement UDMI using the connectors Framework.
8. Type this commands to generate a public/private keys.
openssl req -x509 -newkey rsa:2048 -keyout rsa_private.pem -nodes -days 36500 -out rsa_cert.pem -subj "/CN=unused"
And
openssl pkcs8 -topk8 -inform PEM -outform DER -in rsa_private.pem -nocrypt > rsa_private_pkcs8
These commands will generate 3 files we will need 2 of them:
UDMI specification uses custom format for messages exchanged between the cloud and the device
Example:
{ "version": 1, "timestamp": "2018-08-26T21:39:29.364Z", "points": { "reading_value": { "present_value": 21.30108642578125 } } } |
Example:
{ "version": 1, "timestamp": "2018-08-26T21:39:29.364Z", "system": { "make_model": "ACME Bird Trap", "firmware": { "version": "3.2a" }, "last_config": "2018-08-26T21:49:29.364Z", "operational": true, "statuses": { "base_system": { "message": "Tickity Boo", "category": "device.state.com", "timestamp": "2018-08-26T21:39:30.364Z", "level": 600 } } }, "pointset": { "points": { "return_air_temperature_sensor": { "units": "Celsius", "status": { "message": "Invalid sample time", "category": "device.config.validate", "timestamp": "2018-08-26T21:39:28.364Z", "level": 800 } } } } } |
Example:
{ "version": 1, "timestamp": "2018-08-26T21:39:29.364Z", "system": { "min_loglevel": 500 }, "gateway": { "devices": { "AHU-123": { "protocol": "bacnet", "local_id": "327412" } } }, "pointset": { "points": { "nexus_sensor": { "fix_value": 21.1 } } } } |
On the message value template put the udmi template below
{ "version": 1, "timestamp": "$(timestamp)", "points": { "$(pointId)": { "present_value": $(pointValue) } } } |
On the state template use.
{ "version": 1, "timestamp": "$(timestamp)", "system": { "make_model": "$(deviceName)", "firmware": { "version": "1" }, "statuses": { "base_system": { "message": "$(deviceStatus)", "category": "device.state", "timestamp": "$(timestamp)" } } }, "pointset": { "points": { "$(pointId)": { "status": { "message": "$(pointStatus)", "category": "point.state", "timestamp": "$(timestamp)" } } } } } |
For commands we use this template and SFormat to extract the json information needed.
{ "version": 1, "pointset": { "points": { "nexus_sensor": { "value": 21.1 } } } } |
Congratulations you finished the tutorial for more information check the connector documentation.