Page 4 of 6
Re: Pushnotification when dishwasher/washing machine is read
Posted: Saturday 09 January 2016 5:43
by nayr
happy to report that my Washing Machine, Clothes Dryer and Dish Washer are all using this script with great success..
The Dish Washer has a 30min timeout and a consumption_lower of 0.1w, this way it dont ask me to open it and I get blasted in the face with steam.. it goes right to 0w when its done, no idling around at the end.
Dryer since it is gas is very steady and dont idle about at all waiting for stuff to drain, used the same values I did for the washing machine and it's been fine.
I put these appliances in the $HiddenDevices room, the on/off switch are useless in a day to day need.. but I do want them available for scripts, I have a flood sensor in the basement shoved down an emergency drain, if something leaks or my sewer pipe clogs (it happens) it will trigger the washers to shutdown, so they dont contribute to the flooding... I am thinking of making a virtual override switch to enable during spring lightning storms, disconnect all non-critical equipment for say 12h.. just for extra safety, but then perhaps im trying to hard to find a use for the on/off switch huh?
Wife Approval Factor is very high, if only because I am more likely to getup and change a load out now that I know its in there and ready.
Re: Pushnotification when dishwasher/washing machine is read
Posted: Thursday 28 January 2016 12:47
by Kjakan
Thanks for the scripts. Working great for my washing machine after some script modifications.
My clothes dryer have some issues and sometimes it's stopping before the dry program is finished. So I wanted to know how long the dryer been running before it stopped.
Created a simple function that gives me e.g. 1 hour and 5 minutes in notifications. This might be useful for others.
Code: Select all
function formatSeconds(seconds)
local hours = math.floor(seconds / 3600)
local seconds = seconds % 3600
local minutes = math.floor(seconds / 60)
local andTxt = ' and '
if hours == 1 then hoursTxt = ' hour' else hoursTxt = ' hours' end
if minutes == 1 then minutesTxt = ' minute' else minutesTxt = ' minutes' end
if hours == 0 then hoursTxt = '' hours = '' andTxt = '' end
if minutes == 0 then minutesTxt = '' minutes = '' andTxt = '' end
return hours .. hoursTxt .. andTxt .. minutes .. minutesTxt
end
function timedifference(s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
print(formatSeconds(7304)) --Result: 2 hours and 1 minute
--Send notification example
commandArray['SendNotification']='Dryer#Dryer has stopped after ' .. formatSeconds(timedifference(uservariables_lastupdate['YOUR_USERVARIABLE'])) .. '#0'
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Saturday 19 March 2016 23:00
by MaffeMuis
Thank you for this script! Works great for my washing machine!
Re: Pushnotification when dishwasher/washing machine is read
Posted: Monday 27 June 2016 23:22
by Plaagje
Kjakan wrote:Thanks for the scripts. Working great for my washing machine after some script modifications.
My clothes dryer have some issues and sometimes it's stopping before the dry program is finished. So I wanted to know how long the dryer been running before it stopped.
Created a simple function that gives me e.g. 1 hour and 5 minutes in notifications. This might be useful for others.
Code: Select all
function formatSeconds(seconds)
local hours = math.floor(seconds / 3600)
local seconds = seconds % 3600
local minutes = math.floor(seconds / 60)
local andTxt = ' and '
if hours == 1 then hoursTxt = ' hour' else hoursTxt = ' hours' end
if minutes == 1 then minutesTxt = ' minute' else minutesTxt = ' minutes' end
if hours == 0 then hoursTxt = '' hours = '' andTxt = '' end
if minutes == 0 then minutesTxt = '' minutes = '' andTxt = '' end
return hours .. hoursTxt .. andTxt .. minutes .. minutesTxt
end
function timedifference(s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
print(formatSeconds(7304)) --Result: 2 hours and 1 minute
--Send notification example
commandArray['SendNotification']='Dryer#Dryer has stopped after ' .. formatSeconds(timedifference(uservariables_lastupdate['YOUR_USERVARIABLE'])) .. '#0'
this is a great addition to my script! thanx!
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Friday 19 August 2016 14:03
by LovelessNl
This is probably a silly question, but how do you configure where the messages in the script (such as 'Washing Machine#The load in the washing machine has finsihed, please move it to the dryer' go? I
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Friday 19 August 2016 14:05
by LovelessNl
Ah never mind, thats obviously just the default config from Domoticz...
Re: Pushnotification when dishwasher/washing machine is read
Posted: Monday 03 October 2016 22:36
by Evelen
nayr wrote:modified your script a bit @ThinkPad to fix a lil bug,
copied the counter setup line from the first if statment, and added it to the second as an elseif condition:
Code: Select all
if (washer_usage < consumption_lower) and uservariables[washer_status_uservar] == 1 then --Washing machine is not using a lot of energy, subtract the counter
commandArray['Variable:' .. washer_counter_uservar]=tostring(math.max(tonumber(uservariables[washer_counter_uservar]) - 1, 0))
print('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), washer is idle or almost ready')
print('Subtracting counter with 1, new value: ' ..uservariables[washer_counter_uservar].. ' minutes')
elseif ((uservariables[washer_counter_uservar] ~= idle_minutes) and uservariables[washer_status_uservar] == 1) then
commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
end
my full script:
http://pastebin.com/w9aWiu3B
this way the counter resets if its not idle for consecutive mins.. Watching a load wash now and I noticed wattage dropped real low but the counter did not reset after it went back up before timeout. My Washer gives a reminder tone @ 5mins and the notification came in within seconds of that going off.
sure the idle time is in minutes?, my log indicates it is much faster (seconds?):
Code: Select all
2016-10-03 22:33:16.981 LUA: Subtracting counter, old value: 6 minutes
2016-10-03 22:33:16.981 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:26.625 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:26.625 LUA: Subtracting counter, old value: 5 minutes
2016-10-03 22:33:26.626 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:27.801 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:27.801 LUA: Subtracting counter, old value: 4 minutes
2016-10-03 22:33:27.801 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:30.062 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:30.062 LUA: Subtracting counter, old value: 3 minutes
2016-10-03 22:33:30.062 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:30.066 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:30.066 LUA: Subtracting counter, old value: 2 minutes
2016-10-03 22:33:30.066 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:30.068 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:30.068 LUA: Subtracting counter, old value: 1 minutes
2016-10-03 22:33:30.068 EventSystem: Script event triggered: Vaskemaskin LUA
2016-10-03 22:33:37.806 LUA: Current power usage (0W) is below lower boundary (10W), washer is idle or almost ready
2016-10-03 22:33:37.806 LUA: Subtracting counter, old value: 0 minutes
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 12 October 2016 21:13
by Evelen
did a test.
looks like tha value "1000" equals 1h (or 60m)
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 12 October 2016 22:12
by Nautilus
Evelen wrote:did a test.
looks like tha value "1000" equals 1h (or 60m)
Hi, as long as you make sure the script is defined as "time" script it really runs once a minute. If it is defined as "device" script it triggers for every device change which I guess could explain the above ( = about 1000 device changes in an hour). But yeah, once it is defined as time script, it'll work as intended and run only once a minute...

Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 12 October 2016 22:33
by Evelen
thanks

worked.
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Saturday 21 January 2017 11:41
by amblyo
I have problem that the script runs to often and not every minute.
How do i define a script as a "time script"?
Nautilus wrote:Evelen wrote:did a test.
looks like tha value "1000" equals 1h (or 60m)
Hi, as long as you make sure the script is defined as "time" script it really runs once a minute. If it is defined as "device" script it triggers for every device change which I guess could explain the above ( = about 1000 device changes in an hour). But yeah, once it is defined as time script, it'll work as intended and run only once a minute...

Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Saturday 21 January 2017 11:52
by ben53252642
This is the script I'm using for my washing machine (based on power usage in watts):
Code: Select all
commandArray = {}
-- Change Watt Device value to number and remove the word Watt
wattdevice = otherdevices_svalues['Washing Machine / Dryer Watts']
function stripchars(str, chrs)
local s = str:gsub("["..chrs.."]", '')
return s end
wattvalue = stripchars( wattdevice, " Watt" )
if (uservariables["WashingMachineState"] == 'notinuse' and tonumber(wattvalue) >= 10 ) then
commandArray['Variable:WashingMachineState'] = 'inuse'
end
if (uservariables["WashingMachineState"] == 'inuse' and tonumber(wattvalue) <= 1 ) then
commandArray['Variable:WashingMachineState'] = 'notinuse'
os.execute ('/var/www/tts/speak.sh "Kitchen" "The washing machine has finished."')
commandArray['SendNotification']='Notification#The washing machine has finished.'
end
return commandArray
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Saturday 21 January 2017 13:19
by Nautilus
amblyo wrote:
How do i define a script as a "time script"?
If you have the script as text file in the lua directory, the naming needs to be script_time_XXX.lua. If you have it in the database (= are using the web interface for managing events) under the "Event name" section (top right) there's a dropdown selector with default value "All" that you need to change to "Time" and save the script.
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Saturday 21 January 2017 15:24
by amblyo
Thanks!
I missed that obvious dropdown in the webinterface.
Hope that it solves my problem.
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 12 April 2017 22:59
by maomanna
i dont get it,
tried several scripts.
in the log i see (like every second)
2017-04-12 22:57:47.654 Error: EventSystem: in script_time_wasmachine: [string "--script_time_washingmachine.lua ..."]:18: attempt to compare number with nil
it is this script:
Code: Select all
--script_time_washingmachine.lua
--Change the values below to reflect to your own setup
local washer_status_uservar = 'washingmachine_status'
local energy_consumption = 'verbruik wasmachine' --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local washer_counter_uservar = 'washingmachine_counter' --Name of the uservariable that will contain the counter that is needed
local idle_minutes = 5 --The amount of minutes the consumption has to stay below the 'consumption_lower' value
local consumption_upper = 20 --If usage is higher than this value (Watts), the washingmachine has started
local consumption_lower = 4.3 --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing
-- sWatt, sTotalkWh = otherdevices_svalues['Clothes Washer Power Usage']:match("([^;]+);([^;]+)")
-- washer_usage = tonumber(sWatt)
washer_usage = tonumber(otherdevices_svalues[energy_consumption])
commandArray = {}
--Virtual switch is off, but consumption is higher than configured level, so washing has started
if (washer_usage > consumption_upper) and uservariables[washer_status_uservar] == 0 then
commandArray['Variable:' .. washer_status_uservar]='1'
print('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so washing has started!')
commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
end
--Washing machine is not using a lot of energy, check the counter
if (washer_usage < consumption_lower) and uservariables[washer_status_uservar] == 1 then
commandArray['Variable:' .. washer_counter_uservar]=tostring(math.max(tonumber(uservariables[washer_counter_uservar]) - 1, 0))
print('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), washer is idle or almost ready')
print('Subtracting counter, old value: ' ..uservariables[washer_counter_uservar].. ' minutes')
elseif ((uservariables[washer_counter_uservar] ~= idle_minutes) and uservariables[washer_status_uservar] == 1) then
commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
print('Resetting Washing Machine Timer')
end
--Washingmachine is done
if ((uservariables[washer_status_uservar] == 1) and uservariables[washer_counter_uservar] == 0) then
print('Washingmachine is DONE')
print('Current power usage washingmachine ' ..washer_usage.. 'W')
print('Washingmachine is done, please go empty it!')
commandArray['SendNotification']='Cycle Ended: Washing Machine#The load in the washing machine has finsihed, please move it to the dryer!#0'
commandArray['Variable:' .. washer_status_uservar]='0'
end
return commandArray
How can i fix this?
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 12 April 2017 23:11
by Nautilus
If you have created the script via the event management in the web UI make sure the type is set as "Time" and not "All" or "Device". If you have stored it in the file system make sure the name starts with script_time_
Then Domoticz knows it's a time script and runs it only once a minute.
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Monday 08 May 2017 20:04
by Hesmink
Thanks all for perfecting this script!
Just received my TP-Link HS110, and it got just notified of my first finished washing routine!
The notification comes around 10 minutes after actually finishing, my washing machine still does 'stuff' costing energy.
It also has anti-crease security that once in a while spins the drum. Maybe disabling this helps.
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 17 May 2017 9:32
by SiggeStardust
Just a wild idea and also perhaps ofThread .
Main thread is how to determine when a machine is done and then give a notification.
I want to focus on the later part since the detection phase is working . but instead of having a push notification like Pushover that i use, i would like to have a TTS message in my Sonos telling me that the "Laundry is done" Anyone having thoughts about how to do this ?
Besides Domoticz i also use HASS and their is a Sonos TTS interface that i thought might be usefull.
What would we do with all our time if we didnt have HomeAutomation

Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Wednesday 17 May 2017 14:22
by maomanna
SiggeStardust wrote:
What would we do with all our time if we didnt have HomeAutomation

ask your wife:-)
Re: Pushnotification when dishwasher/washing machine is ready?
Posted: Thursday 18 May 2017 22:23
by maomanna
Nautilus wrote:If you have created the script via the event management in the web UI make sure the type is set as "Time" and not "All" or "Device". If you have stored it in the file system make sure the name starts with script_time_
Then Domoticz knows it's a time script and runs it only once a minute.
it is created as time in the web ui.
When i reset the timer manually, it eventually will send my a notification when it returned to "5".
But when i start using the washingmachine, it does not reset.