13.01.2018, 22:19
This is how i would do it
Add this as a event script to your total power consumption object.
And this one as scheduled script with cron time 0 0 1 * * ,this would run 1 day every month.
Mvh
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

Best regards, Jørn.