diff --git a/ui-ngx/src/assets/help/en_US/rulenode/common_node_fields_templatization.md b/ui-ngx/src/assets/help/en_US/rulenode/common_node_fields_templatization.md new file mode 100644 index 0000000000..b32367ed52 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/rulenode/common_node_fields_templatization.md @@ -0,0 +1,9 @@ +Fields templatization feature allows you to process the incoming messages with dynamic configuration by substitution templates specified in the configuration fields with values from message or message metadata. + +There are two types of rule node configuration templates defined. + +*$[messageKey]* - templates with square brackets used to extract value from the message. + +*${metadataKey}* - templates with curly brackets used to extract value from the message metadata. + +Note: *messageKey* and *metadataKey* are just samples of key names that might exist in the message or metadata. diff --git a/ui-ngx/src/assets/help/en_US/rulenode/customer_attributes_node_fields_templatization.md b/ui-ngx/src/assets/help/en_US/rulenode/customer_attributes_node_fields_templatization.md new file mode 100644 index 0000000000..d7d1bb3104 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/rulenode/customer_attributes_node_fields_templatization.md @@ -0,0 +1,101 @@ +#### Customer attributes node fields templatization + +
+
+ +{% include rulenode/common_node_fields_templatization %} + +##### Example + +Let's assume that we have a customer-based solution where customer manage two type of devices: *temperature* and *humidity* sensors. +Additionally, let's assume that customer configured the thresholds settings for each device type. +Threshold settings stored as an attributes on a customer level: + + - *temperature_min_threshold* and *temperature_max_threshold* for temperature sensor with values set to *10* and *30* accordingly. + - *humidity_min_threshold* and *humidity_max_threshold* for humidity sensor with values set to *70* and *85* accordingly. + +Each message received from device includes: *deviceType* property in the message metadata +with either *temperature* or *humidity* value according to the sensor type. + +In order to fetch the threshold value for the further message processing you can define next mapping in the configuration: + +TODO: add node config screenshot instead of mapping below: + +source key -> target key + +${deviceType}_min_threshold -> min_threshold + +${deviceType}_max_threshold -> max_threshold + +Imagine that you receive message defined below from the *temperature* sensor +and forwarded it to the *customer attributes* node with configuration added above. + + - incoming message definition: + +```json + { + "msg":{ + "temperature":32 + }, + "metadata":{ + "deviceType":"temperature", + "deviceName":"TH-001", + "ts":1685379440000 + } + } +``` + +Rule node default configuration set to fetch data to the message metadata so the outgoing message would be updated to: + +```json + { + "msg":{ + "temperature":32 + }, + "metadata":{ + "deviceType":"temperature", + "deviceName":"TH-001", + "ts":1685379440000, + "min_threshold":"10", + "max_threshold":"30" + } + } +``` + +The same example for the *humidity* sensor: + +- incoming message definition: + +```json + { + "msg":{ + "humidity":32 + }, + "metadata":{ + "deviceType":"humidity", + "deviceName":"HM-001", + "ts":1685379440000 + } + } +``` + +Rule node configuration wasn't changed so the outgoing message would be updated to: + +```json + { + "msg":{ + "humidity":77 + }, + "metadata":{ + "deviceType":"humidity", + "deviceName":"HM-001", + "ts":1685379440000, + "min_threshold":"70", + "max_threshold":"85" + } + } +``` + +This example showcases using the *customer attributes* node with dynamic configuration based on the substitution of metadata fields. + + diff --git a/ui-ngx/src/assets/help/en_US/rulenode/msg_and_metadata_key_patterns_fn.md b/ui-ngx/src/assets/help/en_US/rulenode/msg_and_metadata_key_patterns_fn.md deleted file mode 100644 index e1fa4ab0db..0000000000 --- a/ui-ngx/src/assets/help/en_US/rulenode/msg_and_metadata_key_patterns_fn.md +++ /dev/null @@ -1 +0,0 @@ -#### Coming soon!