23.08.2023, 13:43
Try this, change test2 to your trend name.
Code:
require('trends')
-- get data for the past day
dates = {}
dates['start'] = os.date('*t')
dates['start'].day = dates['start'].day - 1
dates['end'] = os.date('*t')
-- fetch previous value
day = trends.fetch('test2', dates)
rain=0
-- for i = START, STOP, STEP
for i = 1, 48, 1 do
rain=rain + day[i]
end
log(rain)
------------------------------
Ctrl+F5
Ctrl+F5