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.

Daily Electricity
#4
(03.11.2022, 07:27)admin Wrote: One option is to use trends and fetch data from them: https://kb.logicmachine.net/libraries/trends/. Alternatively you can use this script as a starting point: https://forum.logicmachine.net/showthread.php?tid=1175

it Works...Thank you!!!!

I use this one:
event script to power object
Code:
123456789
kwhtot = event.getvalue(32/1/30) kwhstart = 'kwh_usage_day_start' kwhoutput = '32/2/1' if storage.get(kwhstart) == nil then   storage.set(kwhstart, kwhtot) end grp.write(kwhoutput, kwhtot - storage.get(kwhstart))

then scheduled script with cron time 0 0 * * *
Code:
12
storage.set('kwh_usage_day_start', nil) grp.write('32/2/1', 0)

and event script to power object Daily for Maximum
Code:
1234
if event.getvalue('32/2/1') > grp.getvalue('32/2/2') then    grp.update('32/2/2', event.getvalue('32/2/1'))    grp.update('32/2/3', os.date('%d.%m.%Y')) end

looks like this
   
   
Reply


Messages In This Thread
Daily Electricity - by Tee_Trinker - 02.11.2022, 19:55
RE: Daily Electricity - by Dario - 02.11.2022, 20:11
RE: Daily Electricity - by admin - 03.11.2022, 07:27
RE: Daily Electricity - by Tee_Trinker - 10.11.2022, 12:47

Forum Jump: