25.04.2020, 18:04
(13.01.2018, 22:19)Jørn Wrote: 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
Is it possible to add to this script another object '3/3/3' that registers the last maximum value of the object '2/2/2'? so we can visualize the last consumption of the previous month.
