Pushnotification when dishwasher/washing machine is ready?

Moderator: leecollings

ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

I still think a script that uses some sort of counter, is the best approach.

For my motion sensor i use this script. Every minute the script is executed (script_time_nomotion.lua), a check is done if the motionsensor has activated. If not, the counter is upped with +1. When the counter reaches 30, a virtual switch is turned off.

For the washingmachine i would do something like this:

Code: Select all

--script_time_washingmachine.lua

	--Change the values below to reflect to your own setup
	local switch_washingmachine = 'virt_wasmachine'         --Name of virtual switch that will show the state of the washingmachine (on/off)
	local energy_consumption    = 'Actual_wasmachine'      	--Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
	local washer_uservar        = 'washingmachine_counter'	--Name of the uservariable that will contain the counter that is needed
	local idle_minutes          = '10'                      --The amount of minutes the consumption has to stay below the 'consumption_lower' value
	local consumption_upper     = 4.0                       --If usage is higher than this value (Watts), the washingmachine has started
	local consumption_lower     = 3.0                       --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing
        
commandArray = {}

--Virtual switch is off, but consumption is higher than configured level, so washing has started
if (tonumber(otherdevices_svalues[energy_consumption])) > consumption_upper and otherdevices[switch_washingmachine] == 'Off' then
		commandArray[switch_washingmachine]='On'
		print('Washingmachine is now ON')   
		commandArray['Variable:' .. washer_uservar]=tostring(idle_minutes)

else --Washing machine is not using a lot of energy, subtract the counter
		if (tonumber(otherdevices_svalues[energy_consumption])) <= consumption_lower and otherdevices[switch_washingmachine] == 'On' then
				commandArray['Variable:' .. washer_uservar]=tostring(math.max(uservariables[washer_uservar] - 1, 0))
				end
end

--Washingmachine is done
if (otherdevices[switch_washingmachine] == 'On' and uservariables[washer_uservar] == 0) then
		print('Washingmachine is DONE')
		commandArray['SendNotification']='Washingmachine#Washingmachine is done, please go empty it!#0' --Use Domoticz to send a notification, replace line for your own command if needed.
		commandArray[switch_washingmachine]='Off'
end   

return commandArray
Haven't tested it, maybe i will use this script later when i got myself an extra Z-Wave plug. Line #21 might need changing into:

Code: Select all

commandArray['Variable:' .. washer_uservar]=tostring(math.max(tonumber(uservariables[washer_uservar]) - 1, 0))
Including a 'timedifference' piece of code would also be nice, that could tell you how long the washingmachine needed for it's program, e.g. "Washing machine done, please empty it! Program took 1hr30mins".
Something for later :)
I am not active on this forum anymore.
thorbj
Posts: 113
Joined: Thursday 20 November 2014 22:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Norway
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by thorbj »

I'm testing your script @ThinkPad, but I think it doesn't get the readings right from energy_consumption. Nothing happens to switch_washingmachine when the washingmachine starts.
2xRaspberry Pi Model 2 w/RaZberry z-wave chip (master/slave)|Fibaro Wall Plug|Fibaro Universal Dimmer 500W|Aeon Labs Multisensor|RFXtrx433E|Nexa WMR-1000|Nexa Pe-3|Nexa Remote|Nexa LGDR3500|Lightify Gateway|Lightify RGBW bulb
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

I just ordered some extra Z-Wave plugs yesterday, i expect them to arrive next week.
So i will try my own script in a few days. Might take a few days, we don't use the washingmachine every day.

To be continued.....
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

thorbj wrote:I'm testing your script @ThinkPad, but I think it doesn't get the readings right from energy_consumption. Nothing happens to switch_washingmachine when the washingmachine starts.
I think i made some mistakes with the brackets in the comparison part (is usage higher than the defined upper limit). Try this script:

