Please update library, This should work:
The result is mail with csv which has such content:
Code:
require('user.trends_pro')
-- Export data
name = 'Kitchen_Temperature'
dates = {}
dates['start'] = { year=2017, month=4, day=5, hour=0}
dates['end'] = "now"
name, csv = trend_export(name, dates, 'csv')
-- Send an email with data
attachement = { {filename=name .. '.csv', filedata=csv, mimetype='text/csv'} }
mailattach('example@gmail.com', 'Report from trend ' .. name, 'CSV file attached', attachement)
script.disable(_SCRIPTNAME)
The result is mail with csv which has such content: