21.03.2024, 08:16
How can I retrieve the energy consumption curve data?
I have created curves for energy consumption ( kWh in counter mode ) and i would like to display daily consumption as well as the consumption for the past 3 days. I would also like to do the same for months and years."
I have this script but only day work
require('trends')
os_date = os.date("*t")
os_end_date = {
year = os_date.year,
month = os_date.month,
day = os_date.day + 1
}
dates = {
['start'] = { year = os_date.year, month = os_date.month, day = os_date.day },
['end'] = { year = os_end_date.year, month = os_end_date.month, day = os_end_date.day },
}
--log(dates)
-- fetch current value
day = trends.fetchone(' Main ', dates)
--log(day)
grp.update('2/1/1', day)
month = trends.fetch(' Main ', dates)
--log(month)
grp.update('2/1/2', month)
I have created curves for energy consumption ( kWh in counter mode ) and i would like to display daily consumption as well as the consumption for the past 3 days. I would also like to do the same for months and years."
I have this script but only day work
require('trends')
os_date = os.date("*t")
os_end_date = {
year = os_date.year,
month = os_date.month,
day = os_date.day + 1
}
dates = {
['start'] = { year = os_date.year, month = os_date.month, day = os_date.day },
['end'] = { year = os_end_date.year, month = os_end_date.month, day = os_end_date.day },
}
--log(dates)
-- fetch current value
day = trends.fetchone(' Main ', dates)
--log(day)
grp.update('2/1/1', day)
month = trends.fetch(' Main ', dates)
--log(month)
grp.update('2/1/2', month)