Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Functions Related to the Device the Parser is executed for.  All functions are optional. Not calling them will not change any data.


Access Field Fields of the Device. (Type: String)

Code Block
// Read only properties:
Device.name

Access the Address field of the Device. (Type: String)

Code Block
Device.address

Access the Tags of the Device. (Type: Array of Strings)

Code Block
Device.tags

Access the Serial field of the Device. (Type: String)

Code Block
Device.serial // String
Device.address // String
Device.tags // Array of Strings
Device.serial // String


Update the physical location of the sensor

Code Block
Device.setLocation(lon, lat)

...

Code Block
Device.setConfig("key", "value");

Get Configuration Value by Name:  (Configuration set for the Device in the Platform at the moment. Returns always the old Value. New Value that will be updated after the parser finished by "setConfig" calls are not considered.)

Code Block
// value is null if if the value is not set. 
// value type is string, number or bool. 
// Byte arrays are encoded as Base64 strings.
var value = Device.getConfig("key");


Set an arbitrary device property, displayed on the "Overview" tab of the device

...

Set the Sensor time of the current data record. Used for display, filter, sorting

The Timestamp must be in JS style and thus in milli seconds

Code Block
Record.setTime(new Date(timestamp_ms));


Note

When the parser output has a field called "time" on top level, it will be used like Record.setTime() was called

We might remove this in future. So always call Record.setTime() explicitly.



Get the time when the data was received by the server in ms, compatible with new Date(...).

...