Initiate attribute node
This node allows you to enrich the data coming from devices on the platform. You can rename parameters or calculate values using the Navixy Expression Language.
The node is named this way because after processing, the device parameters used within the node become attributes.
From IoT Logic Glossary:
A parameter is a metric that represents a characteristic of a device, telematics, or another system. It is transmitted by the device or another data source and decoded (parsed) by the IoT Logic.
An attribute is a specific piece of information utilized within an IoT Logic or in other words - this is renamed or recalculated parameter, inside the initiate attribute node.
There are two ways to use this node in a flow: after the Data Source node or another Initiate Attribute node. This lets you not only calculate device parameters but also calculate different attributes together.
The calculated attributes are added to all the usual tracker parameters after processing by the node. So, on output, you'll get a set of parameters and attributes for each device in the flow. If you only rename a parameter without any calculation, the new attribute will replace the original parameter on output.
Let’s move from theory to practice and examples.
Setting up the Node
To add the node, drag it to the flow workspace from the node menu on the left. Connect it to other nodes according to your usage scenario.
Then, open it by double-clicking on it. Here, you can add one or more new attributes.
Click "Add New Attribute" - a big blue plus button to open a window with several fields.
Let’s go over these fields to understand how and why they are used:
Attribute name: This is the name of the attribute that will be sent on output.
Value: Choose which tracker parameter or attribute you want to rename or calculate. For example, if you need to convert the CAN: speed value from kilometers to miles, you would enter
value('can_speed')/1.609
.Generation time: Choose how to calculate the time to be sent as the attribute's generation time.
Server time: Choose how to calculate the time which representing the attribute processing time in IoT Logic.
Let’s break down the time settings with examples:
If you want to send the current generation time in milliseconds for the calculated attribute, set
Generation time
tonow()
.If you want to send the time when the data was received by IoT Logic and adjust it to a different time zone, you would use
srvTime('can_speed', 0, 'valid') + 120000
, which adds 120,000 ms and changes the time zone.If you want to find the difference in time between the current and previous values and send it to the server, use
srvTime('avl_25', 0, 'valid') - srvTime('avl_25', 1, 'valid')
.You can also set the time to
null
to exclude it from the attribute output.
In our example, we created two attributes. We need to convert speed from kilometers to miles and calculate the difference between the last and second-to-last temperature readings. For speed, we won't send time data, but for temperature, we'll send the generation time from the tracker and the time received by IoT Logic in Unix Time.
Inside the initiate attribute node, the CAN: speed
parameter will be divided by 1.609 each time tracker provides it. On output, you’ll get the can_speed
parameter km/h in all parameters sent by the tracker to IoT Logic and the Speed mph
attribute in miles per hour, which will be added to the packet.
Additionally, a temp_data
attribute will be added, representing the difference between the current and previous temperatures received by IoT Logic. This attribute will include both generation time
and server time
.
Let’s also look at an example of renaming a parameter and see what we get on output. We’ll create another attribute and name it Tank fuel level
. We’ll set its value to value('can_fuel_1')
which is a shorten format of full name `value('can_fuel_1',0,'valid'
, and include the message generation time and server time in ISO 8601 format with expressions: dtFormat(genTime('can_fuel_1', 0, 'all'))
and dtFormat(srvTime('can_fuel_1', 0, 'all'))
, to avoid further conversion on the recipient side.
On output from the Initiate Attribute node, you’ll get the following:
The
Tank fuel level
attribute replaces thecan_fuel_1
parameter.The attribute includes generation and server times in ISO 8601 format.
Editing attributes
You can also edit attributes by clicking the pencil button near to it.
After the attribute edited, it won’t overwrite already collected data. All changes will be applied to the new data received from the source.
Deleting attributes
To delete unnecessary attribute, click the trash button near to it.
Once you finish with adding attributes, don’t forget to connect this Initiate attribute node to the Output Endpoint node, where the tracker parameters and attributes from the flow will be sent to the 3rd party applications or servers.