Versions Compared

Key

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

...

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

Get Old 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
Device.getOldConfigValue("key");

//Returns anvalue Objectis of the following form: (Returns Null if no Config Value with matching Name was found.)
{
   "name":"testValue", //Name of the ConfigValue
   "value":"HELLO USER!", //Value set.
   "setValue":"2021-08-30T11:17:54.17557+02:00", //Timestamp when the Config Value was updated.
   "updatedAt":"2021-08-30T11:17:54.17557+02:00" //can be ignored. Timestamp when the ConfigValue was updated in the DB. 
} 

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

Code Block
Device.getOldConfig();

//Returns an Array of Objects of the following form: 
[
   {
      "name":"testString",  //Name of the ConfigValue 
      "value":"HELLO USER!", //Value set.
      "setValue":"2021-08-30T11:17:54.17557+02:00",
      "updatedAt":"2021-08-30T11:17:54.17557+02:00"
   },
   {
      "name":"testInt",  //Name of the ConfigValue 
      "value":21, //Value set.
      "setValue":"2021-08-30T11:17:54.17557+02:00", //Timestamp when the Config Value was updated.
      "updatedAt":"2021-08-30T11:17:54.17557+02:00"  //can be ignored. Timestamp when the ConfigValue was updated in the DB.  
   }
]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(...).

...