Code: Select all

    --script_time_washingmachine.lua

       --Change the values below to reflect to your own setup
       local switch_washingmachine = 'virt_wasmachine'         --Name of virtual switch that will show the state of the washingmachine (on/off)
       local energy_consumption    = 'Wasmachine'         --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
       local washer_uservar        = 'washingmachine_counter'   --Name of the uservariable that will contain the counter that is needed
       local idle_minutes          = 10                      --The amount of minutes the consumption has to stay below the 'consumption_lower' value
       local consumption_upper     = 4.0                       --If usage is higher than this value (Watts), the washingmachine has started
       local consumption_lower     = 3.0                       --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing
      sWatt, sTotalkWh 		= otherdevices_svalues[energy_consumption]:match("([^;]+);([^;]+)")

    commandArray = {}

    --Virtual switch is off, but consumption is higher than configured level, so washing has started
    if (tonumber(sWatt) > consumption_upper) and otherdevices[switch_washingmachine] == 'Off' then
          commandArray[switch_washingmachine]='On'
          print('Washingmachine is now ON')   
          commandArray['Variable:' .. washer_uservar]=tostring(idle_minutes)

    else --Washing machine is not using a lot of energy, subtract the counter
          if (tonumber(sWatt) <= consumption_lower) and otherdevices[switch_washingmachine] == 'On' then
                commandArray['Variable:' .. washer_uservar]=tostring(math.max(tonumber(uservariables[washer_uservar]) - 1, 0))
                end
    end

    --Washingmachine is done
    if (otherdevices[switch_washingmachine] == 'On' and uservariables[washer_uservar] == 0) then
          print('Washingmachine is DONE')
          commandArray['SendNotification']='Washingmachine#Washingmachine is done, please go empty it!#0' --Use Domoticz to send a notification, replace line for your own command if needed.
          commandArray[switch_washingmachine]='Off'
    end   

    return commandArray
In this case i use a Z-Wave plug that has multiple devices, one for actual usage (Watt) and one for cumulative (kWh). The last one also contains actual usage, so i don't use the Domoticz device anymore that only contains actual usage. So the script has changed a little bit, i needed an extra line of code (sWatt, sTotalkWh) to extract the actual power consumption.
I would recommend to also use only the Domoticz device that contains both cumulative + actual usage. Otherwise change the Lua script a bit, i think you can figure that out (see the script in my previous post, there i was still using a Domoticz device with only actual usage).

I still haven't got time to test it myself unfortunately. But maybe it works now, let me know :)
I am not active on this forum anymore.
thorbj
Posts: 113
Joined: Thursday 20 November 2014 22:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Norway
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by thorbj »

Thanks, I'm testing the new script :) I'm probably gonna wash some clothes later today, so I will post back with results :)
2xRaspberry Pi Model 2 w/RaZberry z-wave chip (master/slave)|Fibaro Wall Plug|Fibaro Universal Dimmer 500W|Aeon Labs Multisensor|RFXtrx433E|Nexa WMR-1000|Nexa Pe-3|Nexa Remote|Nexa LGDR3500|Lightify Gateway|Lightify RGBW bulb
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by G3rard »

I use the following script to check if my dryer is ready.

It uses a Everspring AN158 to measure the current usage.
Droger_gestart (dryer started) and Droger_gereed (dryer ready) are 2 user variables (integer).

The dryer uses ~3W when ready and then frequently goes on to prevent wrinkles which takes ~170W. So when the dryer is using ~3W I know it's ready.
That's what this script is looking for.

Maybe it is usefull for someone.

Code: Select all

-----------------------------------------------------------------------------
-- Purpose: Send message when dryer is ready
-- Author : G3rard
-- Date   : 01-08-2015
-----------------------------------------------------------------------------

-- Functions
function fprint(fMessage, fDebug)
    if (fDebug == "True") then
        print("Droger: " .. fMessage)
    end
end

function Notification(fNotification, fDebug)
    if (fDebug == "False") then
        commandArray['SendNotification'] = "" .. fNotification .. ""
    end
end

commandArray = {}
-- Set variables
-- Dryer uses ~3W when ready and then frequently goes on to prevent wrinkles which takes ~170W
sDebug = "True"

var_UsageTrigger_0 = 0										-- Usage trigger (Watt)
var_UsageTrigger_1 = 1										-- Usage trigger (Watt) --was 100
var_UsageTrigger_2 = 100									-- Usage trigger (Watt) --was 300
var_UsageTrigger_3 = 1000									-- Usage trigger (Watt)

var_dryer = 'Verbruik - droger'								-- Dryer
DeviceUsage = tonumber(otherdevices_svalues[var_dryer])		-- Usage of dryer
lastUpdatedUsrVar = uservariables_lastupdate[var_dryer]		-- Last update of dryer

