A new property for a "thing" can be created by clicking "New" in the "Properties" section of the thing. A dialog box opens with the following settings:
Field | Required | Description | Dialog |
---|---|---|---|
Name | x |
Property name.
|
|
Type | x |
Property type:
|
|
Data Type | x | Property data type | |
Readonly |
If set, then property is read-only. Read-only property behavior depends its type:
|
||
Private | If set, then property value can be read only from methods/function/triggers within the thing. | ||
Nullable | If set, then "null" is acceptable as a property value. | ||
Description | Property description. | ||
After a property has been created, it can be edited anytime by:
If the Property type is "Script", a script must be created for it with set/get<PropertyName> script functions, as explained in Property Script. Note that a script property performs its management operations on another property value (persistent or remote) as it is accessed If the property type is "Remote", GadgetKeeper forwards the set/get requests to the physical Thing, and then the Thing either sends the property value back or updates it. |
|||
GadgetKeeper provides several convenient ways to access a property value. They can be accessed by UI, REST API, script function, or dashboard widget. Each method uses the same basic set/get functions. The "Property value" dialog box on the UI is explained here. To open the dialog box for "Property value":
|
|||
Field | Required | Description | Dialog |
Value | x | The current value of the property in persistent memory is displayed in the text area as the dialog box opens. The value shown can be changed by editing the text area or clicking "Generate value". |
|
Generate value | Clicking this automatically generates a random value with the property's selected data type. The new value is shown in the text area, but is not stored in persistent memory. | ||
Get | Clicking this retrieves the current value of the property in persistent memory and displays it. | ||
Set | If the property value was changed, clicking "Set" will store the new value in persistent memory, replacing the old one. | ||
All new property values (either edited or generated) must agree with the selected data type of the property. For script properties, the new value must also comply with any validation functions contained in the script.
The data type for a property can either be primitive, a JSON array, or a JSON data structure, as explained in Data Structures. The "Property value" dialog box for a structured data type is shown on the right. These types are arranged with fixed name/value pairs, as shown for the "ThermometerSettings" data type. If a script property is used to validate a property with this type, only certain data values are allowed. For more information, see Working with Structured Data types.
|