This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Reset counter object each month
#2
This is how i would do it

Add this as a event script to your total power consumption object.
Code:
kwhtot = event.getvalue()
kwhstart = 'kwh_usage_month_start'
kwhoutput = '2/2/2'

if storage.get(kwhstart) == nil then
 storage.set(kwhstart, kwhtot)
end

grp.write(kwhoutput, kwhtot - storage.get(kwhstart))

And this one as scheduled script with cron time 0 0 1 * * ,this would run 1 day every month.
Code:
storage.set('kwh_usage_month_start', nil)
grp.write('2/2/2', 0)

Mvh  Wink

Best regards, Jørn.
Reply


Messages In This Thread
Reset counter object each month - by Mr.D - 12.01.2018, 19:32
RE: Reset counter object each month - by Jørn - 13.01.2018, 22:19

Forum Jump: