Here you have what you looking for
I've tested Trends API some time ago and I've found that to have some data from today you must type not today timestamp but tomorrow and also 1 day before. The last value is the last measured value before midnight e.g. for 5minute resolution 23:55. For taking your maximum resolution you can type instead 86400 only 1. And then you should define undefined value from RRD db and ylou should look from 00:00 to first data which will appear

Code:
require('trends')
-- get data for today
function returnLastTrendValue(trendName)
dates = {}
dates['start'] = os.date('*t')
dates['start'].day = dates['start'].day - 1
dates['end'] = os.date('*t')
dates['end'].day = dates['end'].day + 1
trends.NaN = '*'
-- fetch previous value
daily = trends.fetch(trendName, dates, 1)
i = #daily
while i > 0 do
if daily[i] ~= '*' then return daily[i] end
i=i-1
end
end
lastValue = returnLastTrendValue('Your trend name')
log(lastValue)
I've tested Trends API some time ago and I've found that to have some data from today you must type not today timestamp but tomorrow and also 1 day before. The last value is the last measured value before midnight e.g. for 5minute resolution 23:55. For taking your maximum resolution you can type instead 86400 only 1. And then you should define undefined value from RRD db and ylou should look from 00:00 to first data which will appear
