Washing machine push notification scene

The washing machine is in the cellar and laundry will be forgotten inside… At least one reason for me to create a scene which sends a push notification when the washing machine runs and when it’s finished.

20161102_184456000_ios

 

The only thing you need, is a Z-Wave plug which can handle power peaks of your appliance. I use a Plug from Fibaro:

How can we detect a running or finished state? As seen on the picture below a wash cycle has some peaks and troughs which fall down to neraly zero. Therfore a scene must ignore those ups and downs. This can be achieved by using the last modification value on a device.

wama_full

 

Using a loop which requests power usage data from the plug every 20 seconds resulted in using a global variable for the current state of the washing machine.

  • Off: currently not used (maybe for future use)
  • On: When plug is turned on, but Washing machine not running
  • Running: When a wash cycle is running

var

 

The scene:

--[[
%% autostart
%% properties
50 power
%% globals
Waschmaschine
--]]

PlugID = 50;   -- Plug ID
Phone1 = 525;  -- ID Phone 1
Phone2 = 445;  -- ID Phone 2


-- Only allow one instance of the current scene to run at a time
if (fibaro:countScenes() > 1) then
  fibaro:abort()
  fibaro:debug('Scene runs already. Killing...');
end


local Wallplug =  (tonumber(fibaro:getValue(PlugID, "value")) > 0 ); -- Ist Wallplug an
if (Wallplug) 
    then 
      while true do

fibaro:debug('Start LUA...');
local tempDeviceState0, deviceLastModification0 = fibaro:get(PlugID, "power");
fibaro:debug('Last modification: ' .. deviceLastModification0);

fibaro:debug('Waschmaschine Check ob fertig...');
if (( tonumber(fibaro:getValue(PlugID, "power")) < 10 ) and (os.time() - deviceLastModification0) >= 300) then
  	if 
 		( fibaro:getGlobalValue("Waschmaschine") == "Running" )
	then
                fibaro:debug('Waschmaschine läuft noch...');
    	fibaro:debug('Waschmaschine is ON');
        fibaro:call(Phone1, "sendPush", "Waschmaschine ist fertig"); -- Push Handy
        fibaro:call(Phone2, "sendPush", "Waschmaschine ist fertig"); -- Push Handy
		fibaro:setGlobal("Waschmaschine", "On");
	end
end

fibaro:debug('Waschmaschine Check ob läuft...');
if 
 		( fibaro:getGlobalValue("Waschmaschine") ~= "Running" )
	then
	    	fibaro:debug('Variable ist nicht gleich RUNNING');
if (( tonumber(fibaro:getValue(PlugID, "power")) > 10 ) and (os.time() - deviceLastModification0) >= 60) then
	    	fibaro:debug('Waschmaschine is RUNNING');
            fibaro:call(Phone1, "sendPush", "Waschmaschine läuft"); -- Push Handy
            fibaro:call(Phone2, "sendPush", "Waschmaschine läuft"); -- Push Handy
            fibaro:setGlobal("Waschmaschine", "Running");
end
      end
    fibaro:sleep(20000);
      end
   end

 

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments