Logic Machine Forum
Comparing values over time - 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: Comparing values over time (/showthread.php?tid=240)



Comparing values over time - FatMax - 02.03.2016

I´m looking to debug some issues with floor heating, and was thinking a script comparing two values and notifying me if the value difference is over 2 degrees over a period of 4 hours.

Does anyone have such a script or example? I´m not sure how to store, compare and overwrite the values over time...


RE: Comparing values over time - buuuudzik - 02.03.2016

(02.03.2016, 12:36)FatMax Wrote: I´m looking to debug some issues with floor heating, and was thinking a script comparing two values and notifying me if the value difference is over 2 degrees over a period of 4 hours.

Does anyone have such a script or example? I´m not sure how to store, compare and overwrite the values over time...

You can do it in this way:

1. Event-script for both GA's

Code:
delta_status = '1/2/3'
delta = t1-t2
if delta > 2 then
grp.write(delta_status, true)
else
grp.write(delta_status, false)
end


2. Resident-script or Scheduled-script

Code:
delta_status = 1/2/3
delta_table = grp.find(delta_status)

now = os.microtime()
time_max = 4*60*60 -- 4 hours
if (delta_table.updatetime - now) > time_max then
 -- alert function
end



RE: Comparing values over time - FatMax - 03.03.2016

Thanks! I'll try this out with some testing.