Migration Guide: Transitioning to new Data Table In Node
Context
We have redesigned and refactored the older implementation of the device data in the node to have several improvements. This guide will show us how to transition from the older implementation to the newer implementation of the device data in the node.
One of the primary drivers to refactor the Device Data In node is the introduction of our new internal message format.
Older Implementation
In the older implementation, we have a simple UI to select the labels only. Take note of the label selection.
This is an example of the message format from the older implementation:
{
"time": "2024-10-21T03:52:18Z",
"device": {
"id": "350457792797762",
"name": "350457792797762",
"driver": "smartmakers/digitalmatter-yabbyedge4g:1",
"labels": [
{
"id": 1,
"value": "Test",
"hide_nav": false
}
],
"state": {
"desired": {},
"reported": {
"firmware_version": "1.21",
"iccid": "89883030000070776874",
"imei": "350457792797762",
"product_id": 85,
"revision": 1,
"serial_number": "482177"
}
},
"telemetry_profiles": {
"supported_profiles": null,
"dynamic_profile_device_drivers_fields": {}
},
"auto_activated": true,
"custom_fields": {},
"created_at": "2024-10-18T04:20:57.689066Z",
"device_updated_at": "2024-10-21T03:49:20.281303Z",
"state_changed_at": "2024-10-21T03:51:58.517573Z",
"last_data_received": {
"received_at": "2024-10-21T03:52:18.63378297Z",
"raw": "7b22...3a317d"
},
"connectivity": {
"connections": [
{
"network_server_id": 7,
"network_device_id": "350457792797762",
"network_server": {
"id": 7,
"name": "DM"
}
}
]
}
},
"network_server": {
"Device": "350457792797762",
"Connection": "7"
},
"state": {
"altitude": 224,
"internal_battery_voltage": 4187,
"latitude": 24.027571126788914,
"longitude": 90.27235633672846,
"position_accuracy": 180,
"position_source": "LE-Wifi-Premium (Google Wifi)",
"position_source_code": 6,
"reason": "Elapsed time"
},
"errors": null,
"version": "3.1"
}
Newer Implementation
In the newer implementation, we introduced a new message format to properly segregate the different information, and allow the users to select specific information more easily:
{
// Network Specific Information for the data
"network": {
"server": {
"device_id": "0025ca0a00010008",
"connection_id": 93
},
"uplink": {
"time": "",
"network_server_time": "",
...
},
"latency": 23,
"dev_eui": "",
"errors": [],
"driver_id": "",
"ns_connection_id": "",
"ns_device": ""
}
},
// Device Specific Information for the data
"device": {
"id": "0025ca0a00010008",
"name": "Kitchen Roomsensors",
"driver": "",
"labels": [
{
"id": 12,
"value": "Label 12"
}
],
"telemetry": {
"profile": "dynamic",
"data": {},
"config": {},
"updated_at": "",
"last_position_at": ""
},
"auto_activated": true,
"custom_fields": {},
"created_at": "",
"device_updated_at": "",
},
// Decoded Information for the data
"data": {
"time": "2016-06-13T17:43:50.1004002Z",
"fields": {
"temperature": 20.4,
"humidity": 73.9,
"door-status": "locked"
},
"tags": {
"device_id": "0025ca0a00010008",
"device_name": "Kitchen Roomsensors"
}
},
...
}
The new message format is divided into 3 major sections:
Network information
Device Information
Decoded Data Information
The “Device Data In” node has been refactored to give the user the option to choose from the following options shown in the screenshot:
Example use-case:
In the new implementation, if you want to write data to a data table through the Data Table Out node reading data from the Device Data In, the Data Table Out node now expects a certain format to be fed in. Please refer to the node details page for example format.
The Data
option for the Device Data In node message format should fit in the format that is expected in the data table out node itself without doing any manual conversion:
{
"time": "2024-10-21T04:00:39Z",
"fields": {
"altitude": 224,
"internal_battery_voltage": 4187,
"latitude": 24.026906226941264,
"longitude": 90.2741861343384,
"position_accuracy": 180,
"position_source": "LE-Wifi-Premium (Google Wifi)",
"position_source_code": 6,
"reason": "Elapsed time"
},
"tags": {
"device_id": "350457792797762",
"device_name": "350457792797762"
}
}
Migration
If you want to write data from the Device Data In Node to the Data Table Out node directly during migration from the old implementation to the new implementation without doing any manual conversion, make sure the Message Format option is selected as Data
(by default selected).
Also, make sure that the label selection is also carried out after the migration, if not make sure to select the same label as the older implementation of the Device Data In node.