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.

alert if water somewhere running
#1
I am connected over m-bus and get value "xxx m3" and if water somewhere running out meter not stops for example one hour I need get alert.
here is the scheduled script that runs every 5min:

-- current meter value
curr = grp.getvalue('1/1/1')
-- list of previous values
list = storage.get('water_meter_values', {})
-- add current value to list
table.insert(list, curr)

-- remove old values from the list (5 min * 12 = 1 hour)
while #list > 12 do
table.remove(list, 1)
end

-- delta between current value and value from an hour ago
delta = curr - list[ 1 ]
if delta > 123 then
-- run alert, send e-mail etc
end

-- save new value list
storage.set('water_meter_values', list)
Reply


Forum Jump: