Reads and returns the current value of a Resource.
This function is available in firmware 3.1.0+.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
path | String | Yes | The path is checked to be a valid Resource in the Data Hub and may one of two types: Regular Resources: - Actual Resources; must begin with a / .- These paths can be either absolute or relative. Absolute paths must begin with /app and are used without modification.- Relative paths are assumed to be with respect to /app and have /app prepended to them internally before use (e.g. The relative path argument: /myapp/mysensor/period is converted to the full path: /app/myapp/mysensor/period ).Virtual Resources: Resources created via the /virtual/config Resource. These are read using Datahub.read() and are written using the vr:// output tag in the return object. Each Virtual Resource behaves in a similar way to that of a global variable, and is accessible from all actions which belong to a particular device. These Resources are not visible between devices.- Variable names which do not contain any slashes / (i.e. no sub-directories).- When read, the terminating node /value is appended to the path. |
Returns
The current value of the Resource.
Example
Request
var result = Resource.readValue('/redSensor/light/value');
Response
988