![]() |
|
temperature not reach setpoint - Printable Version +- LogicMachine 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: temperature not reach setpoint (/showthread.php?tid=1739) |
temperature not reach setpoint - Thinklight - 21.11.2018 Hy, Maybe is same example script. I need script if real temperature difference is more then 1 degree of set point in 24 hours need to send alert. RE: temperature not reach setpoint - admin - 21.11.2018 You need two scripts: 1. Event script mapped to a tag (for both setpoint and current temperature). For each object update, check if delta is within limits or not. If delta is ok, put current timestamp in storage: Code: temp = grp.getvalue('1/1/1')
setp = grp.getvalue('1/1/2')
delta = math.abs(temp - setp)
if delta <= 1 then
storage.set('last_update', os.time())
storage.set('notified', false)
end2. Scheduled script which will check time difference between now and last_update key (in seconds): Code: prev = storage.get('last_update', 0)
delta = prev - os.time()
if delta >= (24 * 60 * 60) then
notified = storage.get('notified')
if not notified then
-- send e-mail here
storage.set('notified', true)
end
endRE: temperature not reach setpoint - Thinklight - 21.11.2018 Thanks for your help
|