Logic Machine Forum
Daily Electricity - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Daily Electricity (/showthread.php?tid=4344)



Daily Electricity - Tee_Trinker - 02.11.2022

Hey guys,
I have a question.
I have a Wiser and a Schneider iEM-iEM3155.
I would like to make a list of the daily electricity consumption.
So that the meter reading is compared every 24 hours and the consumption is calculated and everything is entered in a list (perhaps as text in the touch)
I'm a beginner at scripting and didn't get it right.
The count is a 14.4 byte
Thanks for Helping


RE: Daily Electricity - Dario - 02.11.2022

Hi Tee_Trinker,

I use this function into resident script every 5 seconds:

-----
local coeff, energy, sampligSec
sampligSec=5 -- 5 seconds of sampling
coeff = 60*(60/sampligSec)
energy=grp.getvalue(yourdata) -- Wh
power=grp.getvalue(yourdata) -- W

energy=energy+(power/coeff)
---

I hope this is good for you.


RE: Daily Electricity - admin - 03.11.2022

One option is to use trends and fetch data from them: https://openrb.com/docs/trends-new.htm. Alternatively you can use this script as a starting point: https://forum.logicmachine.net/showthread.php?tid=1175


RE: Daily Electricity - Tee_Trinker - 10.11.2022

(03.11.2022, 07:27)admin Wrote: One option is to use trends and fetch data from them: https://openrb.com/docs/trends-new.htm. 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:
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:
storage.set('kwh_usage_day_start', nil)
grp.write('32/2/1', 0)

and event script to power object Daily for Maximum
Code:
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