Defining Properties
The properties group is used to define the properties associated with an Edge Thing. While remote data properties can be read on demand, you can also define data push rules so that the data does not have to be polled by the ThingWorx Platform from the edge device.
A property is defined by specifying a name, baseType, pushType, the threshold for determining a data change push to the ThingWorx Platform, and any other necessary parameters.
* 
When these properties are bound at the ThingWorx Platform, it respects the template settings. However, if changes to the push and cache settings are made at the platform, those settings override the local template settings.
properties.IParametersnMemory_Imagelink = { baseType="IMAGELINK", pushType="NEVER",
value="http://www.thingworx.com" }
properties.InMemory_InfoTable = { baseType="INFOTABLE", pushType="NEVER",
dataShape="AllPropertyBaseTypes" }
properties.InMemory_Integer = { baseType="INTEGER", pushType="NEVER", value=1 }
properties.InMemory_Json = { baseType="JSON", pushType="NEVER", value="{}" }
properties.InMemory_Large_String = { baseType="STRING", pushType="NEVER",
value=string.rep("Lorem ipsum dolorsi ", 15000) .. "the end" }
properties.InMemory_Location = { baseType="LOCATION", pushType="NEVER",
value = { latitude=40.03, longitude=-75.62, elevation=103 }, pushType="NEVER" }
The following table describes the parameters for defining properties:
Use
To
properties.nameOfProperty
Declare a property.
baseType
Required. Specify the base type of the property.
dataChangeType
Provide a default value for the Data Change Type field of the property definition on the ThingWorx Platform, if the property is initially created using the Manage Bindings feature of ThingWorx Composer. Valid values include:
ALWAYS
VALUE
ON
OFF
NEVER
dataChangeThreshold
Provide a default value for the Data Change Threshold field of the property definition on the ThingWorx Platform, if the property is initially created using the Manage Bindings feature of ThingWorx Composer.
pushType
Specify whether the property should push new values upon change to the ThingWorx Platform. Valid values include:
ALWAYS
VALUE
NEVER
The default is NEVER.
A pushType of NEVER does not push data to the platform, so when a property with pushType=NEVER is queried on the ThingWorx Platform, the platform queries the software of the edge device for the data value.
A pushType of ALWAYS pushes the data every time the property is read at the edge device, which is determined by the scanRate parameter. If the scanRate is not set on the property, the scanRate from the Lua Script Resource configuration file is used. If not defined in either location, a default of 60000 milliseconds (1 minute) is used. The Edge device pushes all properties that have a pushType of ALWAYS and the same scan rate in one call, rather than make individual calls per property.
For NUMBER or INTEGER property types, a pushType of VALUE pushes data to the ThingWorx Platform only when the data value change exceeds the DataChangeThreshold setting.
pushThreshold
For properties with a baseType of NUMBER, and a pushType of VALUE. specify how much a property value must change before the new value is pushed to the ThingWorx Platform.
handler
Specify the name of the handler to use for property reads/writes. Valid values include:
script
inmemory
http
https
generator
The default handler is inmemory. The script, http, and https handlers use the key field to determine the endpoint where their read/writes are to be executed.
* 
Custom handlers can specify other property attributes. When a handler is used to read or write a property, the entire property table is passed to the handler.
key
Define a key that the handler can use to look up or set the value of the property. In the case of a script handler, this key is a URL path. For http or https handlers, this key should be a URL and not the protocol.
This parameter is not required for inmemory or nil handlers.
value
Specify the default value of the property. The value is updated as the value changes on the Edge device. The default value is 0.
time
Specify the last time the value of the property was updated, in milliseconds since the beginning of the epoch.
When things are created from this template, the current time is set automatically, unless a default value is provided in the definition of the property.
quality
Specify the quality of the value of the property. A default value should be provided for the quality. Otherwise, the value defaults to GOOD for properties without a handler, and UNKNOWN for properties with a handler.
scanRate
Specify the frequency of checking the property for a change event, in milliseconds. The default value is 5000 milliseconds (every 5 seconds).
If you do not define a scanRate, the scanRate in the Lua Script Resource configuration file is used. Defining the scanRate within the property overrides the scanRate setting in the configuration file. Refer to Configuring the scanRateResolution.
cacheTime
Initialize the cache time of the value for the property at the ThingWorx Platform. The default value is –1 if the dataChangeType is NEVER, and is 0 when dataChangeType is ALWAYS or VALUE.
If a value that is greater than 0 is specified, it is used by the ThingWorx Platform as the initial value for the cache time, and is applied only when using the browse functionality of ThingWorx Composer to bind the property.
Was this helpful?