As long as water is still being used it resends the notification every minute.
The parameters will enable me to shower and water the garden without warning but will trigger when the fawcett gets stuck.
Okay, it's no rocket science but still would like to share.
Save the script below into script_time_waterwarning.lua and store into the domoticz/scripts/lua directory.
Don't forget to create the user variables first.
Code: Select all
-- Water leakage warning script
--
-- Send notification when there is water consumption of at least 1 litre per minute
-- for more then 10 minutes (this indicates a leakage or stuck toilet fawcett)
-- A notification will be sent every minute as long as the condition remains
-- Create user variables below before using this script
-- Uncomment print for debugging
--
-- Sensor:
-- Watermeter: 'Water' returning current total usage in liters
-- User variables:
-- LastWaterUsage (int): stores the total amount of water used uptil the previous minute
-- WaterUsageDuration (int): increments each consecutive minute of water usage
commandArray = {}
if ( tonumber(uservariables["LastWaterUsage"]) < tonumber(otherdevices_svalues['Water'])) then
commandArray['Variable:LastWaterUsage']= otherdevices_svalues['Water']
commandArray['Variable:WaterUsageDuration']= tostring(uservariables['WaterUsageDuration'] + 1)
if tonumber(uservariables['WaterUsageDuration']) > 10 then
commandArray['SendNotification']='Er is gedurende minstens 10 minuten water verbruikt!'
end
else
commandArray['Variable:WaterUsageDuration']= '0'
end
-- print(uservariables['WaterUsageDuration'],uservariables['LastWaterUsage'] )
return commandArray