I'd like to store multiple readings from an arbitrary number of humidity sensors as persistent data. Of course I'd like to use the nifty dzVents built in statistical functions to be able to calculate an average over several readings etc.
My first script version stored data like this (The data is an array ) :
Code: Select all
-- Persistent Data
local multiRefObjects = {
} -- multiRefObjects
local obj1 = {
["humidityReadings"] = {
[1] = {
["data"] = {
[1] = 31;
[2] = 24;
};
["time"] = "2017-03-18 10:16:00";
};
[2] = {
["data"] = {
[1] = 31;
[2] = 24;
};
["time"] = "2017-03-18 10:15:00";
};
[3] = {
["data"] = {
[1] = 31;
[2] = 24;
};
["time"] = "2017-03-18 10:14:00";
};
};
}
return obj1
So this morning I started to look at another solution where think that the getValue function won't even be needed.
Code: Select all
local multiRefObjects = {
} -- multiRefObjects
local obj1 = {
["humidityReadings1"] = {
[1] = {
["data"] = 27;
["time"] = "2017-03-19 06:57:00";
};
[2] = {
["data"] = 27;
["time"] = "2017-03-19 06:57:00";
};
[3] = {
["data"] = 27;
["time"] = "2017-03-19 06:57:00";
};
};
["humidityReadings2"] = {
[1] = {
["data"] = 22;
["time"] = "2017-03-19 06:57:00";
};
[2] = {
["data"] = 22;
["time"] = "2017-03-19 06:57:00";
};
[3] = {
["data"] = 22;
["time"] = "2017-03-19 06:57:00";
};
};
}
return obj1Any ideas about how to do this the best way?
Cheers!