Datapoint Localization

Datapoint Localization

Datapoint Presets are available with SmartServer 2.8 and higher.

Datapoint localization are discussed in Connections and Datapoint Objects property table.

Datapoint localization transforms a datapoint value to a specific localized value and datatype, based on the localization rules.  A global setting selects SI or US units.  For example, when SI is selected, temperatures are reported and accepted in Celsius, and when US is selected, temperatures are reported and accepted in Fahrenheit.

This page contains the following sections:

Using Localization and Presets Together

You can use both localization and presets properties at the same time or by themselves.  When presets and localization are set for a datapoint, the presets map is configured based on the local value.  So when you get an update, the value needs to be localized first before mapping to a preset string.  Same with the other direction, when users input a preset string, the map value needs to be transformed using the reverse transformation rule to get the IAP value. 

The Localization Object

The localization object describes the localization transformation. 

  • Localization is optional. If the source/destinations do not have localization, the localization object is set to an empty object or null.

  • The localization object contains the transformation rules.

  • The presets object is submitted with the connection object’s create or update actions and stored in the connection configuration objects.

  • The localization object is not stored in the connection object’s status.

The following table describes the location object properties:

Field Name       

Type              

Description

Field Name       

Type              

Description

source

Object. 
The localization rules object for the source segment.

The source localization rule is global for all the datapoints sources.  The source object is empty if there is no localization rule.

{                                                         

"value": {
   "transform": "$.value * 0.5"
},
"state": {
 "transform": "$.state"
}
}

destinations

List.
Items are the localization transformation rules used in the destination segment.

The datapoints localization is based on optional transformation rules that connect elements of source properties to destination properties. 

The source object is empty if there are no destination presets.

[                                                           
null,
{
   "value": {
     "transform": "$.value * 0.5"
   },
   "state": {
     "transform": "$.state"
   }
},
null,
null,
null
]

In the following example, the data will not be sent to the destination segment.

repeatLOC

Boolean

The repeatLoc property is set to true if the localization rule specified (in the first index) is used for all the destinations. If repeatLoc is set to false, the localization rule only applies to the specific destinations.

Default is False if undefined.

The following example shows a case where only the second destination uses localization.

{                                                           
   destinations: [
 null,
 {
    "value": {
     "transform": "$.value * 0.5"
  },
    "state": {
     "transform": "$.state"
    }
 },
  null,
 null,
 null
],
repeatLoc: false
}

The following example uses the same localization rule for all destinations.

destinations: [                                             
{
 transform: "$ * 0.15"  
}
],
repeatLoc: true // the localization rule is repeated
// in all destinations