Hi,
When i try to read multiple data with Resource.read()
in a edge action i get an error:
WARN Datahub.read: Failed to read from /app/environment/pressure
How can i fix it? Is it even possible?
Hi,
When i try to read multiple data with Resource.read()
in a edge action i get an error:
WARN Datahub.read: Failed to read from /app/environment/pressure
How can i fix it? Is it even possible?
Hi Lukas,
Here is an example:
var env_obj = JSON.parse(JSON.stringify(Datahub.read("/environment/value", 0)));
or
var env_obj = JSON.parse(JSON.stringify(Resource.readValue("/environment/value"));
var temperature = env_obj.value.temperature;
var pressure = env_obj.value.pressure;
var humidity = env_obj.value.humidity;
console.log("temperature = " + temperature);
console.log("pressuree = " + pressure);
console.log("hunidity = " + humidity);
Make sure the environment resource is enabled and the sample period is set.
Hi David,
Thank you very much for your answer. I have tested it and it works!