var_dryer_started = 'Droger_gestart'						-- Dryer started 0-1 
var_dryer_ready = 'Droger_gereed'							-- Dryer ready 0-1
dryer_started = uservariables[var_dryer_started]			-- Dryer started 0-1
dryer_ready = uservariables[var_dryer_ready]				-- Dryer ready 0-1

if (DeviceUsage > var_UsageTrigger_3) then -- > 1000W, dryer is on
	if(dryer_started == 0) then
		fprint("Verbruik droger > " .. var_UsageTrigger_3 .. " W: droger aan", sDebug)
		fprint("Verbruik droger " .. DeviceUsage .. " W", sDebug)
		dryer_started = 1
		commandArray['Variable:' .. var_dryer_started] = tostring(dryer_started)
	end
elseif(DeviceUsage > var_UsageTrigger_1 and DeviceUsage < var_UsageTrigger_2) then -- > 1 and < 100W, dryer is ready
	if(dryer_started == 1 and dryer_ready == 0) then
		fprint("Verbruik droger tussen " .. var_UsageTrigger_1 .. " W en " .. var_UsageTrigger_2 .. ": droger gereed", sDebug)
		fprint("Verbruik droger " .. DeviceUsage .. " W", sDebug)
		commandArray['SendNotification']='Droger#De droger is klaar#1'
		os.execute('curl --url "http://192.168.1.102/domoticz/fp/sonos/index.php?zone=115&action=sendMessage&message=droger_gereed&volume=30" &') 		--Play on Sonos
		dryer_ready = 1
		commandArray['Variable:' .. var_dryer_ready] = tostring(dryer_ready)
	end
elseif(DeviceUsage == var_UsageTrigger_0) then			--0W, dryer is off
	if(dryer_started == 1 or dryer_ready == 1) then		--was and
		fprint("Verbruik droger " .. var_UsageTrigger_0 .. " W: droger gestopt",sDebug)
		dryer_started = 0
		commandArray['Variable:' .. var_dryer_started] = tostring(dryer_started)
		dryer_ready = 0
		commandArray['Variable:' .. var_dryer_ready] = tostring(dryer_ready)
	end
end

return commandArray
Not using Domoticz anymore
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

That won't work with my washingmachine, already tried a script like that.

My washer is rotating clockwise (usage > 50W or so), then stops for a few seconds (usage: 3-4W), then rotates counterclockwise (usage > 50W). And this happens a few times during the complete program (to prevent wrinkles in the laundry).
Those moments between changing turning direction create false positives with a script like yours. That's why i use the counter (minutes), the energy usage has to stay below minimum for a few minutes, only then the machine is really done.

But i am still very busy this week, haven't had time yet to try the script i posted earlier grrrrr. My hopes are on thorbj to test and debug in reallife situation :mrgreen:
I am not active on this forum anymore.
thorbj
Posts: 113
Joined: Thursday 20 November 2014 22:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Norway
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by thorbj »

thorbj wrote:Thanks, I'm testing the new script :) I'm probably gonna wash some clothes later today, so I will post back with results :)
Script still gives me a lot of notifications. I will try to increase the timer to maybe 15 or 20 sec.
2xRaspberry Pi Model 2 w/RaZberry z-wave chip (master/slave)|Fibaro Wall Plug|Fibaro Universal Dimmer 500W|Aeon Labs Multisensor|RFXtrx433E|Nexa WMR-1000|Nexa Pe-3|Nexa Remote|Nexa LGDR3500|Lightify Gateway|Lightify RGBW bulb
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

Hmmm that's stupid.

I will try to find a moment soon to test the script, maybe with a lightbulb, so i don't have to wait for the moment we need the washingmachine again.
I am not active on this forum anymore.
User avatar
mvveelen
Posts: 687
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by mvveelen »

Subscribed to this topic to see what will be the result. I think this is really fun to use. Do not really need it, but it's just fun to be able to tell when the machine is ready.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by Minglarn »

Same here :)
This gives me the opportunity to convince my wife that more nodes have to be bought :)


Sent from space using an app. :)
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

