23.09.2015, 06:44
Try this, it should fetch values for the given trend for the last hour with one minute resolution:
Code:
require('genohm-scada.trends')
time = os.time()
date = {
stime = time - 3600,
etime = time,
}
values = trends.fetch('My Trends Name', 'hour', date)
for _, data in ipairs(values) do
value = data[ 2 ]
date = os.date('%Y.%m.%d %H:%M', time)
log(date, value)
time = time + 60
end