I put some effort in it, and tested it for a while by using the Z-Wave plug between my TV.
That resulted in this script.

I think it should work now, please let me know if you have tested it :mrgreen:
The values (idle_minutes, consumption_upper & consumption_lower) might need some changing depending on your type of washing machine.

- idle_minutes = the amount of minutes that the washer should use less than 'consumption_lower' to assume it is ready
- consumption_upper = If the washingmachine uses more than this amount, we assume that it has been turned on and started washing
- consumption_lower = If the washingmachine uses less than this amount, it is idle (waiting before changing tumbling direction), or ready

It also needs two uservars of type 'integer', fill them with '0' (zero) when you create them. Then fill in their names in the local: 'washer_status_uservar' and 'washer_counter_uservar'.
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

Today we had to run the washingmachine. Unfortunately my Z-Wave plug (Greenwave) was doing weird things (it gave a lot of timeouts and stuff), but i was able to heal the network/restart Domoticz before the washer ended.

Conclusion: it works!!! :D

I used this settings:

local idle_minutes = 5
local consumption_upper = 20
local consumption_lower = 3

Let me know how the script works at your setups! 8-)
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

Yesterday we had the washingmachine running again, this time my Z-Wave network didn't have any issues anymore.
Again: i only received one notification, when the washing machine was ready, just like it should.

So i consider the script working stable and ready to be used 8-)
But like i said: it depends on the parameters, you need to adapt those to your washingmachine.
I am not active on this forum anymore.
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by plutonium »

Very nice script! Will love to use it, or my wife would.

But I get this error and I have tried everything that I can imagine.

Code: Select all

Error: EventSystem: ...e/pi/domoticz/scripts/lua/script_time_washingmachine.lua:17: attempt to compare number with nil
I have i dummy switch named virt_wasmachine and user variables washingmachine_status and washingmachine_counter.

Line 17:

Code: Select all

if (washer_usage > consumption_upper) and uservariables[washer_status_uservar] == 0 then
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by nayr »

my switch (Aeon Labs DSC06106) has an output that has only wattage in the svalue, nothing else.. so I modified it as thus:

Code: Select all

-- sWatt, sTotalkWh              = otherdevices_svalues[energy_consumption]:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(otherdevices_svalues[energy_consumption])
and that seemed to work fine, the lastest script he published seems to not need the virtual switch at all.. which is good.. Works well enough I am going to get more switches for the Dish Washer and Dryer (Gas)..

I just finished testing it on a spin cycle and it worked perfectly, my switch just came in the mail today and I am hoping to have this setup as a surprise christmas gift.. Thanks @ThinkPad, got it all working within about 10mins of hooking up the laundry cleaner. With them located in basement they cant be heard when cycle has finished, too many times we have to rewash a load we forgot about.. not to mention our house keeper tossing a load in laundry and forgetting to inform us about it.

Now to put a motion sensor in the laundry room and have the notifications keep bugging us every hour or so until someone actually goes down there.. and script basement flood sensor to kill the washer if sewer pipe is clogged..
Last edited by nayr on Friday 25 December 2015 3:46, edited 6 times in total.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by plutonium »

Thanks that did the trick!
Will try it tomorrow and test this script on my dryer, washer machine and dishwasher.
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by nayr »

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.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by ThinkPad »

Nice! I don't fully understand what bug you did fix.

But great both of you could get it working :) About the meter, all of my plugs that do energy measurement have both Watt and kWh meters. I prefer the kWh meters, because they also contain the actual Watt value. This way you only need one device, where you can see the actual usage AND the accumulated power (kWh).
I am not active on this forum anymore.
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Pushnotification when dishwasher/washing machine is read

Post by nayr »

basically its just else washer counter does not equal idle mins and the washer is on, then reset washer counter to idle mins.. now it will count down the timer like before, but if the power consumption goes back up before the timer expires, the timer will reset.

I think my switch can be reconfigured to show watt/kwh in the same field, or each one individually.. I may change it, but I didnt buy the energey tracking switch to actually track energy.. just to detect when the cycle was complete.. I have a whole house power monitor on my main panel and another on my subpanel, tracking individual appliance energy consumption might be worth while.. havent put too much thought into it yet.. Wish I could just get a Smart Fuse Box that let me track each circuit's consumption and status.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest